#include <kstandarddirs.h>
#include <krun.h>
#include <klocale.h>
+#include <konqmimedata.h>
#include <qclipboard.h>
#include <q3dragobject.h>
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)
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);
}
}
}
- // 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 {
void dropUrls(const KUrl::List& urls,
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
};
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
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_