mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
KonqFileUndoManager moved to kdelibs, as KIO::FileUndoManager. Ported the code in libkonq+dolphin+konqueror.
svn path=/trunk/KDE/kdebase/apps/; revision=802881
This commit is contained in:
parent
fd46bdb301
commit
06e9ece821
|
@ -29,6 +29,7 @@
|
|||
// TODO replace with KonqOperations::doDrop [or move doDrop code into this class]
|
||||
// Note that this means changing the DolphinDropController controller usage
|
||||
// to "create with new and let it autodelete" instead of on stack, since doDrop is async.
|
||||
// NOTE: let's wait for KDirModel::dropEvent first.
|
||||
|
||||
DolphinDropController::DolphinDropController(QWidget* parentWidget)
|
||||
: QObject(parentWidget), m_parentWidget(parentWidget)
|
||||
|
@ -107,17 +108,17 @@ void DolphinDropController::dropUrls(const KUrl::List& urls,
|
|||
switch (action) {
|
||||
case Qt::MoveAction:
|
||||
KonqOperations::copy(m_parentWidget, KonqOperations::MOVE, urls, destination);
|
||||
emit doingOperation(KonqFileUndoManager::MOVE);
|
||||
emit doingOperation(KIO::FileUndoManager::Move);
|
||||
break;
|
||||
|
||||
case Qt::CopyAction:
|
||||
KonqOperations::copy(m_parentWidget, KonqOperations::COPY, urls, destination);
|
||||
emit doingOperation(KonqFileUndoManager::COPY);
|
||||
emit doingOperation(KIO::FileUndoManager::Copy);
|
||||
break;
|
||||
|
||||
case Qt::LinkAction:
|
||||
KonqOperations::copy(m_parentWidget, KonqOperations::LINK, urls, destination);
|
||||
emit doingOperation(KonqFileUndoManager::LINK);
|
||||
emit doingOperation(KIO::FileUndoManager::Link);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <kurl.h>
|
||||
#include <konq_fileundomanager.h>
|
||||
#include <kio/fileundomanager.h>
|
||||
|
||||
#include "libdolphin_export.h"
|
||||
|
||||
|
@ -55,7 +55,7 @@ signals:
|
|||
* Is emitted when renaming, copying, moving, linking etc.
|
||||
* Used for feedback in the mainwindow.
|
||||
*/
|
||||
void doingOperation(KonqFileUndoManager::CommandType type);
|
||||
void doingOperation(KIO::FileUndoManager::CommandType type);
|
||||
|
||||
private:
|
||||
QWidget* m_parentWidget;
|
||||
|
|
|
@ -39,8 +39,8 @@ void DolphinFilePlacesView::slotUrlsDropped(const KUrl& dest, QDropEvent* event,
|
|||
|
||||
DolphinDropController dropController(parent);
|
||||
// forward doingOperation signal up to the mainwindow
|
||||
connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
|
||||
this, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)));
|
||||
connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)),
|
||||
this, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)));
|
||||
dropController.dropUrls(urls, dest);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ DolphinMainWindow::DolphinMainWindow(int id) :
|
|||
new MainWindowAdaptor(this);
|
||||
QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this);
|
||||
|
||||
KonqFileUndoManager* undoManager = KonqFileUndoManager::self();
|
||||
KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
|
||||
undoManager->setUiInterface(new UndoUiInterface());
|
||||
|
||||
connect(undoManager, SIGNAL(undoAvailable(bool)),
|
||||
|
@ -133,7 +133,7 @@ void DolphinMainWindow::toggleViews()
|
|||
m_viewTab[m_tabIndex].secondaryView = container;
|
||||
}
|
||||
|
||||
void DolphinMainWindow::slotDoingOperation(KonqFileUndoManager::CommandType commandType)
|
||||
void DolphinMainWindow::slotDoingOperation(KIO::FileUndoManager::CommandType commandType)
|
||||
{
|
||||
clearStatusBar();
|
||||
m_undoCommandTypes.append(commandType);
|
||||
|
@ -160,8 +160,8 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls,
|
|||
const KUrl& destination)
|
||||
{
|
||||
DolphinDropController dropController(this);
|
||||
connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
|
||||
this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
|
||||
connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)),
|
||||
this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType)));
|
||||
dropController.dropUrls(urls, destination);
|
||||
}
|
||||
|
||||
|
@ -387,31 +387,31 @@ void DolphinMainWindow::slotUndoAvailable(bool available)
|
|||
}
|
||||
|
||||
if (available && (m_undoCommandTypes.count() > 0)) {
|
||||
const KonqFileUndoManager::CommandType command = m_undoCommandTypes.takeFirst();
|
||||
const KIO::FileUndoManager::CommandType command = m_undoCommandTypes.takeFirst();
|
||||
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
|
||||
switch (command) {
|
||||
case KonqFileUndoManager::COPY:
|
||||
case KIO::FileUndoManager::Copy:
|
||||
statusBar->setMessage(i18nc("@info:status", "Copy operation completed."),
|
||||
DolphinStatusBar::OperationCompleted);
|
||||
break;
|
||||
case KonqFileUndoManager::MOVE:
|
||||
case KIO::FileUndoManager::Move:
|
||||
statusBar->setMessage(i18nc("@info:status", "Move operation completed."),
|
||||
DolphinStatusBar::OperationCompleted);
|
||||
break;
|
||||
case KonqFileUndoManager::LINK:
|
||||
case KIO::FileUndoManager::Link:
|
||||
statusBar->setMessage(i18nc("@info:status", "Link operation completed."),
|
||||
DolphinStatusBar::OperationCompleted);
|
||||
break;
|
||||
case KonqFileUndoManager::TRASH:
|
||||
case KIO::FileUndoManager::Trash:
|
||||
statusBar->setMessage(i18nc("@info:status", "Move to trash operation completed."),
|
||||
DolphinStatusBar::OperationCompleted);
|
||||
break;
|
||||
case KonqFileUndoManager::RENAME:
|
||||
case KIO::FileUndoManager::Rename:
|
||||
statusBar->setMessage(i18nc("@info:status", "Renaming operation completed."),
|
||||
DolphinStatusBar::OperationCompleted);
|
||||
break;
|
||||
|
||||
case KonqFileUndoManager::MKDIR:
|
||||
case KIO::FileUndoManager::Mkdir:
|
||||
statusBar->setMessage(i18nc("@info:status", "Created folder."),
|
||||
DolphinStatusBar::OperationCompleted);
|
||||
break;
|
||||
|
@ -434,8 +434,8 @@ void DolphinMainWindow::slotUndoTextChanged(const QString& text)
|
|||
void DolphinMainWindow::undo()
|
||||
{
|
||||
clearStatusBar();
|
||||
KonqFileUndoManager::self()->uiInterface()->setParentWidget(this);
|
||||
KonqFileUndoManager::self()->undo();
|
||||
KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
|
||||
KIO::FileUndoManager::self()->undo();
|
||||
}
|
||||
|
||||
void DolphinMainWindow::cut()
|
||||
|
@ -1152,8 +1152,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
|
|||
this, SLOT(slotRequestItemInfo(KFileItem)));
|
||||
connect(view, SIGNAL(activated()),
|
||||
this, SLOT(toggleActiveView()));
|
||||
connect(view, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
|
||||
this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
|
||||
connect(view, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)),
|
||||
this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType)));
|
||||
connect(view, SIGNAL(tabRequested(const KUrl&)),
|
||||
this, SLOT(openNewTab(const KUrl&)));
|
||||
|
||||
|
@ -1189,7 +1189,7 @@ QString DolphinMainWindow::tabName(const KUrl& url) const
|
|||
}
|
||||
|
||||
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
|
||||
KonqFileUndoManager::UiInterface()
|
||||
KIO::FileUndoManager::UiInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
|
|||
DolphinStatusBar* statusBar = mainWin->activeViewContainer()->statusBar();
|
||||
statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
|
||||
} else {
|
||||
KonqFileUndoManager::UiInterface::jobError(job);
|
||||
KIO::FileUndoManager::UiInterface::jobError(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <config-nepomuk.h>
|
||||
|
||||
#include <kfileitemdelegate.h>
|
||||
#include <konq_fileundomanager.h>
|
||||
#include <kio/fileundomanager.h>
|
||||
#include <ksortablelist.h>
|
||||
#include <kxmlguiwindow.h>
|
||||
|
||||
|
@ -323,7 +323,7 @@ private slots:
|
|||
void toggleActiveView();
|
||||
|
||||
/** Called when the view is doing a file operation, like renaming, copying, moving etc. */
|
||||
void slotDoingOperation(KonqFileUndoManager::CommandType type);
|
||||
void slotDoingOperation(KIO::FileUndoManager::CommandType type);
|
||||
|
||||
/**
|
||||
* Activates the tab with the index \a index, which means that the current view
|
||||
|
@ -388,7 +388,7 @@ private:
|
|||
* assures that all errors are shown in the status bar of Dolphin
|
||||
* instead as modal error dialog with an OK button.
|
||||
*/
|
||||
class UndoUiInterface : public KonqFileUndoManager::UiInterface
|
||||
class UndoUiInterface : public KIO::FileUndoManager::UiInterface
|
||||
{
|
||||
public:
|
||||
UndoUiInterface();
|
||||
|
@ -418,7 +418,7 @@ private:
|
|||
DolphinViewActionHandler* m_actionHandler;
|
||||
|
||||
/// remember pending undo operations until they are finished
|
||||
QList<KonqFileUndoManager::CommandType> m_undoCommandTypes;
|
||||
QList<KIO::FileUndoManager::CommandType> m_undoCommandTypes;
|
||||
};
|
||||
|
||||
inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const
|
||||
|
|
|
@ -518,7 +518,7 @@ void DolphinView::renameSelectedItems()
|
|||
if (newName.isEmpty()) {
|
||||
emit errorMessage(dialog.errorString());
|
||||
} else {
|
||||
// TODO: check how this can be integrated into KonqFileUndoManager/KonqOperations
|
||||
// TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
|
||||
// as one operation instead of n rename operations like it is done now...
|
||||
Q_ASSERT(newName.contains('#'));
|
||||
|
||||
|
@ -536,7 +536,7 @@ void DolphinView::renameSelectedItems()
|
|||
KUrl newUrl = oldUrl;
|
||||
newUrl.setFileName(name);
|
||||
KonqOperations::rename(this, oldUrl, newUrl);
|
||||
emit doingOperation(KonqFileUndoManager::RENAME);
|
||||
emit doingOperation(KIO::FileUndoManager::Rename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -566,14 +566,14 @@ void DolphinView::renameSelectedItems()
|
|||
KUrl newUrl = oldUrl;
|
||||
newUrl.setFileName(newName);
|
||||
KonqOperations::rename(this, oldUrl, newUrl);
|
||||
emit doingOperation(KonqFileUndoManager::RENAME);
|
||||
emit doingOperation(KIO::FileUndoManager::Rename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinView::trashSelectedItems()
|
||||
{
|
||||
emit doingOperation(KonqFileUndoManager::TRASH);
|
||||
emit doingOperation(KIO::FileUndoManager::Trash);
|
||||
KonqOperations::del(this, KonqOperations::TRASH, selectedUrls());
|
||||
}
|
||||
|
||||
|
@ -800,8 +800,8 @@ void DolphinView::dropUrls(const KUrl::List& urls,
|
|||
{
|
||||
DolphinDropController dropController(this);
|
||||
// forward doingOperation signal up to the mainwindow
|
||||
connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
|
||||
this, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)));
|
||||
connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)),
|
||||
this, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)));
|
||||
dropController.dropUrls(urls, destination);
|
||||
}
|
||||
|
||||
|
@ -1163,11 +1163,11 @@ void DolphinView::pasteToUrl(const KUrl& url)
|
|||
const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData);
|
||||
if (KonqMimeData::decodeIsCutSelection(mimeData)) {
|
||||
KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, url);
|
||||
emit doingOperation(KonqFileUndoManager::MOVE);
|
||||
emit doingOperation(KIO::FileUndoManager::Move);
|
||||
clipboard->clear();
|
||||
} else {
|
||||
KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, url);
|
||||
emit doingOperation(KonqFileUndoManager::COPY);
|
||||
emit doingOperation(KIO::FileUndoManager::Copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <kparts/part.h>
|
||||
#include <kfileitem.h>
|
||||
#include <kfileitemdelegate.h>
|
||||
#include <konq_fileundomanager.h>
|
||||
#include <kio/fileundomanager.h>
|
||||
#include <kio/job.h>
|
||||
|
||||
#include <QBoxLayout>
|
||||
|
@ -496,7 +496,7 @@ signals:
|
|||
* Is emitted when renaming, copying, moving, linking etc.
|
||||
* Used for feedback in the mainwindow.
|
||||
*/
|
||||
void doingOperation(KonqFileUndoManager::CommandType type);
|
||||
void doingOperation(KIO::FileUndoManager::CommandType type);
|
||||
|
||||
protected:
|
||||
/** @see QWidget::mouseReleaseEvent */
|
||||
|
|
Loading…
Reference in a new issue