X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/e8db076135bb04b81cfc227f1e65067c21248200..abb6807645598e8117e98bbf232cd9cd90fe019a:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index c5d85a3cc..60aa056a7 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -18,18 +18,20 @@ */ #include "dolphinpart.h" -#include #include "dolphinviewactionhandler.h" #include "dolphinsortfilterproxymodel.h" #include "dolphinview.h" #include "dolphinmodel.h" +#include "dolphinnewmenuobserver.h" +#include "dolphinremoteencoding.h" -#include +#include #include #include #include #include +#include #include #include #include @@ -43,6 +45,8 @@ #include #include +#include "settings/dolphinsettings.h" + #include #include #include @@ -67,7 +71,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL } m_dirLister->setDelayedMimeTypes(true); - //connect(m_dirLister, SIGNAL(started(KUrl)), this, SLOT(slotStarted())); connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted(KUrl))); connect(m_dirLister, SIGNAL(canceled(KUrl)), this, SLOT(slotCanceled(KUrl))); connect(m_dirLister, SIGNAL(percent(int)), this, SLOT(updateProgress(int))); @@ -78,18 +81,16 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL m_proxyModel = new DolphinSortFilterProxyModel(this); m_proxyModel->setSourceModel(m_dolphinModel); - m_view = new DolphinView(parentWidget, - KUrl(), - m_dirLister, - m_dolphinModel, - m_proxyModel); + m_view = new DolphinView(parentWidget, KUrl(), m_proxyModel); m_view->setTabsForFilesEnabled(true); setWidget(m_view); setXMLFile("dolphinpart.rc"); connect(m_view, SIGNAL(infoMessage(QString)), - this, SLOT(slotInfoMessage(QString))); + this, SLOT(slotMessage(QString))); + connect(m_view, SIGNAL(operationCompletedMessage(QString)), + this, SLOT(slotMessage(QString))); connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString))); connect(m_view, SIGNAL(itemTriggered(KFileItem)), @@ -113,7 +114,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL // Watch for changes that should result in updates to the // status bar text. - connect(m_dirLister, SIGNAL(deleteItem(const KFileItem&)), + connect(m_dirLister, SIGNAL(itemsDeleted(const KFileItemList&)), this, SLOT(updateStatusBar())); connect(m_dirLister, SIGNAL(clear()), this, SLOT(updateStatusBar())); @@ -122,6 +123,11 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL m_actionHandler = new DolphinViewActionHandler(actionCollection(), this); m_actionHandler->setCurrentView(m_view); + connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory())); + + m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler); + connect(this, SIGNAL(aboutToOpenURL()), + m_remoteEncoding, SLOT(slotAboutToOpenUrl())); QClipboard* clipboard = QApplication::clipboard(); connect(clipboard, SIGNAL(dataChanged()), @@ -135,10 +141,13 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL // (sort of spacial navigation) loadPlugins(this, this, componentData()); + } DolphinPart::~DolphinPart() { + DolphinSettings::instance().save(); + DolphinNewMenuObserver::instance().detach(m_newMenu); delete m_dirLister; } @@ -147,6 +156,7 @@ void DolphinPart::createActions() // Edit menu m_newMenu = new KNewMenu(actionCollection(), widget(), "new_menu"); + DolphinNewMenuObserver::instance().attach(m_newMenu); connect(m_newMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(updateNewMenu())); @@ -229,7 +239,7 @@ void DolphinPart::slotSelectionChanged(const KFileItemList& selection) // TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code) // in libkonq - KonqFileItemCapabilities capabilities(selection); + KFileItemListProperties capabilities(selection); const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving(); renameAction->setEnabled(capabilities.supportsMoving()); @@ -294,7 +304,7 @@ void DolphinPart::slotCanceled(const KUrl& url) slotCompleted(url); } -void DolphinPart::slotInfoMessage(const QString& msg) +void DolphinPart::slotMessage(const QString& msg) { emit setStatusBarText(msg); } @@ -330,10 +340,7 @@ void DolphinPart::createNewWindow(const KUrl& url) { // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code // should be moved into DolphinPart::slotItemTriggered() - KFileItem item(S_IFDIR, (mode_t)-1, url); - KParts::OpenUrlArguments args; - args.setMimeType(item.mimetype()); - emit m_extension->createNewWindow(url, args); + emit m_extension->createNewWindow(url); } void DolphinPart::slotOpenContextMenu(const KFileItem& _item, @@ -427,7 +434,7 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, void DolphinPart::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl) { //kDebug() << oldUrl << newUrl << "currentUrl=" << url(); - if (oldUrl == url()) { + if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) { KParts::ReadOnlyPart::setUrl(newUrl); const QString prettyUrl = newUrl.pathOrUrl(); emit m_extension->setLocationBarUrl(prettyUrl); @@ -508,7 +515,7 @@ void DolphinPart::slotOpenTerminal() //If the URL is local after the above conversion, set the directory. if (u.isLocalFile()) { - dir = u.path(); + dir = u.toLocalFile(); } KToolInvocation::invokeTerminal(QString(), dir); @@ -532,4 +539,10 @@ void DolphinPart::updateProgress(int percent) m_extension->loadingProgress(percent); } +void DolphinPart::createDirectory() +{ + m_newMenu->setPopupFiles(url()); + m_newMenu->createDirectory(); +} + #include "dolphinpart.moc"