X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/d8669c68e40a6571dfcbdf38e3281a4aeb8c2be6..abf17941f7:/src/dolphinmainwindow.h diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 064bf1867..7a71b685c 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -22,24 +22,16 @@ #ifndef _DOLPHIN_MAINWINDOW_H_ #define _DOLPHIN_MAINWINDOW_H_ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "dolphinview.h" -#include #include #include -#include - -#include -#include +#include +#include -#include -#include - -#include "dolphinview.h" -#include "undomanager.h" +#include +class KNewMenu; class KPrinter; class KUrl; class QLineEdit; @@ -55,13 +47,14 @@ class DolphinApplication; * @short Main window for Dolphin. * * Handles the menus, toolbars and Dolphin views. - * - * @author Peter Penz -*/ + */ class DolphinMainWindow: public KMainWindow { Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.dolphin.MainWindow") + Q_PROPERTY(int id READ getId SCRIPTABLE true) friend class DolphinApplication; + public: virtual ~DolphinMainWindow(); @@ -94,25 +87,30 @@ public: const KUrl& destination); /** - * Returns 'true', if the clipboard contains data - * which has been cutted by the Cut action (Ctrl + X). + * Refreshs the views of the main window by recreating them dependent from + * the given Dolphin settings. */ - bool clipboardContainsCutData() const { return m_clipboardContainsCutData; } + void refreshViews(); /** - * Returns the list of actions which are part of the file group - * of the 'Create New...' sub menu. Usually the list contains actions - * for creating folders, text files, HTML files etc. + * Returns the 'Create New...' sub menu which also can be shared + * with other menus (e. g. a context menu). */ - const Q3PtrList& fileGroupActions() const { return m_fileGroupActions; } - //const QPtrList& linkGroupActions() const { return m_linkGroupActions; } - //const QPtrList& linkToDeviceActions() const { return m_linkToDeviceActions; } + KNewMenu* newMenu() const { return m_newMenu; } +public slots: /** - * Refreshs the views of the main window by recreating them dependent from - * the given Dolphin settings. + * Returns the main windows ID, mainly used throught DBus. */ - void refreshViews(); + int getId() const { return m_id; } + + /** + * Changes the URL of the current active DolphinView to \a url. + */ + void changeUrl(const QString& url); + + /** Stores all settings and quits Dolphin. */ + void quit(); signals: /** @@ -145,11 +143,8 @@ protected: void readProperties(KConfig*); private slots: - /** Opens an input dialog for creating a new folder. */ - void createFolder(); - - /** Creates a file with the MIME type given by the sender. */ - void createFile(); + /** Updates the 'Create New...' sub menu. */ + void updateNewMenu(); /** Renames the selected item of the active view. */ void rename(); @@ -167,9 +162,6 @@ private slots: */ void properties(); - /** Stores all settings and quits Dolphin. */ - void quit(); - /** * Shows the error information of the job \a job * in the status bar. @@ -191,14 +183,8 @@ private slots: /** Sets the text of the 'Undo' menu action to \a text. */ void slotUndoTextChanged(const QString& text); - /** - * Updates the state of the 'Redo' menu action dependent - * from the parameter \a available. - */ - void slotRedoAvailable(bool available); - - /** Sets the text of the 'Redo' menu action to \a text. */ - void slotRedoTextChanged(const QString& text); + /** Performs the current undo operation. */ + void undo(); /** * Copies all selected items to the clipboard and marks @@ -234,9 +220,6 @@ private slots: /** The current active view is switched to the details mode. */ void setDetailsView(); - /** The current active view is switched to the previews mode. */ - void setPreviewsView(); - /** The sorting of the current view should be done by the name. */ void sortByName(); @@ -246,6 +229,15 @@ private slots: /** The sorting of the current view should be done by the date. */ void sortByDate(); + /** The sorting of the current view should be done by the permissions. */ + void sortByPermissions(); + + /** The sorting of the current view should be done by the owner. */ + void sortByOwner(); + + /** The sorting of the current view should be done by the group. */ + void sortByGroup(); + /** Switches between an ascending and descending sorting order. */ void toggleSortOrder(); @@ -262,11 +254,14 @@ private slots: /** Stops the loading process for the current active view. */ void stopLoading(); + /** Switches between showing a preview of the file content and showing the icon. */ + void togglePreview(); + /** * Switches between showing and hiding of hidden marked files dependent * from the current state of the 'Show Hidden Files' menu toggle action. */ - void showHiddenFiles(); + void toggleShowHiddenFiles(); /** * Switches between showing and hiding of the filter bar dependent @@ -321,12 +316,6 @@ private slots: /** Opens the settings dialog for Dolphin. */ void editSettings(); - /** - * Adds the undo operation given by \a job - * to the UndoManager. - */ - void addUndoOperation(KJob* job); - /** Updates the state of all 'View' menu actions. */ void slotViewModeChanged(); @@ -357,35 +346,24 @@ private slots: /** Updates the state of the 'Show filter bar' menu action. */ void updateFilterBarAction(bool show); - /** Executes the redo operation (see UndoManager::Redo ()). */ - void redo(); - - /** Executes the undo operation (see UndoManager::Undo()). */ - void undo(); - /** Open a new main window. */ void openNewMainWindow(); private: - DolphinMainWindow(); + DolphinMainWindow(int id); void init(); void loadSettings(); void setupAccel(); void setupActions(); void setupDockWidgets(); - void setupCreateNewMenuActions(); void updateHistory(); void updateEditActions(); void updateViewActions(); void updateGoActions(); - void updateViewProperties(const KUrl::List& urls); void copyUrls(const KUrl::List& source, const KUrl& dest); void moveUrls(const KUrl::List& source, const KUrl& dest); - void addPendingUndoJob(KIO::Job* job, - DolphinCommand::Type commandType, - const KUrl::List& source, - const KUrl& dest); + void linkUrls(const KUrl::List& source, const KUrl& dest); void clearStatusBar(); /** @@ -397,9 +375,6 @@ private: void connectViewSignals(int viewIndex); private: - QSplitter* m_splitter; - DolphinView* m_activeView; - /** * DolphinMainWindowsupports only one or two views, which * are handled internally as primary and secondary view. @@ -409,44 +384,32 @@ private: PrimaryIdx = 0, SecondaryIdx = 1 }; - DolphinView* m_view[SecondaryIdx + 1]; - - /// If set to true, the clipboard contains data which should be cutted after pasting. - bool m_clipboardContainsCutData; /** - * Asynchronous operations like 'Move' and 'Copy' may only be added as undo - * operation after they have been finished successfully. When an asynchronous - * operation is started, it is added to a pending undo jobs list in the meantime. - * As soon as the job has been finished, the operation is added to the undo mangager. - * @see UndoManager - * @see DolphinMainWindow::addPendingUndoJob - * @see DolphinMainWindow::addUndoOperation + * Implements a custom error handling for the undo manager. This + * assures that all errors are shown in the status bar of Dolphin + * instead as modal error dialog with an OK button. */ - struct UndoInfo + class UndoUiInterface : public KonqUndoManager::UiInterface { - int id; - DolphinCommand command; - }; - Q3ValueList m_pendingUndoJobs; + public: + UndoUiInterface(DolphinMainWindow* mainWin); + virtual ~UndoUiInterface(); + virtual void jobError(KIO::Job* job); - /** Contains meta information for creating files. */ - struct CreateFileEntry - { - QString name; - QString filePath; - QString templatePath; - QString icon; - QString comment; + private: + DolphinMainWindow* m_mainWin; }; - Q3PtrList m_fileGroupActions; - KSortableList m_createFileTemplates; + KNewMenu* m_newMenu; + QSplitter* m_splitter; + DolphinView* m_activeView; + int m_id; + + DolphinView* m_view[SecondaryIdx + 1]; - // TODO: not used yet. See documentation of DolphinMainWindow::linkGroupActions() - // and DolphinMainWindow::linkToDeviceActions() in for details. - //QPtrList m_linkGroupActions; - //QPtrList m_linkToDeviceActions; + /// remember pending undo operations until they are finished + QList m_undoOperations; }; #endif // _DOLPHIN_H_