From 905277aac40f2a55daa5bb2925acb6d4046dacfd Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 13 Feb 2008 18:07:34 +0000 Subject: Provide the dolphinpart view modes (Icons, Details, Columns) in konqueror's View Modes menu. (this is done using a Q_PROPERTY in the dolphin part and a signal; the available view modes for creating the menu in the first place are listed in dolphinpart.desktop) Konqueror: cleaned up the old (complex) handling of view modes as N toolbar buttons from M services grouped by library. Dolphin: moved view mode handling to DolphinViewActionHandler, removes duplication between part and mainwindow. BUG: 157424 svn path=/branches/KDE/4.0/kdebase/apps/; revision=774632 --- src/dolphinpart.h | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/dolphinpart.h') diff --git a/src/dolphinpart.h b/src/dolphinpart.h index 795a7b194..75d7ee951 100644 --- a/src/dolphinpart.h +++ b/src/dolphinpart.h @@ -43,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); ~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: @@ -62,6 +83,12 @@ protected: */ virtual bool openFile() { return true; } +Q_SIGNALS: + /** + * Emitted when the view mode changes. Used by konqueror. + */ + void viewModeChanged(); + private Q_SLOTS: void slotCompleted(const KUrl& url); void slotCanceled(const KUrl& url); @@ -83,10 +110,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 @@ -100,11 +123,6 @@ 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. -- cgit v1.3