diff options
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/places/placesitem.cpp | 18 | ||||
| -rw-r--r-- | src/panels/places/placesitem.h | 2 | ||||
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 38 | ||||
| -rw-r--r-- | src/panels/places/placespanel.cpp | 2 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 27 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.h | 3 |
6 files changed, 52 insertions, 38 deletions
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 539b9263d..173da29c5 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -144,20 +144,20 @@ void PlacesItem::setBookmark(const KBookmark& bookmark) const GroupType type = groupType(); if (icon().isEmpty()) { switch (type) { - case RecentlyAccessedType: setIcon("chronometer"); break; - case SearchForType: setIcon("nepomuk"); break; + case RecentlySavedType: setIcon("chronometer"); break; + case SearchForType: setIcon("nepomuk"); break; case PlacesType: - default: setIcon("folder"); + default: setIcon("folder"); } } switch (type) { - case PlacesType: setGroup(i18nc("@item", "Places")); break; - case RecentlyAccessedType: setGroup(i18nc("@item", "Recently Accessed")); break; - case SearchForType: setGroup(i18nc("@item", "Search For")); break; - case DevicesType: setGroup(i18nc("@item", "Devices")); break; - default: Q_ASSERT(false); break; + case PlacesType: setGroup(i18nc("@item", "Places")); break; + case RecentlySavedType: setGroup(i18nc("@item", "Recently Saved")); break; + case SearchForType: setGroup(i18nc("@item", "Search For")); break; + case DevicesType: setGroup(i18nc("@item", "Devices")); break; + default: Q_ASSERT(false); break; } setHidden(bookmark.metaDataItem("IsHidden") == QLatin1String("true")); @@ -173,7 +173,7 @@ PlacesItem::GroupType PlacesItem::groupType() const if (udi().isEmpty()) { const QString protocol = url().protocol(); if (protocol == QLatin1String("timeline")) { - return RecentlyAccessedType; + return RecentlySavedType; } if (protocol.contains(QLatin1String("search"))) { diff --git a/src/panels/places/placesitem.h b/src/panels/places/placesitem.h index 297f12d91..4c636ec63 100644 --- a/src/panels/places/placesitem.h +++ b/src/panels/places/placesitem.h @@ -44,7 +44,7 @@ public: { PlacesType, SearchForType, - RecentlyAccessedType, + RecentlySavedType, DevicesType }; diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 2ac216958..6accdc837 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -58,7 +58,7 @@ namespace { // As long as KFilePlacesView from kdelibs is available in parallel, the - // system-bookmarks for "Recently Accessed" and "Search For" should be + // system-bookmarks for "Recently Saved" and "Search For" should be // shown only inside the Places Panel. This is necessary as the stored // URLs needs to get translated to a Baloo-search-URL on-the-fly to // be independent from changes in the Baloo-search-URL-syntax. @@ -313,7 +313,8 @@ void PlacesItemModel::requestEject(int index) Solid::OpticalDrive* drive = item->device().parent().as<Solid::OpticalDrive>(); if (drive) { connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant))); + this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)), + Qt::UniqueConnection); drive->eject(); } else { const QString label = item->text(); @@ -330,7 +331,8 @@ void PlacesItemModel::requestTeardown(int index) Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>(); if (access) { connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant))); + this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)), + Qt::UniqueConnection); access->teardown(); } } @@ -359,7 +361,8 @@ void PlacesItemModel::requestStorageSetup(int index) m_storageSetupInProgress[access] = index; connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString))); + this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)), + Qt::UniqueConnection); access->setup(); } @@ -599,6 +602,7 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error, { Q_UNUSED(udi); + Q_ASSERT(!m_storageSetupInProgress.isEmpty()); const int index = m_storageSetupInProgress.take(sender()); const PlacesItem* item = placesItem(index); if (!item) { @@ -738,7 +742,7 @@ void PlacesItemModel::loadBookmarks() // items should always be collected in one group so the items are collected first // in separate lists before inserting them. QList<PlacesItem*> placesItems; - QList<PlacesItem*> recentlyAccessedItems; + QList<PlacesItem*> recentlySavedItems; QList<PlacesItem*> searchForItems; QList<PlacesItem*> devicesItems; @@ -763,11 +767,11 @@ void PlacesItemModel::loadBookmarks() } switch (item->groupType()) { - case PlacesItem::PlacesType: placesItems.append(item); break; - case PlacesItem::RecentlyAccessedType: recentlyAccessedItems.append(item); break; - case PlacesItem::SearchForType: searchForItems.append(item); break; + case PlacesItem::PlacesType: placesItems.append(item); break; + case PlacesItem::RecentlySavedType: recentlySavedItems.append(item); break; + case PlacesItem::SearchForType: searchForItems.append(item); break; case PlacesItem::DevicesType: - default: Q_ASSERT(false); break; + default: Q_ASSERT(false); break; } } } @@ -782,11 +786,11 @@ void PlacesItemModel::loadBookmarks() if (missingSystemBookmarks.contains(data.url)) { PlacesItem* item = createSystemPlacesItem(data); switch (item->groupType()) { - case PlacesItem::PlacesType: placesItems.append(item); break; - case PlacesItem::RecentlyAccessedType: recentlyAccessedItems.append(item); break; - case PlacesItem::SearchForType: searchForItems.append(item); break; + case PlacesItem::PlacesType: placesItems.append(item); break; + case PlacesItem::RecentlySavedType: recentlySavedItems.append(item); break; + case PlacesItem::SearchForType: searchForItems.append(item); break; case PlacesItem::DevicesType: - default: Q_ASSERT(false); break; + default: Q_ASSERT(false); break; } } } @@ -800,7 +804,7 @@ void PlacesItemModel::loadBookmarks() QList<PlacesItem*> items; items.append(placesItems); - items.append(recentlyAccessedItems); + items.append(recentlySavedItems); items.append(searchForItems); items.append(devicesItems); @@ -845,7 +849,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da const QString protocol = data.url.protocol(); if (protocol == QLatin1String("timeline") || protocol == QLatin1String("search")) { // As long as the KFilePlacesView from kdelibs is available, the system-bookmarks - // for "Recently Accessed" and "Search For" should be a setting available only + // for "Recently Saved" and "Search For" should be a setting available only // in the Places Panel (see description of AppNamePrefix for more details). const QString appName = KGlobal::mainComponent().componentName() + AppNamePrefix; bookmark.setMetaDataItem("OnlyInApp", appName); @@ -854,11 +858,11 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da PlacesItem* item = new PlacesItem(bookmark); item->setSystemItem(true); - // Create default view-properties for all "Search For" and "Recently Accessed" bookmarks + // Create default view-properties for all "Search For" and "Recently Saved" bookmarks // in case if the user has not already created custom view-properties for a corresponding // query yet. const bool createDefaultViewProperties = (item->groupType() == PlacesItem::SearchForType || - item->groupType() == PlacesItem::RecentlyAccessedType) && + item->groupType() == PlacesItem::RecentlySavedType) && !GeneralSettings::self()->globalViewProps(); if (createDefaultViewProperties) { ViewProperties props(convertedUrl(data.url)); diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index f19fa1e25..720e07ce3 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -335,7 +335,7 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even const PlacesItem* destItem = m_model->placesItem(index); const PlacesItem::GroupType group = destItem->groupType(); - if (group == PlacesItem::SearchForType || group == PlacesItem::RecentlyAccessedType) { + if (group == PlacesItem::SearchForType || group == PlacesItem::RecentlySavedType) { return; } diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 1e5a33617..f827503a2 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -42,7 +42,8 @@ TerminalPanel::TerminalPanel(QWidget* parent) : m_terminal(0), m_terminalWidget(0), m_konsolePart(0), - m_konsolePartCurrentDirectory() + m_konsolePartCurrentDirectory(), + m_sendCdToTerminalHistory() { m_layout = new QVBoxLayout(this); m_layout->setMargin(0); @@ -161,7 +162,12 @@ void TerminalPanel::sendCdToTerminal(const QString& dir) } m_terminal->sendInput(" cd " + KShell::quoteArg(dir) + '\n'); - m_konsolePartCurrentDirectory = dir; + + // We want to ignore the currentDirectoryChanged(QString) signal, which we will receive after + // the directory change, because this directory change is not caused by a "cd" command that the + // user entered in the panel. Therefore, we have to remember 'dir'. Note that it could also be + // a symbolic link -> remember the 'canonical' path. + m_sendCdToTerminalHistory.enqueue(QDir(dir).canonicalPath()); if (m_clearTerminal) { m_terminal->sendInput(" clear\n"); @@ -182,16 +188,17 @@ void TerminalPanel::slotMostLocalUrlResult(KJob* job) void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString& dir) { - m_konsolePartCurrentDirectory = dir; + m_konsolePartCurrentDirectory = QDir(dir).canonicalPath(); - // Only change the view URL if 'dir' is different from the current view URL. - // Note that the current view URL could also be a symbolic link to 'dir' - // -> use QDir::canonicalPath() to check that. - const KUrl oldUrl(url()); - const KUrl newUrl(dir); - if (newUrl != oldUrl && dir != QDir(oldUrl.path()).canonicalPath()) { - emit changeUrl(newUrl); + // Only emit a changeUrl signal if the directory change was caused by the user inside the + // terminal, and not by sendCdToTerminal(QString). + while (!m_sendCdToTerminalHistory.empty()) { + if (m_konsolePartCurrentDirectory == m_sendCdToTerminalHistory.dequeue()) { + return; + } } + + emit changeUrl(dir); } #include "terminalpanel.moc" diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 374476e1c..b65239baf 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -22,6 +22,8 @@ #include <panels/panel.h> +#include <QQueue> + class TerminalInterfaceV2; class QVBoxLayout; class QWidget; @@ -82,6 +84,7 @@ private: QWidget* m_terminalWidget; KParts::ReadOnlyPart* m_konsolePart; QString m_konsolePartCurrentDirectory; + QQueue<QString> m_sendCdToTerminalHistory; }; #endif // TERMINALPANEL_H |
