X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/817f3952e2bed820ea3b50dfdfe91ccb99dcb748..aa0b09dac43ec2a58bd32a1e08d59acd35bd86aa:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 75d0a059f..48f085e33 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -82,6 +82,8 @@ #include #include +#include + DolphinMainWindow::DolphinMainWindow(int id) : KXmlGuiWindow(0), m_newMenu(0), @@ -108,6 +110,10 @@ DolphinMainWindow::DolphinMainWindow(int id) : this, SLOT(slotUndoAvailable(bool))); connect(undoManager, SIGNAL(undoTextChanged(const QString&)), this, SLOT(slotUndoTextChanged(const QString&))); + connect(undoManager, SIGNAL(jobRecordingStarted(CommandType)), + this, SLOT(clearStatusBar())); + connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)), + this, SLOT(showCommand(CommandType))); connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(const QString&)), this, SLOT(slotHandlePlacesError(const QString&))); } @@ -132,10 +138,39 @@ void DolphinMainWindow::toggleViews() m_viewTab[m_tabIndex].secondaryView = container; } -void DolphinMainWindow::slotDoingOperation(KIO::FileUndoManager::CommandType commandType) +void DolphinMainWindow::showCommand(CommandType command) { - clearStatusBar(); - m_undoCommandTypes.append(commandType); + DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); + switch (command) { + case KIO::FileUndoManager::Copy: + statusBar->setMessage(i18nc("@info:status", "Copy operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KIO::FileUndoManager::Move: + statusBar->setMessage(i18nc("@info:status", "Move operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KIO::FileUndoManager::Link: + statusBar->setMessage(i18nc("@info:status", "Link operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KIO::FileUndoManager::Trash: + statusBar->setMessage(i18nc("@info:status", "Move to trash operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KIO::FileUndoManager::Rename: + statusBar->setMessage(i18nc("@info:status", "Renaming operation completed."), + DolphinStatusBar::OperationCompleted); + break; + + case KIO::FileUndoManager::Mkdir: + statusBar->setMessage(i18nc("@info:status", "Created folder."), + DolphinStatusBar::OperationCompleted); + break; + + default: + break; + } } void DolphinMainWindow::refreshViews() @@ -155,15 +190,6 @@ void DolphinMainWindow::refreshViews() setActiveViewContainer(activeViewContainer); } -void DolphinMainWindow::dropUrls(const KUrl::List& urls, - const KUrl& destination) -{ - DolphinDropController dropController(this); - connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), - this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType))); - dropController.dropUrls(urls, destination); -} - void DolphinMainWindow::pasteIntoFolder() { m_activeViewContainer->view()->pasteIntoFolder(); @@ -278,7 +304,7 @@ void DolphinMainWindow::openNewTab(const KUrl& url) viewTab.primaryView->view()->reload(); m_viewTab.append(viewTab); - + actionCollection()->action("close_tab")->setEnabled(true); } @@ -377,42 +403,6 @@ void DolphinMainWindow::slotUndoAvailable(bool available) if (undoAction != 0) { undoAction->setEnabled(available); } - - if (available && (m_undoCommandTypes.count() > 0)) { - const KIO::FileUndoManager::CommandType command = m_undoCommandTypes.takeFirst(); - DolphinStatusBar* statusBar = m_activeViewContainer->statusBar(); - switch (command) { - case KIO::FileUndoManager::Copy: - statusBar->setMessage(i18nc("@info:status", "Copy operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KIO::FileUndoManager::Move: - statusBar->setMessage(i18nc("@info:status", "Move operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KIO::FileUndoManager::Link: - statusBar->setMessage(i18nc("@info:status", "Link operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KIO::FileUndoManager::Trash: - statusBar->setMessage(i18nc("@info:status", "Move to trash operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KIO::FileUndoManager::Rename: - statusBar->setMessage(i18nc("@info:status", "Renaming operation completed."), - DolphinStatusBar::OperationCompleted); - break; - - case KIO::FileUndoManager::Mkdir: - statusBar->setMessage(i18nc("@info:status", "Created folder."), - DolphinStatusBar::OperationCompleted); - break; - - default: - break; - } - - } } void DolphinMainWindow::slotUndoTextChanged(const QString& text) @@ -834,15 +824,12 @@ void DolphinMainWindow::init() m_centralWidgetLayout->addWidget(m_tabBar); m_centralWidgetLayout->addWidget(m_viewTab[m_tabIndex].splitter); - setCentralWidget(centralWidget); setupDockWidgets(); setupGUI(Keys | Save | Create | ToolBar); - createGUI(); stateChanged("new_file"); - setAutoSaveSettings(); QClipboard* clipboard = QApplication::clipboard(); connect(clipboard, SIGNAL(dataChanged()), @@ -863,6 +850,7 @@ void DolphinMainWindow::init() resize(750, 500); } + m_showMenuBar->setChecked(!menuBar()->isHidden()); // workaround for bug #171080 emit urlChanged(homeUrl); } @@ -1010,7 +998,7 @@ void DolphinMainWindow::setupActions() KAction* quickView = actionCollection()->addAction("quick_view"); quickView->setText(i18nc("@action:inmenu Tools", "Quick View")); quickView->setIcon(KIcon("view-preview")); - quickView->setShortcut(Qt::Key_Space); + quickView->setShortcut(Qt::CTRL + Qt::Key_Return); quickView->setEnabled(false); connect(quickView, SIGNAL(triggered()), this, SLOT(quickView())); @@ -1058,8 +1046,6 @@ void DolphinMainWindow::setupDockWidgets() this, SLOT(handlePlacesClick(KUrl, Qt::MouseButtons))); connect(treeWidget, SIGNAL(changeSelection(KFileItemList)), this, SLOT(changeSelection(KFileItemList))); - connect(treeWidget, SIGNAL(urlsDropped(KUrl::List, KUrl)), - this, SLOT(dropUrls(KUrl::List, KUrl))); // setup "Terminal" #ifndef Q_OS_WIN @@ -1173,8 +1159,6 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) this, SLOT(slotRequestItemInfo(KFileItem))); connect(view, SIGNAL(activated()), this, SLOT(toggleActiveView())); - connect(view, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), - this, SLOT(slotDoingOperation(KIO::FileUndoManager::CommandType))); connect(view, SIGNAL(tabRequested(const KUrl&)), this, SLOT(openNewTab(const KUrl&)));