]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinpart.h
Ported dolphinpart to K_PLUGIN_FACTORY
[dolphin.git] / src / dolphinpart.h
index 797c34d71eea2f3bd0c321af500f9ee6df1fe881..eaf9cb74e587b392bfdf81a75e7f4164093c0240 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <kparts/part.h>
 #include <kparts/browserextension.h>
+class DolphinViewActionHandler;
 class QActionGroup;
 class KAction;
 class KFileItemList;
@@ -42,17 +43,38 @@ class DolphinPart : public KParts::ReadOnlyPart
     // Even though it's konqueror doing the undo...
     Q_PROPERTY( bool supportsUndo READ supportsUndo )
 
+    Q_PROPERTY( QString currentViewMode READ currentViewMode WRITE setCurrentViewMode )
+
 public:
-    explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QStringList& args);
+    explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args);
     ~DolphinPart();
 
     static KAboutData* createAboutData();
 
+    /**
+     * Standard KParts::ReadOnlyPart openUrl method.
+     * Called by Konqueror to view a directory in DolphinPart.
+     */
     virtual bool openUrl(const KUrl& url);
 
     /// see the supportsUndo property
     bool supportsUndo() const { return true; }
 
+    /**
+     * Used by konqueror for setting the view mode
+     * @param viewModeName internal name for the view mode, like "icons"
+     * Those names come from the Actions line in dolphinpart.desktop,
+     * and have to match the name of the KActions.
+     */
+    void setCurrentViewMode(const QString& viewModeName);
+
+    /**
+     * Used by konqueror for displaying the current view mode.
+     * @see setCurrentViewMode
+     */
+    QString currentViewMode() const;
+
+    /// Returns the view owned by this part; used by DolphinPartBrowserExtension
     DolphinView* view() { return m_view; }
 
 protected:
@@ -61,6 +83,18 @@ protected:
      */
     virtual bool openFile() { return true; }
 
+Q_SIGNALS:
+    /**
+     * Emitted when the view mode changes. Used by konqueror.
+     */
+    void viewModeChanged();
+
+
+    /**
+     * Emitted whenever the current URL is about to be changed.
+     */ 
+    void aboutToOpenURL();
+
 private Q_SLOTS:
     void slotCompleted(const KUrl& url);
     void slotCanceled(const KUrl& url);
@@ -82,10 +116,6 @@ private Q_SLOTS:
      * @url   URL which contains \a item.
      */
     void slotOpenContextMenu(const KFileItem& item, const KUrl& url);
-    /**
-     * Emitted when the user requested a change of view mode
-     */
-    void slotViewModeActionTriggered(QAction*);
 
     /**
      * Asks the host to open the URL \a url if the current view has
@@ -99,22 +129,12 @@ private Q_SLOTS:
      */
     void slotSelectionChanged(const KFileItemList& selection);
 
-    /**
-     * Same as in DolphinMainWindow: updates the view menu actions
-     */
-    void updateViewActions();
-
     /**
      * Updates the text of the paste action dependent from
      * the number of items which are in the clipboard.
      */
     void updatePasteAction();
 
-    /**
-     * Connected to the "move_to_trash" action; adds "shift means del" handling.
-     */
-    void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
-
     /**
      * Connected to all "Go" menu actions provided by DolphinPart
      */
@@ -130,27 +150,6 @@ private Q_SLOTS:
      */
     void slotProperties();
 
-    /**
-     * Opens the dialog for creating a directory. Is connected
-     * with the key shortcut for "new directory" (F10).
-     */
-    void createDir();
-
-    /** Updates the state of the 'Show preview' menu action. */
-    void slotShowPreviewChanged();
-
-    /** Updates the state of the 'Show hidden files' menu action. */
-    void slotShowHiddenFilesChanged();
-
-    /** Updates the state of the 'Categorized sorting' menu action. */
-    void slotCategorizedSortingChanged();
-
-    /** Updates the state of the 'Sort Ascending/Descending' action. */
-    void slotSortOrderChanged(Qt::SortOrder);
-
-    /** Updates the state of the 'Additional Information' actions. */
-    void slotAdditionalInfoChanged();
-
 private:
     void createActions();
     void createGoAction(const char* name, const char* iconName,
@@ -159,6 +158,7 @@ private:
 
 private:
     DolphinView* m_view;
+    DolphinViewActionHandler* m_actionHandler;
     KDirLister* m_dirLister;
     DolphinModel* m_dolphinModel;
     DolphinSortFilterProxyModel* m_proxyModel;
@@ -177,6 +177,7 @@ public Q_SLOTS:
     void cut();
     void copy();
     void paste();
+    void reparseConfiguration();
 
 private:
     DolphinPart* m_part;