Plasma/libplasma2/API Review: Difference between revisions

From KDE Community Wiki
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Applet =
;[[Plasma/libplasma2/API_Review/Applet|Applet]]
== QProperties ==
;[[Plasma/libplasma2/API_Review/Containment|Containment]]
All Q_PROPERTY and Q_INVOKABLE will be removed from Applet, that is no more directly exposed in QML.
;[[Plasma/libplasma2/API_Review/ContainmentActions|ContainmentActions]]
 
;[[Plasma/libplasma2/API_Review/Corona|Corona]]
== Bookkeeping ==
;[[Plasma/libplasma2/API_Review/DataContainer|DataContainer]]
 
;[[Plasma/libplasma2/API_Review/DataEngine|DataEngine]]
{| cellspacing="0" cellpadding="5" border="1" style="border: 1px solid gray; border-collapse: collapse; text-align: left; width: 100%;" class="sortable"
;[[Plasma/libplasma2/API_Review/Service|Service]]
|- style="background: rgb(236, 236, 236) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; white-space: nowrap;"
;[[Plasma/libplasma2/API_Review/Theme|Theme]]
 
;[[Plasma/libplasma2/API_Review/RunnerManager|RunnerManager]]
! Status
! Action
! Method
 
{{FeatureDone|Keep| uint id() const;}}
{{FeatureDone|Keep| void setImmutability(const ImmutabilityType immutable);}}
{{FeatureDone|Keep| ImmutabilityType immutability() const;}}
{{FeatureDone|Keep| SIGNAL void immutabilityChanged(Plasma::ImmutabilityType immutable);}}
{{FeatureDone|Keep| bool hasFailedToLaunch() const;}}
{{FeatureTodo|Keep| void setFailedToLaunch(bool failed, const QString &reason); '''TODO''':  show why the thing failed in the UI }}
{{FeatureDone|Keep| bool destroyed() const;}}
{{FeatureDone|Keep| virtual void destroy();}}
{{FeatureTodo|Keep| Containment *containment() const; '''NOTE''': Containment is NOT an applet anymore}}
{{FeatureTodo|Not Slot| ItemStatus status() const; → unslotify}}
{{FeatureDone|Keep| void setStatus(const ItemStatus stat);}}
{{FeatureTodo|Change name| SIGNAL void newStatus(Plasma::ItemStatus status);  '''TODO''': change name to statusChanged}}
{{FeatureTodo|Not virtual| virtual FormFactor formFactor() const;   -> not virtual}}
{{FeatureTodo|Not virtual| virtual Location location() const;    -> not virtual}}
 
{{FeatureTodo|Remove| Plasma::AspectRatioMode aspectRatioMode() const;}}
{{FeatureTodo|Remove|  void setAspectRatioMode(Plasma::AspectRatioMode);}}
{{FeatureTodo|Remove| bool isContainment() const;}}
{{FeatureTodo|Remove| virtual bool isPopupShowing() const;}}
{{FeatureTodo|Remove| QVariantList startupArguments() const; '''TODO''': templated config for startup}}
{{FeatureTodo|Remove| bool hasFocus() const;}}
{{FeatureTodo|Remove| void setFocus(Qt::FocusReason);}}
 
|}
 
       
 
==Configuration==
We should have a single configuration object binded to qml (either created by autogenerated qml, a model or a property hash)
        KConfigGroup config() const;
        KConfigGroup globalConfig() const;
        ConfigLoader *configScheme() const;
Topic: can this be made flexible enough to replace config read/write?
Topic: will need a global version (for globalConfig())
Topic: should we use QML for config, if so: how?
        virtual void save(KConfigGroup &group) const;
        virtual void restore(KConfigGroup &group);
        virtual void configChanged(); -> to signal
        virtual void saveState(KConfigGroup &config) const;
        SIGNAL void configNeedsSaving();
        bool hasConfigurationInterface() const;
        void setHasConfigurationInterface(bool hasInterface);
        void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
        bool configurationRequired() const;
        virtual void showConfigurationInterface();
=== Completely UI-specific, remove or move to scriptengine ===
        void showConfigurationInterface(QWidget *widget);
        virtual void createConfigurationInterface(KConfigDialog *parent);
        bool isUserConfiguring() const
        Private class AppletConfigDialog is part of this
 
== Utils ==
=== Keep ===
        Package package() const;
        void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
        void flushPendingConstraintsEvents();
        virtual void constraintsEvent(Plasma::Constraints constraints);
=== Remove ===
        DataEngine *dataEngine(const QString &name) const;
        QPoint popupPosition(const QSize &s) const; -> Dialog in bindings
        QPoint popupPosition(const QSize &s, Qt::AlignmentFlag alignment) const;
 
== Metadata ==
=== Add ===
      KPluginInfo pluginInfo() const;
 
=== Keep ===
        QString name() const;  -> becomes title()
        void setName(const QString &name) const; ->setTitle
 
=== To PluginLoader ===
Most metadata related functions will go into PluginLoader
 
        static KPluginInfo::List listAppletInfo(const QString &category = QString(),
                                                const QString &parentApp = QString());  -> PluginLoader
        static KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype);
        static KPluginInfo::List listAppletInfoForUrl(const QUrl &url);
        static QStringList listCategories(const QString &parentApp = QString(),
                                          bool visibleOnly = true);
 
just categories in PluginLoader? : currently stored in AppletPrivate::s_customCategories perhaps every shell should set what its categories are
 
        void setCustomCategories(const QStringList &categories);
        QStringList customCategories() const;
 
Merged in PluginLoader::loadApplet: right now pluginloader instantiates only the right Applet*, it should try to load the package as well.
        static Applet *loadPlasmoid(const QString &path, uint appletId = 0,
                                    const QVariantList &args = QVariantList());
 
        static QString category(const QString &appletName); -> PluginLoader
 
    QString icon() const; use case?
      QString category() const;
      QString pluginName() const;
 
=== Remove ===
        static QString category(const KPluginInfo &applet);
        QFont font() const;
        bool shouldConserveResources() const;
 
== Actions ==
=== Keep ===
        virtual QList<QAction*> contextualActions();
        QAction *action(QString name) const
        void addAction(QString name, QAction *action);
 
=== Remove ===
        void setGlobalShortcut(const KShortcut &shortcut);
        KShortcut globalShortcut() const;
        void activate();
        bool hasAuthorization(const QString &constraint) const;
 
 
== Constructors ==
 
        explicit Applet(QObject *parent = 0, const QString &serviceId = QString(), uint appletId = 0);
 
Merge the following one into above explicit Applet(QObject *parent, const QString &serviceId, uint appletId, const QVariantList &args);
 
        explicit Applet(const KPluginInfo &info, QObject *parent = 0, uint appletId = 0);
        Applet(QObject *parent, const QVariantList &args);
        virtual void init();
 
== Associated Application ==
        void setAssociatedApplication(const QString &string);
        void setAssociatedApplicationUrls(const QList<QUrl> &urls);
        QString associatedApplication() const;
        QList<QUrl> associatedApplicationUrls() const;
        bool hasValidAssociatedApplication() const;
        void runAssociatedApplication(); '''TODO''': ensure that setAssociatedApplication handles .desktop files
 
== Other SIGNALS ==
=== Remove ===
        void releaseVisualFocus();
 
        void appletTransformedByUser();
        void appletTransformedItself();
 
        void appletDeleted(Plasma::Applet *applet); '''TODO''': fix usage in Containment
 
== Sharing Widgets ==
Remote widgets will be completetely removed and eventually reimplemented again later from scratch.
'''TODO''': a new and improved revisioned remove widgets (or probably just dataengines and services) system
 
=== Remove ===
        void publish(Plasma::AnnouncementMethods methods, const QString &resourceName);
        void unpublish();
        bool isPublished() const;
 
== To script engine ==
Move the following to the declarative scriptengine:
        void setBackgroundHints(const Plasma::BackgroundHints hint);
        Plasma::BackgroundHints backgroundHints() const;
        bool isBusy() const;
        void setBusy(bool busy);
        virtual void addAssociatedWidget(QWidget *widget);
        virtual void removeAssociatedWidget(QWidget *widget);
        void messageButtonPressed(const Plasma::MessageButton button);
        void showMessage(const QIcon &icon, const QString &message, const Plasma::MessageButtons buttons);
        SIGNAL void backgroundHintsChanged(Plasma::BackgroundHints backgroundHints);
 
= Containment =
 
== Constructors ==
All still needed?
* explicit Containment(QObject *parent = 0,  const QString &serviceId = QString(),  uint containmentId = 0)
* Containment(QObject *parent, const QVariantList &args);
* private Containment(const QString &packagePath, uint appletId, const QVariantList &args);
 
== Methods ==
* Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),  const QRectF &geometry = QRectF(-1, -1, -1, -1)); Remove Geometry? not possible anymore
* void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1)); Remove pos? (not possible anymore)
* void setScreen(int screen, int desktop = -1); Drop desktop? (that means dropping the per-virtual desktop views feature, it can be "emulated" with activities and would make things dramatically simpler)
* int desktop() const;
* int lastDesktop() const;
* void showContextMenu(const QPointF &containmentPos, const QPoint &screenPos);
* virtual void showDropZone(const QPoint pos);
* void contextMenuEvent(QContextMenuEvent *event);
* void keyPressEvent(QKeyEvent *event);
* void wheelEvent(QWheelEvent *event);
 
==== In PluginLoader? ====
* static KPluginInfo::List listContainments(const QString &category = QString(),  const QString &parentApp = QString());
* static KPluginInfo::List listContainmentsOfType(const QString &type,  const QString &category = QString(),  const QString &parentApp = QString());
* static QStringList listContainmentTypes();
* static KPluginInfo::List listContainmentsForMimeType(const QString &mimeType);
 
== Signals ==
* void toolBoxToggled();
* void toolBoxVisibilityChanged(bool);
* void showAddWidgetsInterface(const QPointF &pos); (cannot have a position, maybe not needed at all)
 
= Corona =
== Methods ==
* Containment *containmentForScreen(int screen, int desktop = -1) const; Remove desktop?
* Containment *containmentForScreen(int screen, int desktop, const QString &defaultPluginIfNonExistent,  const QVariantList &defaultArgs = QVariantList()); Remove desktop?
 
Still necassary?
* void setAppletMimeType(const QString &mimetype);
* QString appletMimeType();
* void setDialogManager(AbstractDialogManager *manager); DialogManager was fow main windows of config uis. If all config is going to be qml, this could go (alternative is that we do an AbstractDialogManager that is a declarative view: possible as well).
* AbstractDialogManager *dialogManager();
* QString preferredToolBoxPlugin(const Containment::Type type) const; Toolboxes, instead of plugin may come from the only corona QML package.
void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin);
*  void setDefaultContainmentPlugin(const QString &name);  Default containment plugin also told in the one Corona QML package?
* void requestConfigSync(); Ugly api: are requestConfigSync and requireConfigSync still required both?
* void requireConfigSync();
 
==Signals ==
* void releaseVisualFocus();

Latest revision as of 11:30, 2 April 2013