X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/403f8e713326f8b6d4934325e4c9013e2d58bbf2..00b00d2371e0f65da0c6bf30775ae43f536ab807:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 43eae8a67..1c0d611b9 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -21,25 +21,22 @@ #include "dolphinremoveaction.h" #include -#include #include #include -#include +#include "dolphindebug.h" #include #include #include #include #include -#include #include #include #include -#include -#include #include #include #include +#include #include "dolphinpart_ext.h" #include "dolphinnewfilemenu.h" @@ -56,10 +53,10 @@ #include #include #include - +#include +#include K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin();) -K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin")) DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args) : KParts::ReadOnlyPart(parent) @@ -73,7 +70,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL // make sure that other apps using this part find Dolphin's view-file-columns icons KIconLoader::global()->addAppDir("dolphin"); - m_view = new DolphinView(KUrl(), parentWidget); + m_view = new DolphinView(QUrl(), parentWidget); m_view->setTabsForFilesEnabled(true); setWidget(m_view); @@ -140,7 +137,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems); connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted); } else { - kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; + qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; } createActions(); @@ -203,16 +200,16 @@ void DolphinPart::createActions() this, &DolphinPart::slotGoTriggered); createGoAction("go_applications", "start-here-kde", - i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"), + i18nc("@action:inmenu Go", "App&lications"), QStringLiteral("programs:/"), goActionGroup); createGoAction("go_network_folders", "folder-remote", - i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"), + i18nc("@action:inmenu Go", "&Network Folders"), QStringLiteral("remote:/"), goActionGroup); createGoAction("go_settings", "preferences-system", - i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"), + i18nc("@action:inmenu Go", "Sett&ings"), QStringLiteral("settings:/"), goActionGroup); createGoAction("go_trash", "user-trash", - i18nc("@action:inmenu Go", "Trash"), QString("trash:/"), + i18nc("@action:inmenu Go", "Trash"), QStringLiteral("trash:/"), goActionGroup); createGoAction("go_autostart", "", i18nc("@action:inmenu Go", "Autostart"), QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/autostart", @@ -248,7 +245,7 @@ void DolphinPart::createGoAction(const char* name, const char* iconName, void DolphinPart::slotGoTriggered(QAction* action) { const QString url = action->data().toString(); - emit m_extension->openUrlRequest(KUrl(url)); + emit m_extension->openUrlRequest(QUrl(url)); } void DolphinPart::slotSelectionChanged(const KFileItemList& selection) @@ -311,11 +308,11 @@ bool DolphinPart::openUrl(const QUrl &url) return true; } setUrl(url); // remember it at the KParts level - KUrl visibleUrl(url); + QUrl visibleUrl(url); if (!m_nameFilter.isEmpty()) { - visibleUrl.addPath(m_nameFilter); + visibleUrl.setPath(visibleUrl.path() + '/' + m_nameFilter); } - QString prettyUrl = visibleUrl.pathOrUrl(); + QString prettyUrl = visibleUrl.toDisplayString(QUrl::PreferLocalFile); emit setWindowCaption(prettyUrl); emit m_extension->setLocationBarUrl(prettyUrl); emit started(0); // get the wheel to spin @@ -342,7 +339,7 @@ void DolphinPart::slotMessage(const QString& msg) void DolphinPart::slotErrorMessage(const QString& msg) { - kDebug() << msg; + qCDebug(DolphinDebug) << msg; emit canceled(msg); //KMessageBox::error(m_view, msg); } @@ -403,7 +400,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, popupFlags |= KParts::BrowserExtension::ShowNavigationItems | KParts::BrowserExtension::ShowUp; item = m_view->rootItem(); if (item.isNull()) - item = KFileItem( S_IFDIR, (mode_t)-1, url() ); + item = KFileItem(url()); else item.setUrl(url()); // ensure we use the view url, not the canonical path (#213799) } @@ -473,7 +470,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl) { - //kDebug() << oldUrl << newUrl << "currentUrl=" << url(); + qCDebug(DolphinDebug) << oldUrl << newUrl << "currentUrl=" << url(); if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) { KParts::ReadOnlyPart::setUrl(newUrl); const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile); @@ -507,7 +504,7 @@ void DolphinPart::slotUnselectItemsMatchingPattern() void DolphinPart::openSelectionDialog(const QString& title, const QString& text, bool selectItems) { bool okClicked; - QString pattern = KInputDialog::getText(title, text, "*", &okClicked, m_view); + const QString pattern = QInputDialog::getText(m_view, title, text, QLineEdit::Normal, "*", &okClicked); if (okClicked && !pattern.isEmpty()) { QRegExp patternRegExp(pattern, Qt::CaseSensitive, QRegExp::Wildcard); @@ -539,11 +536,14 @@ void DolphinPart::slotOpenTerminal() { QString dir(QDir::homePath()); - KUrl u(url()); + QUrl u(url()); // If the given directory is not local, it can still be the URL of an // ioslave using UDS_LOCAL_PATH which to be converted first. - u = KIO::NetAccess::mostLocalUrl(u, widget()); + KIO::StatJob* statJob = KIO::mostLocalUrl(u); + KJobWidgets::setWindow(statJob, widget()); + statJob->exec(); + u = statJob->mostLocalUrl(); //If the URL is local after the above conversion, set the directory. if (u.isLocalFile()) { @@ -555,7 +555,7 @@ void DolphinPart::slotOpenTerminal() void DolphinPart::slotFindFile() { - KRun::run("kfind", QList() << url(), widget()); + KRun::run("kfind", {url()}, widget()); } void DolphinPart::updateNewMenu()