Plasma/PortingTolibplasma2

From KDE Community Wiki

AbstractRunner

  • init() is now virtual; does not need to be a slot
  • mimeDataForMatch is now virtual; does not need to be a slot
  • mimeDataForMatch is now passed the QueryMatch by reference rather than as a pointer

AbstractToolBox

  • protected Q_SLOTS that were used as virtual methods (restore, save, reposition) are now proper virtuals

Applet

  • listAppletInfoForMimetype becomes listAppletInfoForMimeType
  • The BackgroundHints enumeration is now part of the Plasma namespace and no longer a flag but a plain enumeration.
  • config(const QString &name) has been removed as redundant to KConfigGroup(&config(), name)
  • removed screenGeometry()
  • removed all geometry functions: size(), geometry(), transform(), zValue(), raise(), lower()
  • addAction and action were removed, use actions() to get to the KActionCollection directly
  • addAssociatedWidget and removeAssociated widget were removed as they are no longer necessary for shortcuts
  • Removed Plasma::AspectRatioMode aspectRatioMode() const;
  • Removed void setAspectRatioMode(Plasma::AspectRatioMode);
  • Removed virtual bool isPopupShowing() const;
  • Not virtual virtual FormFactor formFactor() const;
  • Not virtual virtual Location location() const;
  • Not a slot anymore ItemStatus status() const;
  • SIGNAL newStatus(Plasma::ItemStatus status); Renamed to statusChanged
  • Removed DataEngine *dataEngine(const QString &name) const;
  • Renamed QString name() const; -> becomes title()
  • Renamed void setName(const QString &name) const; ->setTitle()
  • Removed QString category() const; Use pluginInfo() instead
  • Removed QString pluginName() const;Use pluginInfo() instead
  • Removed static QString category(const KPluginInfo &applet); Use pluginInfo() instead
  • Removed bool shouldConserveResources() const;
  • Moved to PluginLoader static KPluginInfo::List listAppletInfo(const QString category, const QString parentApp); -> PluginLoader
  • Moved to PluginLoader static KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype);
  • Moved to PluginLoader static KPluginInfo::List listAppletInfoForUrl(const QUrl &url);
  • Moved to PluginLoader static QStringList listCategories(const QString &parentApp, bool visibleOnly);
  • Moved to PluginLoader void setCustomCategories(const QStringList &categories); just categories in PluginLoader? : currently stored in AppletPrivate::s_customCategories perhaps every shell should set what its categories are
  • Moved to PluginLoader QStringList customCategories() const;
  • Move to PluginLoader static QString category(const QString &appletName); -> PluginLoader
  • New function: KPluginInfo pluginInfo() const;
  • Removed bool hasAuthorization(const QString &constraint) const;
  • Removed void appletTransformedByUser();
  • Removed void appletTransformedItself();
  • Remove void publish(Plasma::AnnouncementMethods methods, const QString &resourceName);
  • Remove void unpublish();
  • Remove bool isPublished() const;
  • Remove bool hasFocus() const;
  • Remove void setFocus(Qt::FocusReason);
  • Remove QFont font() const;
  • Removed void messageButtonPressed(const Plasma::MessageButton button);
  • Removed void showMessage(const QIcon &icon, const QString &message, const Plasma::MessageButtons buttons);
  • Removed SIGNAL void backgroundHintsChanged(Plasma::BackgroundHints backgroundHints);
  • Moved to scriptengine void setBackgroundHints(const Plasma::BackgroundHints hint);
  • Moved to scriptengine Plasma::BackgroundHints backgroundHints() const;
  • Moved to scriptengine bool isBusy() const;
  • Moved to scriptengine void setBusy(bool busy);
  • Removed QPoint popupPosition(const QSize &s) const; -> Dialog in bindings
  • Removed QPoint popupPosition(const QSize &s, Qt::AlignmentFlag alignment) const;

Containment

  • Containment::Type becomes Plasma::ContainmentType
  • Containment::ToolType becomes Plasma::ActionType
  • Applet *addApplet(const QString &name, const QVariantList args, const QRectF geometry ; -> becomes createApplet, args and geometry arguments go away
  • void addApplet(Applet *applet, const QPointF pos) becomes addApplet(Applet *applet), position not supported anymore
  • clearApplets() has been removed
  • lastScreen(), lastDesktop() and desktop() have been removed: different containments for each virtual desktop are not supported anymore
  • destroy() and destroy(bool) have been removed, use Applet::destroy()
  • void setScreen(int screen, int desktop) becomes setScreen(int screen), desktop not supported anymore
  • signal appletAdded(Plasma::Applet *applet, const QPointF &pos) becomes signal appletAdded(Plasma::Applet *applet), position not supported anymore
  • addToolBoxAction(QAction *action) and removeToolBoxAction(QAction *action) have been removed
  • setContainmentActions(const QString &trigger, const QString &pluginName); becomes addContainmentActions(const QString &trigger, const QString &pluginName)
  • QString containmentActions(const QString &trigger) has been removed
  • QStringList containmentActionsTriggers() has been removed
  • KConfigGroup containmentActionsConfig(); has been removed: use ContainmentActions::config() instead
  • new function: QHash<QString, ContainmentsActions *> containmentActions() const: access to all containment actions plugins
  • listContainmentsForMimetype becomes listContainmentsForMimeType
  • context() was removed
  • setActivity(QString) and activity() now use activity IDs rather than names
  • zoomRequested signal was removed
  • QGraphicsItem *toolBoxItem() was removed
  • geometry functions removed: resize() setMinimumSize(), setMaximumSize()
  • removed acceptDrops() / setAcceptDrops()
  • enableAction was removed; use KActionCollection directly
  • addAssociatedWidget and removeAssociated widget were removed as they are no longer necessary for shortcuts
  • Removed void showContextMenu(const QPointF &containmentPos, const QPoint &screenPos);
  • Removed virtual void showDropZone(const QPoint pos);
  • Removed void contextMenuEvent(QContextMenuEvent *event);
  • Removed void wheelEvent(QWheelEvent *event);
  • Removed signal void toolBoxToggled();
  • Removed signal void toolBoxVisibilityChanged(bool);

ContainmentActions

  • doesn't have Q_PROPERTIES or Q_INVOKABLES anymore, don't rely on those in client code
  • paste method is removed; instead, look for an action named "drop-current-data" via containment()->action
  • popupPosition is gone -> all screen visibility is handled by the GSS
  • isInitialized() is gone -> if needed, track this in the class itself
  • event(QEvent *) is replaced by triggerableContextAction, performNextAction and performPreviousAction
  • ContainmentActionsSource enum type, getter and setter gone. All containment actions are global by their containment type, so all panels have the same config, all desktop have the same config
  • name(), pluginName() and icon() gone; use pluginInfo() instead that has all this information
  • use ContainmentActions::config() instead of Containment::containmentActionsConfig()
  • createConfigurationInterface() is now void and uses a QWindow* as parameter
  • configAccepted() gone: management of ok/apply/cancel buttons and config save has to be done by the plugin itself
  • init() gone. plugins can do all their initialization in ctor now
  • concept of configurationRequired gone. was not used and plugins can still have a configure plugin among their actions
  • dataEngine() gone: was not used and DataEngineConsumer is public now, so is easy for plugins to use a dataengine if needed
  • triggerableContextAction() gone: if the plugin has only one action executed directly, will have only one item as contextualActions()
  • ContainmentActionsPluginConfig class gone from API: users of the library should never access it

Context

  • Plasma::Context has been removed; the Activity DataEngines or KActivity* classes should be used instead.

Corona

  • layoutContainment is now virtual (no actual porting required; it is still a protected slot)
  • importLayout(const KConfigBase &config) was removed in favor of importLayout(const KConfigGroup &config)
  • addContainmentDelayed was removed; all containments are now initialized in the same manner (with an internal delay; an implementation detail). Replace all uses of addContainmentDelayed with addContainment.
  • addAction, enableAction and action were removed, use actions() to get to the KActionCollection directly
  • Removed abstractDialogManager(), the whole class AbstractDialogMager has been removed as well
  • Removed appletMimeType() setAppletMimeType() (not used)
  • Renamed addContainment() to createContainment()
  • Removed Containment *containmentForScreen(int screen, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs); use Containment *containmentForScreen(int screen) instead and then create a containment if needed
  • Removed updateShortcuts(), addShortcuts() and shortcutsChanged()
  • Removed releaseVisualFocus()
  • Removed initializeLayout() -> use loadLayout() instead. if then corona will have 0 containments, then call loadDefaultLayout()
  • Removed defaultContainmentPlugin(), can be retrieved from the "defaults" config file from the package
  • Removed preferredToolBoxPlugin(), can be retrieved from the "defaults" config file from the package
  • Removed Corona::defaultContainmentActionsPlugins(), can be retrieved from the "defaults" config file from the package

DataEngine

  • source queue limit feature no longer available (no one used it)
  • REMOVED name(), icon(), pluginName(): use DataEngine::pluginInfo() instead.
  • REMOVED query() never use synchronous calls
  • REMOVED setDefaultService() defaultService(): use service(QString())
  • REMOVED scheduleSourcesUpdated(); dataengines should never ever call it
  • Moved static QStringList listAllEngines(const QString &parentApp); -> in PluginLoader
  • Moved static KPluginInfo::List listEngineInfo(const QString &parentApp); -> in PluginLoader
  • Moved static KPluginInfo::List listEngineInfoByCategory(const QString &category, const QString &parentApp); -> in PluginLoader
  • REMOVED explicit DataEngine(QObject *parent , KService::Ptr service); -> use explicit DataEngine(QObject *parent, const KPluginInfo &info);
  • REMOVED DataEngine(QObject *parent, const QVariantList &args); -> use explicit DataEngine(QObject *parent, const KPluginInfo &info);
  • REMOVED init() with only one constructor is not necessary anymore

DataEngineManager

  • made private API; users of DataEngineManager should now use DataEngineConsumer

DataContainer

  • added bool isUsed()
  • removed protected checkUsage()

Dialog

  • removed from libplasma
  • will have to be reimplemented in QML bindings in PlasmaCore
  • means will be visible from QML, not from the C++ part

Extenders

  • removed; rarely used, many problems with the implementation, may be brought back via QML Component

PackageMetadata

  • PackageMetadata was removed. It is replaced everywhere with KPluginInfo, except in AccessManager where a new class, RemoteObjectDescription, is used.

PackageStructure

  • setMimetypes -> setMimeTypes
  • setDefaultMimetypes -> setDefaultMimeTypes
  • mimetypes(const char*) -> mimeTypes(const char*)
  • sePrefix/prefix were removed in preference of the multi-path setPrefixPaths/prefixPaths

Plasma Namespace

  • ContextConstraint is no longer a member of the Plasma::Constraint enumeration
  • ZoomDirection, ZoomLevel and ScalingFactor were removed

PopupApplet

  • Removed from libplasma
  • Every applet will have to be able to collapse in a popup

RunnerManager

  • Removed both execQuery(). Never do sync queries

Service

  • operationDescription returns a QVariantMap instead of a KConfigGroup
  • startOperationCall taked a QVariantMap as well (same form as what is returned by operationDescription)
  • createJob takes a QVariantMap as well
  • REMOVED access(), remoting has been removed
  • REMOVED operationsChanged signal; use serviceReady instead
  • REMOVED jobFinished signal; connect to jobs individually instead
  • REMOVED parametersFromDescription, use operationDescription instead
  • NEW SIGNAL operationEnabledChanged(const QString &operation, bool enabled)
  • REMOVED associateItem; use the ServiceOperationStatus QML item instead (from PlasmaCore imports)
  • REMOVED disassociateItem; use the ServiceOperationStatus QML item instead (from PlasmaCore imports)

ServiceJob

  • QMaps have been replaced with QHashes

ScrollWidget

  • registerAsScrollWidget and unregisterAsScrollWidget removed

ToolTipContent

  • moved to PlasmaCore Declarative imports
  • setWidowToPreview/windowToPreview was removed; instead, use setWindowsToPreview/windowsToPreview which support more than one window id being passed in

Theme

  • toolTipDelay removed; is now part of the UI implementation (e.g. QML)
  • Q_properties and Q_invokables removed
  • font(), setFont() and fontMetrics() removed, they don't belong there
  • in QML plasmoids, replace theme.defaultFont.mSize with theme.mSize(theme.defaultFont)
  • Removed useNativeWidgetStyle()
  • Removed windowTranslucencyEnabled. use Qt api for it
  • Removed homepage() use pluginInfo().website() instead
  • Added KPluginInfo pluginInfo()
  • Removed settingsChanged() is private now. It should have never been explicitly called by the user
  • Theme is not a singleton anymore, but is implicitly shared. just manually create a Theme instance where needed

Wallpaper

  • C++-based plugins no longer possible, only QML-based ones supported
  • listWallpapersForMimetype becomes listWallpapersForMimeType

WindowEffects

  • moved to libkwindowsystem (a tier one Framework)
  • overrideShadow is gone as it was rendered obsolete with new window manager development and had become a no-op