<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
- <id>dolphin.desktop</id>
+ <id>org.kde.dolphin.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
<name>Dolphin</name>
<name xml:lang="nb">Dolphin</name>
<name xml:lang="nds">Dolphin</name>
<name xml:lang="nl">Dolphin</name>
+ <name xml:lang="pa">ਡਾਲਫਿਨ</name>
<name xml:lang="pl">Dolphin</name>
<name xml:lang="pt">Dolphin</name>
<name xml:lang="pt-BR">Dolphin</name>
<summary xml:lang="nb">Filbehandler</summary>
<summary xml:lang="nds">Dateipleger</summary>
<summary xml:lang="nl">Bestandsbeheerder</summary>
+ <summary xml:lang="pa">ਫਾਇਲ ਮੈਨੇਜਰ</summary>
<summary xml:lang="pl">Zarządzanie plikami</summary>
<summary xml:lang="pt">Gestor de Ficheiros</summary>
<summary xml:lang="pt-BR">Gerenciador de arquivos</summary>
<p xml:lang="nb">Egenskaper:</p>
<p xml:lang="nds">Markmalen:</p>
<p xml:lang="nl">Mogelijkheden:</p>
+ <p xml:lang="pa">ਲੱਛਣ:</p>
<p xml:lang="pl">Możliwości:</p>
<p xml:lang="pt">Características:</p>
<p xml:lang="pt-BR">Funcionalidades:</p>
<li xml:lang="nb">Støtte for flere faner</li>
<li xml:lang="nds">Ünnerstütten för Paneels</li>
<li xml:lang="nl">Ondersteuning voor meerdere tabbladen</li>
+ <li xml:lang="pa">ਬਹੁ ਟੈਬ ਸਹਿਯੋਗ</li>
<li xml:lang="pl">Obsługa wielu kart</li>
<li xml:lang="pt">Suporte para várias páginas</li>
<li xml:lang="pt-BR">Suporte a várias abas</li>
<li xml:lang="nb">Støtte for angring/omgjøring</li>
<li xml:lang="nds">Ünnerstütten för Torüchnehmen un Wedderherstellen</li>
<li xml:lang="nl">Ondersteuning ongedaan maken/opnieuw</li>
+ <li xml:lang="pa">ਵਾਪਿਸ ਕਰੋ/ਪਰਤਾਉਣ ਸਹਿਯੋਗ</li>
<li xml:lang="pl">Obsługa cofnij/ponów</li>
<li xml:lang="pt">Suporte para desfazer/refazer</li>
<li xml:lang="pt-BR">Suporte para desfazer/refazer</li>
#include <KBookmark>
#include <KBookmarkGroup>
#include <KBookmarkManager>
-#include <KComponentData>
#include <KDebug>
-#include <KIcon>
+#include <QIcon>
#include <kprotocolinfo.h>
-#include <KLocale>
-#include <KStandardDirs>
+#include <KLocalizedString>
+#include <KComponentData>
+#include <QStandardPaths>
#include <KUser>
+#include <KAboutData>
#include "placesitem.h"
#include <QAction>
#include <QDate>
#include <QMimeData>
#include <QTimer>
+#include <KUrlMimeData>
#include <Solid/Device>
#include <Solid/DeviceNotifier>
#include <views/viewproperties.h>
#ifdef HAVE_BALOO
- #include <baloo/query.h>
- #include <baloo/indexerconfig.h>
+ #include <Baloo/Query>
+ #include <Baloo/IndexerConfig>
#endif
namespace {
// be independent from changes in the Baloo-search-URL-syntax.
// Hence a prefix to the application-name of the stored bookmarks is
// added, which is only read by PlacesItemModel.
- const char* AppNamePrefix = "-places-panel";
+ const char AppNamePrefix[] = "-places-panel";
}
PlacesItemModel::PlacesItemModel(QObject* parent) :
m_systemBookmarksIndexes(),
m_bookmarkedItems(),
m_hiddenItemToRemove(-1),
- m_saveBookmarksTimer(0),
m_updateBookmarksTimer(0),
m_storageSetupInProgress()
{
Baloo::IndexerConfig config;
m_fileIndexingEnabled = config.fileIndexingEnabled();
#endif
- const QString file = KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml");
+ const QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kfileplaces/bookmarks.xml");
m_bookmarkManager = KBookmarkManager::managerForFile(file, "kfilePlaces");
createSystemBookmarks();
const int syncBookmarksTimeout = 100;
- m_saveBookmarksTimer = new QTimer(this);
- m_saveBookmarksTimer->setInterval(syncBookmarksTimeout);
- m_saveBookmarksTimer->setSingleShot(true);
- connect(m_saveBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::saveBookmarks);
-
m_updateBookmarksTimer = new QTimer(this);
m_updateBookmarksTimer->setInterval(syncBookmarksTimeout);
m_updateBookmarksTimer->setSingleShot(true);
- connect(m_updateBookmarksTimer, SIGNAL(timeout()), this, SLOT(updateBookmarks()));
+ connect(m_updateBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::updateBookmarks);
- connect(m_bookmarkManager, SIGNAL(changed(QString,QString)),
- m_updateBookmarksTimer, SLOT(start()));
- connect(m_bookmarkManager, SIGNAL(bookmarksChanged(QString)),
- m_updateBookmarksTimer, SLOT(start()));
+ connect(m_bookmarkManager, &KBookmarkManager::changed,
+ m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
+ connect(m_bookmarkManager, &KBookmarkManager::bookmarksChanged,
+ m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
}
PlacesItemModel::~PlacesItemModel()
}
PlacesItem* PlacesItemModel::createPlacesItem(const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName)
{
const KBookmark bookmark = PlacesItem::createBookmark(m_bookmarkManager, text, url, iconName);
return m_hiddenItemsShown;
}
-int PlacesItemModel::closestItem(const KUrl& url) const
+int PlacesItemModel::closestItem(const QUrl& url) const
{
int foundIndex = -1;
int maxLength = 0;
for (int i = 0; i < count(); ++i) {
- const KUrl itemUrl = placesItem(i)->url();
- if (itemUrl.isParentOf(url)) {
- const int length = itemUrl.prettyUrl().length();
+ const QUrl itemUrl = placesItem(i)->url();
+ if (url == itemUrl) {
+ // We can't find a closer one, so stop here.
+ foundIndex = i;
+ break;
+ } else if (itemUrl.isParentOf(url)) {
+ const int length = itemUrl.path().length();
if (length > maxLength) {
foundIndex = i;
maxLength = length;
{
const PlacesItem* item = placesItem(index);
if (item && item->device().is<Solid::OpticalDisc>()) {
- return new QAction(KIcon("media-eject"), i18nc("@item", "Eject '%1'", item->text()), 0);
+ return new QAction(QIcon::fromTheme("media-eject"), i18nc("@item", "Eject '%1'", item->text()), 0);
}
return 0;
return new QAction(text, 0);
}
- return new QAction(KIcon(iconName), text, 0);
+ return new QAction(QIcon::fromTheme(iconName), text, 0);
}
void PlacesItemModel::requestEject(int index)
if (item) {
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)),
- Qt::UniqueConnection);
+ connect(drive, &Solid::OpticalDrive::ejectDone,
+ this, &PlacesItemModel::slotStorageTeardownDone);
drive->eject();
} else {
const QString label = item->text();
if (item) {
Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>();
if (access) {
- connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)),
- Qt::UniqueConnection);
+ connect(access, &Solid::StorageAccess::teardownDone,
+ this, &PlacesItemModel::slotStorageTeardownDone);
access->teardown();
}
}
m_storageSetupInProgress[access] = index;
- connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)),
- Qt::UniqueConnection);
+ connect(access, &Solid::StorageAccess::setupDone,
+ this, &PlacesItemModel::slotStorageSetupDone);
access->setup();
}
QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const
{
- KUrl::List urls;
+ QList<QUrl> urls;
QByteArray itemData;
QDataStream stream(&itemData, QIODevice::WriteOnly);
foreach (int index, indexes) {
- const KUrl itemUrl = placesItem(index)->url();
+ const QUrl itemUrl = placesItem(index)->url();
if (itemUrl.isValid()) {
urls << itemUrl;
}
QMimeData* mimeData = new QMimeData();
if (!urls.isEmpty()) {
- urls.populateMimeData(mimeData);
+ mimeData->setUrls(urls);
}
mimeData->setData(internalMimeType(), itemData);
insertItem(dropIndex, newItem);
} else if (mimeData->hasFormat("text/uri-list")) {
// One or more items must be added to the model
- const KUrl::List urls = KUrl::List::fromMimeData(mimeData);
+ const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData);
for (int i = urls.count() - 1; i >= 0; --i) {
- const KUrl& url = urls[i];
+ const QUrl& url = urls[i];
QString text = url.fileName();
if (text.isEmpty()) {
}
if ((url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir())
- || url.protocol() == "trash") {
+ || url.scheme() == "trash") {
// Only directories outside the trash are allowed
continue;
}
}
}
-KUrl PlacesItemModel::convertedUrl(const KUrl& url)
+QUrl PlacesItemModel::convertedUrl(const QUrl& url)
{
- KUrl newUrl = url;
- if (url.protocol() == QLatin1String("timeline")) {
+ QUrl newUrl = url;
+ if (url.scheme() == QLatin1String("timeline")) {
newUrl = createTimelineUrl(url);
- } else if (url.protocol() == QLatin1String("search")) {
+ } else if (url.scheme() == QLatin1String("search")) {
newUrl = createSearchUrl(url);
}
m_bookmarkedItems.insert(bookmarkIndex, 0);
}
- triggerBookmarksSaving();
-
#ifdef PLACESITEMMODEL_DEBUG
kDebug() << "Inserted item" << index;
showModelState();
Q_ASSERT(!m_bookmarkedItems[boomarkIndex]);
m_bookmarkedItems.removeAt(boomarkIndex);
- triggerBookmarksSaving();
-
#ifdef PLACESITEMMODEL_DEBUG
kDebug() << "Removed item" << index;
showModelState();
QTimer::singleShot(0, this, SLOT(hideItem()));
}
}
-
- triggerBookmarksSaving();
}
void PlacesItemModel::slotDeviceAdded(const QString& udi)
{
Q_UNUSED(udi);
- Q_ASSERT(!m_storageSetupInProgress.isEmpty());
const int index = m_storageSetupInProgress.take(sender());
const PlacesItem* item = placesItem(index);
if (!item) {
return;
}
- if (error) {
+ if (error != Solid::NoError) {
if (errorData.isValid()) {
emit errorMessage(i18nc("@info", "An error occurred while accessing '%1', the system responded: %2",
item->text(),
found = true;
if (newBookmark.metaDataItem("UDI").isEmpty()) {
item->setBookmark(newBookmark);
- item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().data()));
+ item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().constData()));
}
break;
}
KBookmark bookmark = root.first();
QSet<QString> devices = m_availableDevices;
- QSet<KUrl> missingSystemBookmarks;
+ QSet<QUrl> missingSystemBookmarks;
foreach (const SystemBookmarkData& data, m_systemBookmarks) {
missingSystemBookmarks.insert(data.url);
}
devices.remove(item->udi());
devicesItems.append(item);
} else {
- const KUrl url = bookmark.url();
+ const QUrl url = bookmark.url();
if (missingSystemBookmarks.contains(url)) {
missingSystemBookmarks.remove(url);
// text, the retranslation will fail and the users custom text is still used.
// It is important to use "KFile System Bookmarks" as context (see
// createSystemBookmarks()).
- item->setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data()));
+ item->setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().constData()));
item->setSystemItem(true);
}
const QSet<QString>& availableDevices) const
{
const QString udi = bookmark.metaDataItem("UDI");
- const KUrl url = bookmark.url();
+ const QUrl url = bookmark.url();
const QString appName = bookmark.metaDataItem("OnlyInApp");
const bool deviceAvailable = availableDevices.contains(udi);
const bool allowedHere = (appName.isEmpty()
- || appName == KGlobal::mainComponent().componentName()
- || appName == KGlobal::mainComponent().componentName() + AppNamePrefix)
- && (m_fileIndexingEnabled || (url.protocol() != QLatin1String("timeline") &&
- url.protocol() != QLatin1String("search")));
+ || appName == KAboutData::applicationData().componentName()
+ || appName == KAboutData::applicationData().componentName() + AppNamePrefix)
+ && (m_fileIndexingEnabled || (url.scheme() != QLatin1String("timeline") &&
+ url.scheme() != QLatin1String("search")));
return (udi.isEmpty() && allowedHere) || deviceAvailable;
}
data.url,
data.icon);
- const QString protocol = data.url.protocol();
+ const QString protocol = data.url.scheme();
if (protocol == QLatin1String("timeline") || protocol == QLatin1String("search")) {
// As long as the KFilePlacesView from kdelibs is available, the system-bookmarks
// 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;
+ const QString appName = KAboutData::applicationData().componentName() + AppNamePrefix;
bookmark.setMetaDataItem("OnlyInApp", appName);
}
if (path == QLatin1String("/documents")) {
props.setViewMode(DolphinView::DetailsView);
props.setPreviewsShown(false);
- props.setVisibleRoles(QList<QByteArray>() << "text" << "path");
+ props.setVisibleRoles({"text", "path"});
} else if (path == QLatin1String("/images")) {
props.setViewMode(DolphinView::IconsView);
props.setPreviewsShown(true);
- props.setVisibleRoles(QList<QByteArray>() << "text" << "imageSize");
+ props.setVisibleRoles({"text", "imageSize"});
} else if (path == QLatin1String("/audio")) {
props.setViewMode(DolphinView::DetailsView);
props.setPreviewsShown(false);
- props.setVisibleRoles(QList<QByteArray>() << "text" << "artist" << "album");
+ props.setVisibleRoles({"text", "artist", "album"});
} else if (path == QLatin1String("/videos")) {
props.setViewMode(DolphinView::IconsView);
props.setPreviewsShown(true);
- props.setVisibleRoles(QList<QByteArray>() << "text");
- } else if (data.url.protocol() == "timeline") {
+ props.setVisibleRoles({"text"});
+ } else if (data.url.scheme() == "timeline") {
props.setViewMode(DolphinView::DetailsView);
- props.setVisibleRoles(QList<QByteArray>() << "text" << "date");
+ props.setVisibleRoles({"text", "date"});
}
}
}
// i18nc call is done after reading the bookmark. The reason why the i18nc call is not
// done here is because otherwise switching the language would not result in retranslating the
// bookmarks.
- m_systemBookmarks.append(SystemBookmarkData(KUrl(KUser().homeDir()),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile(KUser().homeDir()),
"user-home",
I18N_NOOP2("KFile System Bookmarks", "Home")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("remote:/"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("remote:/"),
"network-workgroup",
I18N_NOOP2("KFile System Bookmarks", "Network")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("/"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile("/"),
"folder-red",
I18N_NOOP2("KFile System Bookmarks", "Root")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("trash:/"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("trash:/"),
"user-trash",
I18N_NOOP2("KFile System Bookmarks", "Trash")));
if (m_fileIndexingEnabled) {
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/today"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/today"),
"go-jump-today",
I18N_NOOP2("KFile System Bookmarks", "Today")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/yesterday"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/yesterday"),
"view-calendar-day",
I18N_NOOP2("KFile System Bookmarks", "Yesterday")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/thismonth"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/thismonth"),
"view-calendar-month",
I18N_NOOP2("KFile System Bookmarks", "This Month")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/lastmonth"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/lastmonth"),
"view-calendar-month",
I18N_NOOP2("KFile System Bookmarks", "Last Month")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/documents"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/documents"),
"folder-txt",
I18N_NOOP2("KFile System Bookmarks", "Documents")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/images"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/images"),
"folder-image",
I18N_NOOP2("KFile System Bookmarks", "Images")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/audio"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/audio"),
"folder-sound",
I18N_NOOP2("KFile System Bookmarks", "Audio Files")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/videos"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/videos"),
"folder-video",
I18N_NOOP2("KFile System Bookmarks", "Videos")));
}
Q_ASSERT(m_predicate.isValid());
Solid::DeviceNotifier* notifier = Solid::DeviceNotifier::instance();
- connect(notifier, SIGNAL(deviceAdded(QString)), this, SLOT(slotDeviceAdded(QString)));
- connect(notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(slotDeviceRemoved(QString)));
+ connect(notifier, &Solid::DeviceNotifier::deviceAdded, this, &PlacesItemModel::slotDeviceAdded);
+ connect(notifier, &Solid::DeviceNotifier::deviceRemoved, this, &PlacesItemModel::slotDeviceRemoved);
const QList<Solid::Device>& deviceList = Solid::Device::listFromQuery(m_predicate);
foreach (const Solid::Device& device, deviceList) {
// bookmark should still be remembered, so readd it again:
m_bookmarkManager->root().addBookmark(hiddenBookmark);
m_bookmarkManager->root().moveBookmark(hiddenBookmark, previousBookmark);
- triggerBookmarksSaving();
}
m_bookmarkedItems.insert(newIndex, hiddenItem);
}
}
- void PlacesItemModel::triggerBookmarksSaving()
- {
- if (m_saveBookmarksTimer) {
- m_saveBookmarksTimer->start();
- }
- }
-
QString PlacesItemModel::internalMimeType() const
{
return "application/x-dolphinplacesmodel-" +
}
}
-KUrl PlacesItemModel::createTimelineUrl(const KUrl& url)
+QUrl PlacesItemModel::createTimelineUrl(const QUrl& url)
{
// TODO: Clarify with the Baloo-team whether it makes sense
// provide default-timeline-URLs like 'yesterday', 'this month'
// and 'last month'.
- KUrl timelineUrl;
+ QUrl timelineUrl;
- const QString path = url.pathOrUrl();
+ const QString path = url.toDisplayString(QUrl::PreferLocalFile);
if (path.endsWith(QLatin1String("yesterday"))) {
const QDate date = QDate::currentDate().addDays(-1);
const int year = date.year();
return date;
}
-KUrl PlacesItemModel::createSearchUrl(const KUrl& url)
+QUrl PlacesItemModel::createSearchUrl(const QUrl& url)
{
- KUrl searchUrl;
+ QUrl searchUrl;
#ifdef HAVE_BALOO
- const QString path = url.pathOrUrl();
+ const QString path = url.toDisplayString(QUrl::PreferLocalFile);
if (path.endsWith(QLatin1String("documents"))) {
searchUrl = searchUrlForType("Document");
} else if (path.endsWith(QLatin1String("images"))) {
}
#ifdef HAVE_BALOO
-KUrl PlacesItemModel::searchUrlForType(const QString& type)
+QUrl PlacesItemModel::searchUrlForType(const QString& type)
{
Baloo::Query query;
query.addType("File");
}
#endif
-#include "placesitemmodel.moc"
#include <kitemviews/kstandarditemmodel.h>
-#include <KUrl>
+#include <QUrl>
#include <QHash>
#include <QList>
#include <QSet>
* attributes.
*/
PlacesItem* createPlacesItem(const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName = QString());
PlacesItem* placesItem(int index) const;
* range of the URL. -1 is returned if no closest item
* could be found.
*/
- int closestItem(const KUrl& url) const;
+ int closestItem(const QUrl& url) const;
/**
* Appends the item \a item as last element of the group
bool storageSetupNeeded(int index) const;
void requestStorageSetup(int index);
- /** @reimp */
- virtual QMimeData* createMimeData(const KItemSet& indexes) const;
+ virtual QMimeData* createMimeData(const KItemSet& indexes) const Q_DECL_OVERRIDE;
- /** @reimp */
- virtual bool supportsDropping(int index) const;
+ virtual bool supportsDropping(int index) const Q_DECL_OVERRIDE;
void dropMimeDataBefore(int index, const QMimeData* mimeData);
* the corresponding IO-slave. Virtual URLs for bookmarks are used to
* be independent from internal format changes.
*/
- static KUrl convertedUrl(const KUrl& url);
+ static QUrl convertedUrl(const QUrl& url);
- virtual void clear();
+ virtual void clear() Q_DECL_OVERRIDE;
+
+ /**
+ * Saves the bookmarks and indicates to other applications that the
+ * state of the bookmarks has been changed. Is only called by the
+ * timeout of m_saveBookmarksTimer to prevent unnecessary savings.
+ */
+ void saveBookmarks();
+
signals:
void errorMessage(const QString& message);
void storageSetupDone(int index, bool success);
protected:
- virtual void onItemInserted(int index);
- virtual void onItemRemoved(int index, KStandardItem* removedItem);
- virtual void onItemChanged(int index, const QSet<QByteArray>& changedRoles);
+ virtual void onItemInserted(int index) Q_DECL_OVERRIDE;
+ virtual void onItemRemoved(int index, KStandardItem* removedItem) Q_DECL_OVERRIDE;
+ virtual void onItemChanged(int index, const QSet<QByteArray>& changedRoles) Q_DECL_OVERRIDE;
private slots:
void slotDeviceAdded(const QString& udi);
*/
void updateBookmarks();
- /**
- * Saves the bookmarks and indicates to other applications that the
- * state of the bookmarks has been changed. Is only called by the
- * timeout of m_saveBookmarksTimer to prevent unnecessary savings.
- */
- void saveBookmarks();
private:
struct SystemBookmarkData;
*/
void hideItem(int index);
- /**
- * Triggers a delayed saving of bookmarks by starting
- * m_saveBookmarksTimer.
- */
- void triggerBookmarksSaving();
-
QString internalMimeType() const;
/**
/**
* @return URL using the timeline-protocol for searching (see convertedUrl()).
*/
- static KUrl createTimelineUrl(const KUrl& url);
+ static QUrl createTimelineUrl(const QUrl& url);
/**
* Helper method for createTimelineUrl().
* for a given term. The URL \a url represents a places-internal
* URL like e.g. "search:/documents" (see convertedUrl()).
*/
- static KUrl createSearchUrl(const KUrl& url);
+ static QUrl createSearchUrl(const QUrl& url);
#ifdef HAVE_BALOO
/**
* @return URL that can be listed by KIO and results in searching
* for the given type
*/
- static KUrl searchUrlForType(const QString& type);
+ static QUrl searchUrlForType(const QString& type);
#endif
#ifdef PLACESITEMMODEL_DEBUG
struct SystemBookmarkData
{
- SystemBookmarkData(const KUrl& url,
+ SystemBookmarkData(const QUrl& url,
const QString& icon,
const QString& text) :
url(url), icon(icon), text(text) {}
- KUrl url;
+ QUrl url;
QString icon;
QString text;
};
QList<SystemBookmarkData> m_systemBookmarks;
- QHash<KUrl, int> m_systemBookmarksIndexes;
+ QHash<QUrl, int> m_systemBookmarksIndexes;
// Contains hidden and unhidden items that are stored as
// bookmark (the model itself only contains items that
// removing an item is not allowed.
int m_hiddenItemToRemove;
- QTimer* m_saveBookmarksTimer;
QTimer* m_updateBookmarksTimer;
QHash<QObject*, int> m_storageSetupInProgress;
#include "dolphin_generalsettings.h"
+#include <KFileItem>
#include <KDebug>
#include <KDirNotify>
-#include <KIcon>
+#include <QIcon>
#include <KIO/Job>
+#include <KIO/DropJob>
+#include <KIO/EmptyTrashJob>
#include <KIO/JobUiDelegate>
-#include <KLocale>
+#include <KJobWidgets>
+#include <KLocalizedString>
+#include <KIconLoader>
#include <kitemviews/kitemlistcontainer.h>
#include <kitemviews/kitemlistcontroller.h>
#include <kitemviews/kitemlistselectionmanager.h>
#include <kitemviews/kstandarditem.h>
-#include <KMenu>
+#include <QMenu>
#include <KMessageBox>
#include <KNotification>
#include "placesitem.h"
#include <QGraphicsSceneDragDropEvent>
#include <QVBoxLayout>
#include <QShowEvent>
+#include <QMimeData>
PlacesPanel::PlacesPanel(QWidget* parent) :
Panel(parent),
bool PlacesPanel::urlChanged()
{
- if (!url().isValid() || url().protocol().contains("search")) {
+ if (!url().isValid() || url().scheme().contains("search")) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
// used at all and stays invisible.
m_model = new PlacesItemModel(this);
m_model->setGroupedSorting(true);
- connect(m_model, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
+ connect(m_model, &PlacesItemModel::errorMessage,
+ this, &PlacesPanel::errorMessage);
m_view = new PlacesView();
m_view->setWidgetCreator(new KItemListWidgetCreator<PlacesItemListWidget>());
m_controller->setSelectionBehavior(KItemListController::SingleSelection);
m_controller->setSingleClickActivationEnforced(true);
- readSettings();
+ readSettings();
- connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
- connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
- connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
- connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
- connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
- connect(m_controller, SIGNAL(aboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotAboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
+ connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
+ connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked);
+ connect(m_controller, &KItemListController::itemContextMenuRequested, this, &PlacesPanel::slotItemContextMenuRequested);
+ connect(m_controller, &KItemListController::viewContextMenuRequested, this, &PlacesPanel::slotViewContextMenuRequested);
+ connect(m_controller, &KItemListController::itemDropEvent, this, &PlacesPanel::slotItemDropEvent);
+ connect(m_controller, &KItemListController::aboveItemDropEvent, this, &PlacesPanel::slotAboveItemDropEvent);
KItemListContainer* container = new KItemListContainer(m_controller, this);
container->setEnabledFrame(false);
return;
}
- KMenu menu(this);
+ QMenu menu(this);
QAction* emptyTrashAction = 0;
QAction* addAction = 0;
mainSeparator = menu.addSeparator();
}
} else {
- if (item->url() == KUrl("trash:/")) {
- emptyTrashAction = menu.addAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"));
+ if (item->url() == QUrl("trash:/")) {
+ emptyTrashAction = menu.addAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"));
emptyTrashAction->setEnabled(item->icon() == "user-trash-full");
menu.addSeparator();
}
- addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry..."));
+ addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry..."));
mainSeparator = menu.addSeparator();
- editAction = menu.addAction(KIcon("document-properties"), i18nc("@item:inmenu", "Edit '%1'...", label));
+ editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit '%1'...", label));
}
if (!addAction) {
- addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry..."));
+ addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry..."));
}
QAction* openInNewTabAction = menu.addAction(i18nc("@item:inmenu", "Open '%1' in New Tab", label));
- openInNewTabAction->setIcon(KIcon("tab-new"));
+ openInNewTabAction->setIcon(QIcon::fromTheme("tab-new"));
QAction* removeAction = 0;
if (!isDevice && !item->isSystemItem()) {
- removeAction = menu.addAction(KIcon("edit-delete"), i18nc("@item:inmenu", "Remove '%1'", label));
+ removeAction = menu.addAction(QIcon::fromTheme("edit-delete"), i18nc("@item:inmenu", "Remove '%1'", label));
}
QAction* hideAction = menu.addAction(i18nc("@item:inmenu", "Hide '%1'", label));
}
menu.addSeparator();
- KMenu* iconSizeSubMenu = new KMenu(i18nc("@item:inmenu", "Icon Size"), &menu);
+ QMenu* iconSizeSubMenu = new QMenu(i18nc("@item:inmenu", "Icon Size"), &menu);
struct IconSizeInfo
{
editEntry(index);
} else if (action == removeAction) {
m_model->removeItem(index);
+ m_model->saveBookmarks();
} else if (action == hideAction) {
item->setHidden(hideAction->isChecked());
+ m_model->saveBookmarks();
} else if (action == openInNewTabAction) {
// TriggerItem does set up the storage first and then it will
// emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
{
- KMenu menu(this);
+ QMenu menu(this);
- QAction* addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry..."));
+ QAction* addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry..."));
QAction* showAllAction = 0;
if (m_model->hiddenCount() > 0) {
}
if (m_model->storageSetupNeeded(index)) {
- connect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotItemDropEventStorageSetupDone(int,bool)));
+ connect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotItemDropEventStorageSetupDone);
m_itemDropEventIndex = index;
return;
}
- KUrl destUrl = destItem->url();
+ QUrl destUrl = destItem->url();
QDropEvent dropEvent(event->pos().toPoint(),
event->possibleActions(),
event->mimeData(),
event->buttons(),
event->modifiers());
- QString error;
- DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent, error);
- if (!error.isEmpty()) {
- emit errorMessage(error);
- }
+ slotUrlsDropped(destUrl, &dropEvent, this);
}
void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success)
{
- disconnect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotItemDropEventStorageSetupDone(int,bool)));
+ disconnect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotItemDropEventStorageSetupDone);
if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) {
if (success) {
- KUrl destUrl = m_model->placesItem(index)->url();
-
- QString error;
- DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent, error);
- if (!error.isEmpty()) {
- emit errorMessage(error);
- }
+ QUrl destUrl = m_model->placesItem(index)->url();
+ slotUrlsDropped(destUrl, m_itemDropEvent, this);
}
delete m_itemDropEventMimeData;
void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
{
m_model->dropMimeDataBefore(index, event->mimeData());
+ m_model->saveBookmarks();
}
-void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent)
+void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent)
{
- Q_UNUSED(parent);
- QString error;
- DragAndDropHelper::dropUrls(KFileItem(), dest, event, error);
- if (!error.isEmpty()) {
- emit errorMessage(error);
+ KIO::DropJob *job = DragAndDropHelper::dropUrls(dest, event, parent);
+ if (job) {
+ connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) emit errorMessage(job->errorString()); });
}
-
}
void PlacesPanel::slotTrashUpdated(KJob* job)
if (job->error()) {
emit errorMessage(job->errorString());
}
- org::kde::KDirNotify::emitFilesAdded("trash:/");
+ // as long as KIO doesn't do this, do it ourselves
+ KNotification::event("Trash: emptied", QString(), QPixmap(), 0, KNotification::DefaultEvent);
}
void PlacesPanel::slotStorageSetupDone(int index, bool success)
{
- disconnect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotStorageSetupDone(int,bool)));
+ disconnect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotStorageSetupDone);
if (m_triggerStorageSetupButton == Qt::NoButton) {
return;
m_triggerStorageSetupButton = Qt::NoButton;
} else {
setUrl(m_storageSetupFailedUrl);
- m_storageSetupFailedUrl = KUrl();
+ m_storageSetupFailedUrl = QUrl();
}
}
void PlacesPanel::emptyTrash()
{
- const QString text = i18nc("@info", "Do you really want to empty the Trash? All items will be deleted.");
- const bool del = KMessageBox::warningContinueCancel(window(),
- text,
- QString(),
- KGuiItem(i18nc("@action:button", "Empty Trash"),
- KIcon("user-trash"))
- ) == KMessageBox::Continue;
- if (del) {
- QByteArray packedArgs;
- QDataStream stream(&packedArgs, QIODevice::WriteOnly);
- stream << int(1);
- KIO::Job *job = KIO::special(KUrl("trash:/"), packedArgs);
- KNotification::event("Trash: emptied", QString() , QPixmap() , 0, KNotification::DefaultEvent);
- job->ui()->setWindow(parentWidget());
- connect(job, SIGNAL(result(KJob*)), SLOT(slotTrashUpdated(KJob*)));
+ KIO::JobUiDelegate uiDelegate;
+ uiDelegate.setWindow(window());
+ if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
+ KIO::Job* job = KIO::emptyTrash();
+ KJobWidgets::setWindow(job, window());
+ connect(job, &KIO::Job::result, this, &PlacesPanel::slotTrashUpdated);
}
}
void PlacesPanel::addEntry()
{
const int index = m_controller->selectionManager()->currentItem();
- const KUrl url = m_model->data(index).value("url").value<KUrl>();
+ const QUrl url = m_model->data(index).value("url").value<QUrl>();
QPointer<PlacesItemEditDialog> dialog = new PlacesItemEditDialog(this);
- dialog->setCaption(i18nc("@title:window", "Add Places Entry"));
+ dialog->setWindowTitle(i18nc("@title:window", "Add Places Entry"));
dialog->setAllowGlobal(true);
dialog->setUrl(url);
if (dialog->exec() == QDialog::Accepted) {
PlacesItem* item = m_model->createPlacesItem(dialog->text(), dialog->url(), dialog->icon());
m_model->appendItemToGroup(item);
+ m_model->saveBookmarks();
}
delete dialog;
QHash<QByteArray, QVariant> data = m_model->data(index);
QPointer<PlacesItemEditDialog> dialog = new PlacesItemEditDialog(this);
- dialog->setCaption(i18nc("@title:window", "Edit Places Entry"));
+ dialog->setWindowTitle(i18nc("@title:window", "Edit Places Entry"));
dialog->setIcon(data.value("iconName").toString());
dialog->setText(data.value("text").toString());
- dialog->setUrl(data.value("url").value<KUrl>());
+ dialog->setUrl(data.value("url").value<QUrl>());
dialog->setAllowGlobal(true);
if (dialog->exec() == QDialog::Accepted) {
PlacesItem* oldItem = m_model->placesItem(index);
oldItem->setText(dialog->text());
oldItem->setUrl(dialog->url());
oldItem->setIcon(dialog->icon());
+ m_model->saveBookmarks();
}
}
m_triggerStorageSetupButton = button;
m_storageSetupFailedUrl = url();
- connect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotStorageSetupDone(int,bool)));
+ connect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotStorageSetupDone);
m_model->requestStorageSetup(index);
} else {
m_triggerStorageSetupButton = Qt::NoButton;
- const KUrl url = m_model->data(index).value("url").value<KUrl>();
+ const QUrl url = m_model->data(index).value("url").value<QUrl>();
if (!url.isEmpty()) {
if (button == Qt::MiddleButton) {
emit placeMiddleClicked(PlacesItemModel::convertedUrl(url));
}
}
}
-
-
-#include "placespanel.moc"
Comment[ml]=പൊതുവായ ഡോള്ഫിന് സജ്ജീകരണങ്ങള് ക്രമീകരിയ്ക്കാന് ഈ സേവനം അനുവദിയ്ക്കുന്നു.
Comment[mr]=ही सेवा तुम्हाला डॉल्फिनच्या सामान्य व्यवस्थेचे संयोजन करण्यास मदत करते.
Comment[ms]=Servis ini membenarkan tetapan bagi tetapan umum Dolphin.
- Comment[nb]=Denne tjenesten tilbyr oppsett av generelle Dolphin-innstillinger.
Comment[nds]=Mit dissen Deenst laat sik allmeen Dolphin-Optschonen instellen.
Comment[nl]=Met deze dienst kunt u algemene Dolphin-instellingen configureren.
- Comment[nn]=Denne tenesta lèt deg setja opp generelle innstillingar for Dolphin.
Comment[pa]=ਇਹ ਸਰਵਿਸ ਆਮ ਡਾਲਫਿਨ ਸੈਟਿੰਗ ਦੀ ਸੰਰਚਨਾ ਵਾਸਤੇ ਹੈ।
Comment[pl]=Ta usługa pozwala na ogólne ustawienie Dolphina.
Comment[pt]=Este serviço permite-lhe configurar as opções gerais do Dolphin.
Icon=system-run
Type=Service
X-KDE-ServiceTypes=KCModule
-Exec=kcmshell4 kcmdolphingeneral
+Exec=kcmshell5 kcmdolphingeneral
X-KDE-Library=kcm_dolphingeneral
X-KDE-PluginKeyword=dolphingeneral
Comment[ml]=ഫയല് നടത്തിപ്പുകാരന്റെ പൊതുവായ സജ്ജീകരണങ്ങള് ക്രമീകരിയ്ക്കുക
Comment[mr]=फाईल व्यवस्थापकाच्या सामान्य व्यवस्थेचे संयोजन करा
Comment[ms]=Selaraskan tetapan pengurus fail
- Comment[nb]=Tilpass generelle filbehandler-innstillinger
Comment[nds]=Den Dateipleger allmeen instellen
Comment[nl]=Algemene bestandsbeheerderinstellingen configureren
- Comment[nn]=Set opp generelle innstillingar for filhandsamaren
Comment[pa]=ਆਮ ਫਾਇਲ ਮੈਨੇਜਰ ਸੈਟਿੰਗ ਸੰਰਚਨਾ
Comment[pl]=Ustawienia ogólne zarządzania plikami
Comment[pt]=Configurar as opções gerais do gestor de ficheiros
Comment[pt_BR]=Configura as opções gerais do gerenciador de arquivos
Comment[ro]=Configurează opțiunile generale ale gestionarul de fișiere
Comment[ru]=Настройка диспетчера файлов
- Comment[se]=Heivet oppalaš fiilagieđahallanheivehusat
Comment[si]=සාමාන්ය ගොනු කළමාණාකරන සැකසුම් සකසන්න
Comment[sk]=Všeobecné nastavenie správcu súborov
Comment[sl]=Splošne nastavitve upravljalnika datotek
Comment[ml]=ഡോള്ഫിനകത്തു് നീങ്ങുന്നതു് ക്രമീകരിയ്ക്കാന് ഈ സേവനം അനുവദിയ്ക്കുന്നു.
Comment[mr]=ही सेवा तुम्हाला डॉल्फिन संचारणाचे संयोजन करण्यास मदत करते.
Comment[ms]=Servis ini membenarkan tetapan bagi pengemudian Dolphin.
- Comment[nb]=Denne tjenesten tilbyr oppsett av Dolphin-navigasjon
Comment[nds]=Mit dissen Deenst lett sik de Dolphin-Navigeren instellen.
Comment[nl]=Met deze dienst kunt u Dolphin-navigatie configureren.
- Comment[nn]=Denne tenesta lèt deg setja opp navigasjonen for Dolphin.
Comment[pa]=ਇਹ ਸਰਵਿਸ ਡਾਲਫਿਨ ਨੇਵੀਗੇਸ਼ਨ ਦੀ ਸੰਰਚਨਾ ਵਾਸਤੇ ਹੈ।
Comment[pl]=Ta usługa umożliwia ustawienie nawigacji w Dolphinie.
Comment[pt]=Este serviço permite-lhe configurar a navegação do Dolphin.
Icon=input-mouse
Type=Service
X-KDE-ServiceTypes=KCModule
-Exec=kcmshell4 kcmdolphinnavigation
+Exec=kcmshell5 kcmdolphinnavigation
X-KDE-Library=kcm_dolphinnavigation
X-KDE-PluginKeyword=dolphinnavigation
Name[ml]=ഡോള്ഫിന് സേവനങ്ങള്
Name[mr]=डॉल्फिन सेवा
Name[ms]=Servis Dolphin
- Name[nb]=Dolphin-tjenester
Name[nds]=Dolphin-Deensten
Name[nl]=Dolphin-services
- Name[nn]=Dolphin-tenester
Name[pa]=ਡਾਲਫਿਨ ਸਰਵਿਸਾਂ
Name[pl]=Usługi Dolphina
Name[pt]=Serviços do Dolphin
Icon=services
Type=Service
X-KDE-ServiceTypes=KCModule
-Exec=kcmshell4 kcmdolphinservices
+Exec=kcmshell5 kcmdolphinservices
X-KDE-Library=kcm_dolphinservices
X-KDE-PluginKeyword=dolphinservices
Name[ml]=സേവനങ്ങള്
Name[mr]=सेवा
Name[ms]=Servis
- Name[nb]=Tjenester
Name[nds]=KDE-Deensten
Name[ne]=सेवा
Name[nl]=Services
- Name[nn]=Tenester
Name[oc]=Servicis
Name[or]=ସର୍ଭିସଗୁଡ଼ିକ
Name[pa]=ਸਰਵਿਸਾਂ
Name[pt_BR]=Serviços
Name[ro]=Servicii
Name[ru]=Действия
- Name[se]=Bálvalusat
Name[si]=සේවා
Name[sk]=Služby
Name[sl]=Storitve
Comment[mk]=Овој сервис овозможува конфигурација на режимите за преглед во Делфин.
Comment[ml]=ഡോള്ഫിന് അവതരണദശകള് ക്രമീകരിയ്ക്കാന് ഈ സേവനം അനുവദിയ്ക്കുന്നു.
Comment[mr]=ही सेवा तुम्हाला डॉल्फिन दृश्य पद्धतीचे संयोजन करण्यास मदत करते.
- Comment[nb]=Denne tjenesten tilbyr oppsett av Dolphin visningsmåter.
Comment[nds]=Mit dissen Deenst laat sik de Dolphin-Ansichten instellen.
Comment[nl]=Met deze dienst kunt u Dolphin-weergavemodussen configureren.
- Comment[nn]=Denne tenesta lèt deg setja opp Dolphin-visingar.
Comment[pa]=ਇਹ ਸਰਵਿਸ ਡਾਲਫਿਨ ਝਲਕ ਮੋਡ ਦੀ ਸੰਰਚਨਾ ਵਾਸਤੇ ਹੈ।
Comment[pl]=Ta usługa umożliwia ustawienie trybów widoku Dolphina.
Comment[pt]=Este serviço permite-lhe configurar os modos de visualização do Dolphin.
Icon=view-choose
Type=Service
X-KDE-ServiceTypes=KCModule
-Exec=kcmshell4 kcmdolphinviewmodes
+Exec=kcmshell5 kcmdolphinviewmodes
X-KDE-Library=kcm_dolphinviewmodes
X-KDE-PluginKeyword=dolphinviewmodes