diff options
| author | Peter Penz <[email protected]> | 2006-12-17 13:47:45 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2006-12-17 13:47:45 +0000 |
| commit | 8b240249dbc3ea965cbcb4d311aeba5c30e85127 (patch) | |
| tree | 49d90759d5903189f17549c17b6f9bff213195f9 | |
| parent | c28c72619cef1edaf6ca732d293b321f5ac220e5 (diff) | |
Use KonqMimeData for the cut- and copy-operation instead of using bool property inside DolphinMainWindow. This assures that cut- and copy-operations also work within multiple Dolphin main windows.
svn path=/trunk/playground/utils/dolphin/; revision=614351
| -rw-r--r-- | src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/dolphinmainwindow.cpp | 44 | ||||
| -rw-r--r-- | src/dolphinmainwindow.h | 16 |
3 files changed, 11 insertions, 51 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c50ce550..569e178c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,7 +57,7 @@ kde4_add_kcfg_files(dolphin_SRCS kde4_add_executable(dolphin ${dolphin_SRCS}) -target_link_libraries(dolphin ${KDE4_KDECORE_LIBS} ${KDE4_KDEPRINT_LIBS} ) +target_link_libraries(dolphin ${KDE4_KDECORE_LIBS} ${KDE4_KDEPRINT_LIBS} konq ) install(TARGETS dolphin DESTINATION ${BIN_INSTALL_DIR}) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index dd985fc1d..3ed4a5403 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -51,6 +51,7 @@ #include <kstandarddirs.h> #include <krun.h> #include <klocale.h> +#include <konqmimedata.h> #include <qclipboard.h> #include <q3dragobject.h> @@ -79,31 +80,19 @@ DolphinMainWindow::DolphinMainWindow() : KMainWindow(0), m_splitter(0), - m_activeView(0), - m_clipboardContainsCutData(false) + m_activeView(0) { setObjectName("Dolphin"); m_view[PrimaryIdx] = 0; m_view[SecondaryIdx] = 0; - - // TODO: the following members are not used yet. See documentation - // of DolphinMainWindow::linkGroupActions() and DolphinMainWindow::linkToDeviceActions() - // in the header file for details. } DolphinMainWindow::~DolphinMainWindow() { qDeleteAll(m_fileGroupActions); - //qDeleteAll(m_linkToDeviceActions); - //qDeleteAll(m_linkGroupActions); m_fileGroupActions.clear(); - //m_linkGroupActions.clear(); - //m_linkToDeviceActions.clear(); - /* - * bye, bye managed window - */ - DolphinApplication::app()->removeMainWindow( this ); + DolphinApplication::app()->removeMainWindow(this); } void DolphinMainWindow::setActiveView(DolphinView* view) @@ -653,25 +642,19 @@ void DolphinMainWindow::slotRedoTextChanged(const QString& text) void DolphinMainWindow::cut() { - // TODO: this boolean doesn't work between instances of dolphin or with konqueror or with other - // apps. The "application/x-kde-cutselection" mimetype should be used instead, see KonqMimeData - // in libkonq - m_clipboardContainsCutData = true; - QMimeData* mimeData = new QMimeData(); - const KUrl::List selectedUrls = m_activeView->selectedUrls(); - selectedUrls.populateMimeData(mimeData); - + const KUrl::List kdeUrls = m_activeView->selectedUrls(); + const KUrl::List mostLocalUrls; + KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, true); QApplication::clipboard()->setMimeData(mimeData); } void DolphinMainWindow::copy() { - m_clipboardContainsCutData = false; - QMimeData* mimeData = new QMimeData(); - const KUrl::List selectedUrls = m_activeView->selectedUrls(); - selectedUrls.populateMimeData(mimeData); + const KUrl::List kdeUrls = m_activeView->selectedUrls(); + const KUrl::List mostLocalUrls; + KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, false); QApplication::clipboard()->setMimeData(mimeData); } @@ -702,15 +685,8 @@ void DolphinMainWindow::paste() } } - // TODO #1: use libkonq commands (see doPaste() implementation - // KIO::Job* job = KIO::pasteClipboard(destUrl, this, false); - // ... - // TODO #2: this boolean doesn't work between instances of dolphin or with konqueror or with other - // apps. The "application/x-kde-cutselection" mimetype should be used instead, see KonqMimeData - // in libkonq - if (m_clipboardContainsCutData) { + if (KonqMimeData::decodeIsCutSelection(mimeData)) { moveUrls(sourceUrls, destUrl); - m_clipboardContainsCutData = false; clipboard->clear(); } else { diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index e61e1775e..b9a9db3d8 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -94,19 +94,11 @@ public: const KUrl& destination); /** - * Returns 'true', if the clipboard contains data - * which has been cutted by the Cut action (Ctrl + X). - */ - bool clipboardContainsCutData() const { return m_clipboardContainsCutData; } - - /** * 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. */ QLinkedList<QAction*> fileGroupActions() const { return m_fileGroupActions; } - //QLinkedList<QAction*>& linkGroupActions() const { return m_linkGroupActions; } - //QLinkedList<QAction*>& linkToDeviceActions() const { return m_linkToDeviceActions; } /** * Refreshs the views of the main window by recreating them dependent from @@ -411,9 +403,6 @@ private: }; 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 @@ -442,11 +431,6 @@ private: QLinkedList<QAction*> m_fileGroupActions; KSortableList<CreateFileEntry,QString> m_createFileTemplates; - - // TODO: not used yet. See documentation of DolphinMainWindow::linkGroupActions() - // and DolphinMainWindow::linkToDeviceActions() in for details. - //QLinkedList<QAction*> m_linkGroupActions; - //QLinkedList<QAction*> m_linkToDeviceActions; }; #endif // _DOLPHIN_H_ |
