diff --git a/applets/taskmanager/package/contents/config/main.xml b/applets/taskmanager/package/contents/config/main.xml deleted file mode 100644 --- a/applets/taskmanager/package/contents/config/main.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - false - - - - false - - - - true - - - - false - - - - 1 - - - - true - - - - true - - - - - - - - - - - - 1 - - - - true - - - - 2 - 1 - - - - false - - - - true - - - - true - - - - false - - - - - - - - - - - - - - - 0 - - - - true - - - - true - - - - true - - - - 0 - - - - - - - - - - - - 3 - - - - - diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h deleted file mode 100644 --- a/containments/desktop/plugins/folder/foldermodel.h +++ /dev/null @@ -1,365 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 Fredrik Höglund * - * Copyright (C) 2011 Marco Martin * - * Copyright (C) 2014 by Eike Hein * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef FOLDERMODEL_H -#define FOLDERMODEL_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "folderplugin_private_export.h" - -class QDrag; -class QItemSelectionModel; -class QQuickItem; - -class KFileCopyToMenu; -class KActionCollection; -class KDirModel; -class KDirWatch; -class KFileItem; -class KFileItemActions; -class KJob; -class KNewFileMenu; - -namespace KIO { - class DropJob; - class StatJob; -} - -class ScreenMapper; - -class DirLister : public KDirLister -{ - Q_OBJECT - - public: - explicit DirLister(QObject *parent = nullptr); - ~DirLister() override; - - Q_SIGNALS: - void error(const QString &string); - - protected: - void handleError(KIO::Job *job) override; -}; - -class FOLDERPLUGIN_TESTS_EXPORT FolderModel : public QSortFilterProxyModel, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(QString iconName READ iconName NOTIFY iconNameChanged) - Q_PROPERTY(QUrl resolvedUrl READ resolvedUrl NOTIFY resolvedUrlChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged) - Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged) - Q_PROPERTY(bool usedByContainment READ usedByContainment WRITE setUsedByContainment NOTIFY usedByContainmentChanged) - Q_PROPERTY(bool locked READ locked WRITE setLocked NOTIFY lockedChanged) - Q_PROPERTY(int sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged) - Q_PROPERTY(bool sortDesc READ sortDesc WRITE setSortDesc NOTIFY sortDescChanged) - Q_PROPERTY(bool sortDirsFirst READ sortDirsFirst WRITE setSortDirsFirst NOTIFY sortDirsFirstChanged) - Q_PROPERTY(bool parseDesktopFiles READ parseDesktopFiles WRITE setParseDesktopFiles NOTIFY parseDesktopFilesChanged) - Q_PROPERTY(QObject* viewAdapter READ viewAdapter WRITE setViewAdapter NOTIFY viewAdapterChanged) - Q_PROPERTY(bool previews READ previews WRITE setPreviews NOTIFY previewsChanged) - Q_PROPERTY(QStringList previewPlugins READ previewPlugins WRITE setPreviewPlugins NOTIFY previewPluginsChanged) - Q_PROPERTY(int filterMode READ filterMode WRITE setFilterMode NOTIFY filterModeChanged) - Q_PROPERTY(QString filterPattern READ filterPattern WRITE setFilterPattern NOTIFY filterPatternChanged) - Q_PROPERTY(QStringList filterMimeTypes READ filterMimeTypes WRITE setFilterMimeTypes NOTIFY filterMimeTypesChanged) - Q_PROPERTY(QObject* newMenu READ newMenu CONSTANT) - Q_PROPERTY(QObject* appletInterface READ appletInterface WRITE setAppletInterface NOTIFY appletInterfaceChanged) - - public: - enum DataRole { - BlankRole = Qt::UserRole + 1, - OverlaysRole, - SelectedRole, - IsDirRole, - IsLinkRole, - IsHiddenRole, - UrlRole, - LinkDestinationUrl, - SizeRole, - TypeRole, - FileNameRole - }; - - enum FilterMode { - NoFilter = 0, - FilterShowMatches, - FilterHideMatches - }; - - enum Status { - None, - Ready, - Listing, - Canceled - }; - Q_ENUM(Status) - - explicit FolderModel(QObject *parent = nullptr); - ~FolderModel() override; - - QHash roleNames() const override; - static QHash staticRoleNames(); - - void classBegin() override; - void componentComplete() override; - - QString url() const; - void setUrl(const QString &url); - - QString iconName() const; - - QUrl resolvedUrl() const; - Q_INVOKABLE QUrl resolve(const QString& url); - - Status status() const; - - QString errorString() const; - - bool dragging() const; - - bool usedByContainment() const; - void setUsedByContainment(bool used); - - bool locked() const; - void setLocked(bool locked); - - int sortMode() const; - void setSortMode(int mode); - - bool sortDesc() const; - void setSortDesc(bool desc); - - bool sortDirsFirst() const; - void setSortDirsFirst(bool enable); - - bool parseDesktopFiles() const; - void setParseDesktopFiles(bool enable); - - QObject* viewAdapter() const; - void setViewAdapter(QObject *adapter); - - bool previews() const; - void setPreviews(bool previews); - - QStringList previewPlugins() const; - void setPreviewPlugins(const QStringList &previewPlugins); - - int filterMode() const; - void setFilterMode(int filterMode); - - QString filterPattern() const; - void setFilterPattern(const QString &pattern); - - QStringList filterMimeTypes() const; - void setFilterMimeTypes(const QStringList &mimeList); - - QObject *appletInterface() const; - void setAppletInterface(QObject *appletInterface); - - KFileItem rootItem() const; - - Q_INVOKABLE void up(); - Q_INVOKABLE void cd(int row); - - Q_INVOKABLE void run(int row); - Q_INVOKABLE void runSelected(); - - Q_INVOKABLE void rename(int row, const QString &name); - Q_INVOKABLE int fileExtensionBoundary(int row); - - Q_INVOKABLE bool hasSelection() const; - Q_INVOKABLE bool isSelected(int row); - Q_INVOKABLE void setSelected(int row); - Q_INVOKABLE void toggleSelected(int row); - Q_INVOKABLE void setRangeSelected(int anchor, int to); - Q_INVOKABLE void updateSelection(const QVariantList &rows, bool toggle); - Q_INVOKABLE void clearSelection(); - Q_INVOKABLE void pinSelection(); - Q_INVOKABLE void unpinSelection(); - - Q_INVOKABLE void addItemDragImage(int row, int x, int y, int width, int height, const QVariant &image); - Q_INVOKABLE void clearDragImages(); - Q_INVOKABLE void setDragHotSpotScrollOffset(int x, int y); // FIXME TODO: Propify. - Q_INVOKABLE QPoint dragCursorOffset(int row); - Q_INVOKABLE void dragSelected(int x, int y); - Q_INVOKABLE void drop(QQuickItem *target, QObject *dropEvent, int row); - Q_INVOKABLE void dropCwd(QObject *dropEvent); - - Q_INVOKABLE bool isBlank(int row) const; - - Q_INVOKABLE QAction* action(const QString& name) const; - QObject* newMenu() const; - Q_INVOKABLE void updateActions(); - Q_INVOKABLE void openContextMenu(QQuickItem *visualParent = nullptr, - Qt::KeyboardModifiers modifiers = Qt::NoModifier); - - Q_INVOKABLE void linkHere(const QUrl &sourceUrl); - - Q_INVOKABLE void openPropertiesDialog(); - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - int indexForUrl(const QUrl &url) const; - KFileItem itemForIndex(const QModelIndex &index) const; - bool isDir(const QModelIndex &index, const KDirModel *dirModel) const; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - Qt::DropActions supportedDragActions() const override; - - Q_INVOKABLE void paste(); - Q_INVOKABLE void copy(); - Q_INVOKABLE void cut(); - Q_INVOKABLE void deleteSelected(); - Q_INVOKABLE void openSelected(); - Q_INVOKABLE void undo(); - Q_INVOKABLE void refresh(); - - void setScreen(int screen); - - bool eventFilter(QObject *watched, QEvent *event) override; - - Q_SIGNALS: - void urlChanged() const; - void listingCompleted() const; - void listingCanceled() const; - void iconNameChanged() const; - void resolvedUrlChanged() const; - void statusChanged() const; - void errorStringChanged() const; - void draggingChanged() const; - void usedByContainmentChanged() const; - void lockedChanged() const; - void sortModeChanged() const; - void sortDescChanged() const; - void sortDirsFirstChanged() const; - void parseDesktopFilesChanged() const; - void viewAdapterChanged(); - void previewsChanged() const; - void previewPluginsChanged() const; - void filterModeChanged() const; - void filterPatternChanged() const; - void filterMimeTypesChanged() const; - void screenChanged() const; - void appletInterfaceChanged() const; - void requestRename() const; - void move(int x, int y, QList urls); - void popupMenuAboutToShow(KIO::DropJob *dropJob, QMimeData *mimeData, int x, int y); - - protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; - bool matchMimeType(const KFileItem &item) const; - bool matchPattern(const KFileItem &item) const; - - private Q_SLOTS: - void dragSelectedInternal(int x, int y); - void dirListFailed(const QString &error); - void statResult(KJob *job); - void evictFromIsDirCache(const KFileItemList &items); - void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); - void pasteTo(); - void moveSelectedToTrash(); - void emptyTrashBin(); - void restoreSelectedFromTrash(); - void undoTextChanged(const QString &text); - void invalidateIfComplete(); - void invalidateFilterIfComplete(); - void newFileMenuItemCreated(const QUrl &url); - - private: - struct DragImage { - int row; - QRect rect; - QPoint cursorOffset; - QImage image; - bool blank; - }; - - void createActions(); - void updatePasteAction(); - void addDragImage(QDrag *drag, int x, int y); - void setStatus(Status status); - static bool isTrashEmpty(); - QList selectedUrls() const; - KDirModel *m_dirModel; - KDirWatch *m_dirWatch; - QString m_url; - QHash m_isDirCache; - mutable QHash m_isDirJobs; - QItemSelectionModel *m_selectionModel; - QItemSelection m_pinnedSelection; - QModelIndexList m_dragIndexes; - QHash m_dragImages; - QPoint m_dragHotSpotScrollOffset; - bool m_dragInProgress; - bool m_urlChangedWhileDragging; - // target filename to target position of a drop event, note that this deliberately - // is not using the URL to easily support desktop:/ URL schemes - QHash m_dropTargetPositions; - QTimer *m_dropTargetPositionsCleanup; - QPointer m_previewGenerator; - QPointer m_viewAdapter; - KActionCollection m_actionCollection; - KNewFileMenu *m_newMenu; - KFileItemActions *m_fileItemActions; - KFileCopyToMenu *m_copyToMenu; - Status m_status = Status::None; - QString m_errorString; - bool m_usedByContainment; - bool m_locked; - int m_sortMode; // FIXME TODO: Enumify. - bool m_sortDesc; - bool m_sortDirsFirst; - bool m_parseDesktopFiles; - bool m_previews; - // An empty previewPlugin list means use default. - // We don't want to leak that fact to the QML side, however, so the property stays empty - // and internally we operate on effectivePreviewPlugins instead. - QStringList m_previewPlugins; - QStringList m_effectivePreviewPlugins; - FilterMode m_filterMode; - QString m_filterPattern; - bool m_filterPatternMatchAll; - QSet m_mimeSet; - QList m_regExps; - int m_screen = -1; - ScreenMapper *m_screenMapper = nullptr; - QObject *m_appletInterface = nullptr; - bool m_complete; - QPoint m_menuPosition; -}; - -#endif diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp deleted file mode 100644 --- a/containments/desktop/plugins/folder/foldermodel.cpp +++ /dev/null @@ -1,2094 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 David Faure * - * Copyright (C) 2008 Fredrik Höglund * - * Copyright (C) 2008 Rafael Fernández López * - * Copyright (C) 2011 Marco Martin * - * Copyright (C) 2014 by Eike Hein * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#include "foldermodel.h" -#include "itemviewadapter.h" -#include "positioner.h" -#include "screenmapper.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -Q_LOGGING_CATEGORY(FOLDERMODEL, "plasma.containments.desktop.folder.foldermodel") - -DirLister::DirLister(QObject *parent) : KDirLister(parent) -{ -} - -DirLister:: ~DirLister() -{ -} - -void DirLister::handleError(KIO::Job *job) -{ - if (!autoErrorHandlingEnabled()) { - emit error(job->errorString()); - return; - } - - KDirLister::handleError(job); -} - -FolderModel::FolderModel(QObject *parent) : QSortFilterProxyModel(parent), - m_dirWatch(nullptr), - m_dragInProgress(false), - m_urlChangedWhileDragging(false), - m_dropTargetPositionsCleanup(new QTimer(this)), - m_previewGenerator(nullptr), - m_viewAdapter(nullptr), - m_actionCollection(this), - m_newMenu(nullptr), - m_fileItemActions(nullptr), - m_usedByContainment(false), - m_locked(true), - m_sortMode(0), - m_sortDesc(false), - m_sortDirsFirst(true), - m_parseDesktopFiles(false), - m_previews(false), - m_filterMode(NoFilter), - m_filterPatternMatchAll(true), - m_screenMapper(ScreenMapper::instance()), - m_complete(false) -{ - //needed to pass the job around with qml - qmlRegisterType(); - DirLister *dirLister = new DirLister(this); - dirLister->setDelayedMimeTypes(true); - dirLister->setAutoErrorHandlingEnabled(false, nullptr); - connect(dirLister, &DirLister::error, this, &FolderModel::dirListFailed); - connect(dirLister, &KCoreDirLister::itemsDeleted, this, &FolderModel::evictFromIsDirCache); - - connect(dirLister, &KCoreDirLister::started, this, std::bind(&FolderModel::setStatus, this, Status::Listing)); - - void (KCoreDirLister::*myCompletedSignal)() = &KCoreDirLister::completed; - QObject::connect(dirLister, myCompletedSignal, this, [this] { - setStatus(Status::Ready); - emit listingCompleted(); - }); - - void (KCoreDirLister::*myCanceledSignal)() = &KCoreDirLister::canceled; - QObject::connect(dirLister, myCanceledSignal, this, [this] { - setStatus(Status::Canceled); - emit listingCanceled(); - }); - - m_dirModel = new KDirModel(this); - m_dirModel->setDirLister(dirLister); - m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory | KDirModel::DropOnLocalExecutable); - - // If we have dropped items queued for moving, go unsorted now. - connect(this, &QAbstractItemModel::rowsAboutToBeInserted, - this, [this]() { - if (!m_dropTargetPositions.isEmpty()) { - setSortMode(-1); - } - }); - - // Position dropped items at the desired target position. - connect(this, &QAbstractItemModel::rowsInserted, - this, [this](const QModelIndex &parent, int first, int last) { - for (int i = first; i <= last; ++i) { - const auto idx = index(i, 0, parent); - const auto url = itemForIndex(idx).url(); - auto it = m_dropTargetPositions.find(url.fileName()); - if (it != m_dropTargetPositions.end()) { - const auto pos = it.value(); - m_dropTargetPositions.erase(it); - emit move(pos.x(), pos.y(), {url}); - } - } - }); - - /* - * Dropped files may not actually show up as new files, e.g. when we overwrite - * an existing file. Or files that fail to be listed by the dirLister, or... - * To ensure we don't grow the map indefinitely, clean it up periodically. - * The cleanup timer is (re)started whenever we modify the map. We use a quite - * high interval of 10s. This should ensure, that we don't accidentally wipe - * the mapping when we actually still want to use it. Since the time between - * adding an entry in the map and it showing up in the model should be - * small, this should rarely, if ever happen. - */ - m_dropTargetPositionsCleanup->setInterval(10000); - m_dropTargetPositionsCleanup->setSingleShot(true); - connect(m_dropTargetPositionsCleanup, &QTimer::timeout, this, [this]() { - if (!m_dropTargetPositions.isEmpty()) { - qCDebug(FOLDERMODEL) << "clearing drop target positions after timeout:" << m_dropTargetPositions; - m_dropTargetPositions.clear(); - } - }); - - m_selectionModel = new QItemSelectionModel(this, this); - connect(m_selectionModel, &QItemSelectionModel::selectionChanged, - this, &FolderModel::selectionChanged); - - setSourceModel(m_dirModel); - - setSortLocaleAware(true); - setFilterCaseSensitivity(Qt::CaseInsensitive); - setDynamicSortFilter(true); - - sort(m_sortMode, m_sortDesc ? Qt::DescendingOrder : Qt::AscendingOrder); - - createActions(); -} - -FolderModel::~FolderModel() -{ - if (m_usedByContainment) { - // disconnect so we don't handle signals from the screen mapper when - // removeScreen is called - m_screenMapper->disconnect(this); - m_screenMapper->removeScreen(m_screen, resolvedUrl()); - } -} - -QHash< int, QByteArray > FolderModel::roleNames() const -{ - return staticRoleNames(); -} - -QHash< int, QByteArray > FolderModel::staticRoleNames() -{ - QHash roleNames; - roleNames[Qt::DisplayRole] = "display"; - roleNames[Qt::DecorationRole] = "decoration"; - roleNames[BlankRole] = "blank"; - roleNames[OverlaysRole] = "overlays"; - roleNames[SelectedRole] = "selected"; - roleNames[IsDirRole] = "isDir"; - roleNames[IsLinkRole] = "isLink"; - roleNames[IsHiddenRole] = "isHidden"; - roleNames[UrlRole] = "url"; - roleNames[LinkDestinationUrl] = "linkDestinationUrl"; - roleNames[SizeRole] = "size"; - roleNames[TypeRole] = "type"; - - return roleNames; -} - -void FolderModel::classBegin() -{ -} - -void FolderModel::componentComplete() -{ - m_complete = true; - invalidate(); -} - -void FolderModel::invalidateIfComplete() -{ - if (!m_complete) { - return; - } - - invalidate(); -} - -void FolderModel::invalidateFilterIfComplete() -{ - if (!m_complete) { - return; - } - - invalidateFilter(); -} - -void FolderModel::newFileMenuItemCreated(const QUrl &url) -{ - if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { - m_screenMapper->addMapping(url, m_screen, ScreenMapper::DelayedSignal); - m_dropTargetPositions.insert(url.fileName(), m_menuPosition); - m_menuPosition = {}; - m_dropTargetPositionsCleanup->start(); - } -} - -QString FolderModel::url() const -{ - return m_url; -} - -void FolderModel::setUrl(const QString& url) -{ - const QUrl &resolvedNewUrl = resolve(url); - - if (url == m_url) { - m_dirModel->dirLister()->updateDirectory(resolvedNewUrl); - return; - } - - const auto oldUrl = resolvedUrl(); - - beginResetModel(); - m_url = url; - m_isDirCache.clear(); - m_dirModel->dirLister()->openUrl(resolvedNewUrl); - clearDragImages(); - m_dragIndexes.clear(); - endResetModel(); - - emit urlChanged(); - emit resolvedUrlChanged(); - - m_errorString.clear(); - emit errorStringChanged(); - - if (m_dirWatch) { - delete m_dirWatch; - m_dirWatch = nullptr; - } - - if (resolvedNewUrl.isValid()) { - m_dirWatch = new KDirWatch(this); - connect(m_dirWatch, &KDirWatch::created, this, &FolderModel::iconNameChanged); - connect(m_dirWatch, &KDirWatch::dirty, this, &FolderModel::iconNameChanged); - m_dirWatch->addFile(resolvedNewUrl.toLocalFile() + QLatin1String("/.directory")); - } - - if (m_dragInProgress) { - m_urlChangedWhileDragging = true; - } - - emit iconNameChanged(); - - if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { - m_screenMapper->removeScreen(m_screen, oldUrl); - m_screenMapper->addScreen(m_screen, resolvedUrl()); - } -} - -QUrl FolderModel::resolvedUrl() const -{ - return m_dirModel->dirLister()->url(); -} - -QUrl FolderModel::resolve(const QString& url) -{ - QUrl resolvedUrl; - - if (url.startsWith(QLatin1Char('~'))) { - resolvedUrl = QUrl::fromLocalFile(KShell::tildeExpand(url)); - } else { - resolvedUrl = QUrl::fromUserInput(url); - } - - return resolvedUrl; -} - -QString FolderModel::iconName() const -{ - const KFileItem rootItem(m_dirModel->dirLister()->url()); - - if (!rootItem.isFinalIconKnown()) { - rootItem.determineMimeType(); - } - - return rootItem.iconName(); -} - -FolderModel::Status FolderModel::status() const -{ - return m_status; -} - -void FolderModel::setStatus(Status status) -{ - if (m_status != status) { - m_status = status; - emit statusChanged(); - } -} - -QString FolderModel::errorString() const -{ - return m_errorString; -} - -bool FolderModel::dragging() const -{ - return m_dragInProgress; -} - -bool FolderModel::usedByContainment() const -{ - return m_usedByContainment; -} - -void FolderModel::setUsedByContainment(bool used) -{ - if (m_usedByContainment != used) { - m_usedByContainment = used; - - QAction *action = m_actionCollection.action(QStringLiteral("refresh")); - - if (action) { - action->setText(m_usedByContainment ? i18n("&Refresh Desktop") : i18n("&Refresh View")); - action->setIcon(m_usedByContainment ? QIcon::fromTheme(QStringLiteral("user-desktop")) : QIcon::fromTheme(QStringLiteral("view-refresh"))); - } - - m_screenMapper->disconnect(this); - connect(m_screenMapper, &ScreenMapper::screensChanged, this, &FolderModel::invalidateFilterIfComplete); - connect(m_screenMapper, &ScreenMapper::screenMappingChanged, this, &FolderModel::invalidateFilterIfComplete); - - emit usedByContainmentChanged(); - } -} - -bool FolderModel::locked() const -{ - return m_locked; -} - -void FolderModel::setLocked(bool locked) -{ - if (m_locked != locked) { - m_locked = locked; - - emit lockedChanged(); - } -} - -void FolderModel::dirListFailed(const QString& error) -{ - m_errorString = error; - emit errorStringChanged(); -} - -int FolderModel::sortMode() const -{ - return m_sortMode; -} - -void FolderModel::setSortMode(int mode) -{ - if (m_sortMode != mode) { - m_sortMode = mode; - - if (mode == -1 /* Unsorted */) { - setDynamicSortFilter(false); - } else { - invalidateIfComplete(); - sort(m_sortMode, m_sortDesc ? Qt::DescendingOrder : Qt::AscendingOrder); - setDynamicSortFilter(true); - } - - emit sortModeChanged(); - } -} - -bool FolderModel::sortDesc() const -{ - return m_sortDesc; -} - -void FolderModel::setSortDesc(bool desc) -{ - if (m_sortDesc != desc) { - m_sortDesc = desc; - - if (m_sortMode != -1 /* Unsorted */) { - invalidateIfComplete(); - sort(m_sortMode, m_sortDesc ? Qt::DescendingOrder : Qt::AscendingOrder); - } - - emit sortDescChanged(); - } -} - -bool FolderModel::sortDirsFirst() const -{ - return m_sortDirsFirst; -} - -void FolderModel::setSortDirsFirst(bool enable) -{ - if (m_sortDirsFirst != enable) { - m_sortDirsFirst = enable; - - if (m_sortMode != -1 /* Unsorted */) { - invalidateIfComplete(); - sort(m_sortMode, m_sortDesc ? Qt::DescendingOrder : Qt::AscendingOrder); - } - - emit sortDirsFirstChanged(); - } -} - -bool FolderModel::parseDesktopFiles() const -{ - return m_parseDesktopFiles; -} - -void FolderModel::setParseDesktopFiles(bool enable) -{ - if (m_parseDesktopFiles != enable) { - m_parseDesktopFiles = enable; - emit parseDesktopFilesChanged(); - } -} - -QObject* FolderModel::viewAdapter() const -{ - return m_viewAdapter; -} - -void FolderModel::setViewAdapter(QObject* adapter) -{ - if (m_viewAdapter != adapter) { - KAbstractViewAdapter *abstractViewAdapter = dynamic_cast(adapter); - - m_viewAdapter = abstractViewAdapter; - - if (m_viewAdapter && !m_previewGenerator) { - m_previewGenerator = new KFilePreviewGenerator(abstractViewAdapter, this); - m_previewGenerator->setPreviewShown(m_previews); - m_previewGenerator->setEnabledPlugins(m_effectivePreviewPlugins); - } - - emit viewAdapterChanged(); - } -} - -bool FolderModel::previews() const -{ - return m_previews; -} - -void FolderModel::setPreviews(bool previews) -{ - if (m_previews != previews) { - m_previews = previews; - - if (m_previewGenerator) { - m_previewGenerator->setPreviewShown(m_previews); - } - - emit previewsChanged(); - } -} - -QStringList FolderModel::previewPlugins() const -{ - return m_previewPlugins; -} - -void FolderModel::setPreviewPlugins(const QStringList& previewPlugins) -{ - QStringList effectivePlugins = previewPlugins; - if (effectivePlugins.isEmpty()) { - effectivePlugins = KIO::PreviewJob::defaultPlugins(); - } - - if (m_effectivePreviewPlugins != effectivePlugins) { - m_effectivePreviewPlugins = effectivePlugins; - - if (m_previewGenerator) { - m_previewGenerator->setPreviewShown(false); - m_previewGenerator->setEnabledPlugins(m_effectivePreviewPlugins); - m_previewGenerator->setPreviewShown(true); - } - } - - if (m_previewPlugins != previewPlugins) { - m_previewPlugins = previewPlugins; - emit previewPluginsChanged(); - } -} - -int FolderModel::filterMode() const -{ - return m_filterMode; -} - -void FolderModel::setFilterMode(int filterMode) -{ - if (m_filterMode != (FilterMode)filterMode) { - m_filterMode = (FilterMode)filterMode; - - invalidateFilterIfComplete(); - - emit filterModeChanged(); - } -} - -QString FolderModel::filterPattern() const -{ - return m_filterPattern; -} - -void FolderModel::setFilterPattern(const QString &pattern) -{ - if (m_filterPattern == pattern) { - return; - } - - m_filterPattern = pattern; - m_filterPatternMatchAll = (pattern == QLatin1String("*")); - - const QStringList patterns = pattern.split(QLatin1Char(' ')); - m_regExps.clear(); - m_regExps.reserve(patterns.count()); - - foreach (const QString &pattern, patterns) { - QRegExp rx(pattern); - rx.setPatternSyntax(QRegExp::Wildcard); - rx.setCaseSensitivity(Qt::CaseInsensitive); - m_regExps.append(rx); - } - - invalidateFilterIfComplete(); - - emit filterPatternChanged(); -} - -QStringList FolderModel::filterMimeTypes() const -{ - return m_mimeSet.toList(); -} - -void FolderModel::setFilterMimeTypes(const QStringList &mimeList) -{ - const QSet &set = QSet::fromList(mimeList); - - if (m_mimeSet != set) { - - m_mimeSet = set; - - invalidateFilterIfComplete(); - - emit filterMimeTypesChanged(); - } -} - -void FolderModel::setScreen(int screen) -{ - if (m_screen == screen) - return; - - m_screen = screen; - if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { - m_screenMapper->addScreen(screen, resolvedUrl()); - } - emit screenChanged(); -} - -bool FolderModel::eventFilter(QObject *watched, QEvent *event) -{ - Q_UNUSED(watched) - - // Catching Shift modifier usage on open context menus to swap the - // Trash/Delete actions. - if (event->type() == QEvent::KeyPress) { - QKeyEvent *keyEvent = static_cast(event); - - if (keyEvent->key() == Qt::Key_Shift) { - m_actionCollection.action(QStringLiteral("trash"))->setVisible(false); - m_actionCollection.action(QStringLiteral("del"))->setVisible(true); - } - } else if (event->type() == QEvent::KeyRelease) { - QKeyEvent *keyEvent = static_cast(event); - - if (keyEvent->key() == Qt::Key_Shift) { - m_actionCollection.action(QStringLiteral("trash"))->setVisible(true); - m_actionCollection.action(QStringLiteral("del"))->setVisible(false); - } - } - - return false; -} - -KFileItem FolderModel::rootItem() const -{ - return m_dirModel->dirLister()->rootItem(); -} - -void FolderModel::up() -{ - const QUrl &up = KIO::upUrl(resolvedUrl()); - - if (up.isValid()) { - setUrl(up.toString()); - } -} - -void FolderModel::cd(int row) -{ - if (row < 0) { - return; - } - - const QModelIndex idx = index(row, 0); - bool isDir = data(idx, IsDirRole).toBool(); - - if (isDir) { - const KFileItem item = itemForIndex(idx); - if (m_parseDesktopFiles && item.isDesktopFile()) { - const KDesktopFile file(item.targetUrl().path()); - if (file.hasLinkType()) { - setUrl(file.readUrl()); - } - } else { - setUrl(item.targetUrl().toString()); - } - } -} - -void FolderModel::run(int row) -{ - if (row < 0) { - return; - } - - KFileItem item = itemForIndex(index(row, 0)); - - QUrl url(item.targetUrl()); - - // FIXME TODO: This can go once we depend on a KIO w/ fe1f50caaf2. - if (url.scheme().isEmpty()) { - url.setScheme(QStringLiteral("file")); - } - - KRun *run = new KRun(url, nullptr); - // On desktop:/ we want to be able to run .desktop files right away, - // otherwise ask for security reasons. We also don't use the targetUrl() - // from above since we don't want the resolved /home/foo/Desktop URL. - run->setShowScriptExecutionPrompt(item.url().scheme() != QLatin1String("desktop") - || item.url().adjusted(QUrl::RemoveFilename).path() != QLatin1String("/")); -} - -void FolderModel::runSelected() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - if (m_selectionModel->selectedIndexes().count() == 1) { - run(m_selectionModel->selectedIndexes().constFirst().row()); - return; - } - - KFileItemActions fileItemActions(this); - KFileItemList items; - - foreach (const QModelIndex &index, m_selectionModel->selectedIndexes()) { - // Skip over directories. - if (!index.data(IsDirRole).toBool()) { - items << itemForIndex(index); - } - } - - fileItemActions.runPreferredApplications(items, QString()); -} - -void FolderModel::rename(int row, const QString& name) -{ - if (row < 0) { - return; - } - - QModelIndex idx = index(row, 0); - m_dirModel->setData(mapToSource(idx), name, Qt::EditRole); -} - -int FolderModel::fileExtensionBoundary(int row) -{ - const QModelIndex idx = index(row, 0); - const QString &name = data(idx, Qt::DisplayRole).toString(); - - int boundary = name.length(); - - if (data(idx, IsDirRole).toBool()) { - return boundary; - } - - QMimeDatabase db; - const QString &ext = db.suffixForFileName(name); - - if (ext.isEmpty()) { - boundary = name.lastIndexOf(QLatin1Char('.')); - - if (boundary < 1) { - boundary = name.length(); - } - } else { - boundary -= ext.length() + 1; - } - - return boundary; -} - -bool FolderModel::hasSelection() const -{ - return m_selectionModel->hasSelection(); -} - -bool FolderModel::isSelected(int row) -{ - if (row < 0) { - return false; - } - - return m_selectionModel->isSelected(index(row, 0)); -} - -void FolderModel::setSelected(int row) -{ - if (row < 0) { - return; - } - - m_selectionModel->select(index(row, 0), QItemSelectionModel::Select); -} - -void FolderModel::toggleSelected(int row) -{ - if (row < 0) { - return; - } - - m_selectionModel->select(index(row, 0), QItemSelectionModel::Toggle); -} - -void FolderModel::setRangeSelected(int anchor, int to) -{ - if (anchor < 0 || to < 0) { - return; - } - - QItemSelection selection(index(anchor, 0), index(to, 0)); - m_selectionModel->select(selection, QItemSelectionModel::ClearAndSelect); -} - -void FolderModel::updateSelection(const QVariantList &rows, bool toggle) -{ - QItemSelection newSelection; - - int iRow = -1; - - foreach (const QVariant &row, rows) { - iRow = row.toInt(); - - if (iRow < 0) { - return; - } - - const QModelIndex &idx = index(iRow, 0); - newSelection.select(idx, idx); - } - - if (toggle) { - QItemSelection pinnedSelection = m_pinnedSelection; - pinnedSelection.merge(newSelection, QItemSelectionModel::Toggle); - m_selectionModel->select(pinnedSelection, QItemSelectionModel::ClearAndSelect); - } else { - m_selectionModel->select(newSelection, QItemSelectionModel::ClearAndSelect); - } -} - -void FolderModel::clearSelection() -{ - if (m_selectionModel->hasSelection()) { - m_selectionModel->clear(); - } -} - -void FolderModel::pinSelection() -{ - m_pinnedSelection = m_selectionModel->selection(); -} - -void FolderModel::unpinSelection() -{ - m_pinnedSelection = QItemSelection(); -} - -void FolderModel::addItemDragImage(int row, int x, int y, int width, int height, const QVariant &image) -{ - if (row < 0) { - return; - } - - delete m_dragImages.take(row); - - DragImage *dragImage = new DragImage(); - dragImage->row = row; - dragImage->rect = QRect(x, y, width, height); - dragImage->image = image.value(); - dragImage->blank = false; - - m_dragImages.insert(row, dragImage); -} - -void FolderModel::clearDragImages() -{ - qDeleteAll(m_dragImages); - m_dragImages.clear(); -} - -void FolderModel::setDragHotSpotScrollOffset(int x, int y) -{ - m_dragHotSpotScrollOffset.setX(x); - m_dragHotSpotScrollOffset.setY(y); -} - -QPoint FolderModel::dragCursorOffset(int row) -{ - DragImage *image = m_dragImages.value(row); - if (!image) { - return QPoint(0, 0); - } - - return image->cursorOffset; -} - -void FolderModel::addDragImage(QDrag *drag, int x, int y) -{ - if (!drag || m_dragImages.isEmpty()) { - return; - } - - QRegion region; - - foreach (DragImage *image, m_dragImages) { - image->blank = isBlank(image->row); - image->rect.translate(-m_dragHotSpotScrollOffset.x(), -m_dragHotSpotScrollOffset.y()); - if (!image->blank && !image->image.isNull()) { - region = region.united(image->rect); - } - } - - QRect rect = region.boundingRect(); - QPoint offset = rect.topLeft(); - rect.translate(-offset.x(), -offset.y()); - - QImage dragImage(rect.size(), QImage::Format_RGBA8888); - dragImage.fill(Qt::transparent); - - QPainter painter(&dragImage); - - QPoint pos; - - foreach (DragImage *image, m_dragImages) { - if (!image->blank && !image->image.isNull()) { - pos = image->rect.translated(-offset.x(), -offset.y()).topLeft(); - image->cursorOffset.setX(pos.x() - (x - offset.x())); - image->cursorOffset.setY(pos.y() - (y - offset.y())); - - painter.drawImage(pos, image->image); - } - - // FIXME HACK: Operate on copy. - image->rect.translate(m_dragHotSpotScrollOffset.x(), m_dragHotSpotScrollOffset.y()); - } - - drag->setPixmap(QPixmap::fromImage(dragImage)); - drag->setHotSpot(QPoint(x - offset.x(), y - offset.y())); -} - -void FolderModel::dragSelected(int x, int y) -{ - if (m_dragInProgress) { - return; - } - - m_dragInProgress = true; - emit draggingChanged(); - m_urlChangedWhileDragging = false; - - // Avoid starting a drag synchronously in a mouse handler or interferes with - // child event filtering in parent items (and thus e.g. press-and-hold hand- - // ling in a containment). - QMetaObject::invokeMethod(this, "dragSelectedInternal", Qt::QueuedConnection, - Q_ARG(int, x), - Q_ARG(int, y)); -} - -void FolderModel::dragSelectedInternal(int x, int y) -{ - if (!m_viewAdapter || !m_selectionModel->hasSelection()) { - m_dragInProgress = false; - emit draggingChanged(); - return; - } - - ItemViewAdapter *adapter = qobject_cast(m_viewAdapter); - QQuickItem *item = qobject_cast(adapter->adapterView()); - - QDrag *drag = new QDrag(item); - - addDragImage(drag, x, y); - - m_dragIndexes = m_selectionModel->selectedIndexes(); - - qSort(m_dragIndexes.begin(), m_dragIndexes.end()); - - // TODO: Optimize to emit contiguous groups. - emit dataChanged(m_dragIndexes.first(), m_dragIndexes.last(), QVector() << BlankRole); - - QModelIndexList sourceDragIndexes; - sourceDragIndexes.reserve(m_dragIndexes.count()); - foreach (const QModelIndex &index, m_dragIndexes) { - sourceDragIndexes.append(mapToSource(index)); - } - - drag->setMimeData(m_dirModel->mimeData(sourceDragIndexes)); - - // Due to spring-loading (aka auto-expand), the URL might change - // while the drag is in-flight - in that case we don't want to - // unnecessarily emit dataChanged() for (possibly invalid) indices - // after it ends. - const QUrl currentUrl(m_dirModel->dirLister()->url()); - - item->grabMouse(); - drag->exec(supportedDragActions()); - - item->ungrabMouse(); - - m_dragInProgress = false; - emit draggingChanged(); - m_urlChangedWhileDragging = false; - - if (m_dirModel->dirLister()->url() == currentUrl) { - const QModelIndex first(m_dragIndexes.first()); - const QModelIndex last(m_dragIndexes.last()); - m_dragIndexes.clear(); - // TODO: Optimize to emit contiguous groups. - emit dataChanged(first, last, QVector() << BlankRole); - } -} - -static bool isDropBetweenSharedViews(const QList &urls, const QUrl &folderUrl) -{ - for (const auto &url : urls) { - if (folderUrl.adjusted(QUrl::StripTrailingSlash) - != url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash)) { - return false; - } - } - return true; -} - -void FolderModel::drop(QQuickItem *target, QObject* dropEvent, int row) -{ - QMimeData *mimeData = qobject_cast(dropEvent->property("mimeData").value()); - - if (!mimeData) { - return; - } - - QModelIndex idx; - KFileItem item; - - if (row > -1 && row < rowCount()) { - idx = index(row, 0); - item = itemForIndex(idx); - } - - QUrl dropTargetUrl; - - // So we get to run mostLocalUrl() over the current URL. - if (item.isNull()) { - item = rootItem(); - } - - if (item.isNull()) { - dropTargetUrl = m_dirModel->dirLister()->url(); - } else if (m_parseDesktopFiles && item.isDesktopFile()) { - const KDesktopFile file(item.targetUrl().path()); - - if (file.hasLinkType()) { - dropTargetUrl = QUrl(file.readUrl()); - } else { - dropTargetUrl = item.mostLocalUrl(); - } - } else { - dropTargetUrl = item.mostLocalUrl(); - } - - auto dropTargetFolderUrl = dropTargetUrl; - if (dropTargetFolderUrl.fileName() == QLatin1String(".")) { - // the target URL for desktop:/ is e.g. 'file://home/user/Desktop/.' - dropTargetFolderUrl = dropTargetFolderUrl.adjusted(QUrl::RemoveFilename); - } - - // use dropTargetUrl to resolve desktop:/ to the actual file location which is also used by the mime data - /* QMimeData operates on local URLs, but the dir lister and thus screen mapper and positioner may - * use a fancy scheme like desktop:/ instead. Ensure we always use the latter to properly map URLs, - * i.e. go from file:///home/user/Desktop/file to desktop:/file - */ - auto mappableUrl = [this, dropTargetFolderUrl](const QUrl &url) -> QUrl { - if (dropTargetFolderUrl != m_dirModel->dirLister()->url()) { - QString mappedUrl = url.toString(); - const auto local = dropTargetFolderUrl.toString(); - const auto internal = m_dirModel->dirLister()->url().toString(); - if (mappedUrl.startsWith(local)) { - mappedUrl.replace(0, local.size(), internal); - } - return ScreenMapper::stringToUrl(mappedUrl); - } - return url; - }; - - const int x = dropEvent->property("x").toInt(); - const int y = dropEvent->property("y").toInt(); - const QPoint dropPos = {x, y}; - - if (m_dragInProgress && row == -1 && !m_urlChangedWhileDragging) { - if (m_locked || mimeData->urls().isEmpty()) { - return; - } - - setSortMode(-1); - - for (const auto &url : mimeData->urls()) { - m_dropTargetPositions.insert(url.fileName(), dropPos); - m_screenMapper->addMapping(mappableUrl(url), m_screen, ScreenMapper::DelayedSignal); - m_screenMapper->removeItemFromDisabledScreen(mappableUrl(url)); - } - emit move(x, y, mimeData->urls()); - - return; - } - - if (mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-service")) && - mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-path"))) { - const QString remoteDBusClient = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-service")); - const QString remoteDBusPath = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-path")); - - QDBusMessage message = - QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath, - QStringLiteral("org.kde.ark.DndExtract"), - QStringLiteral("extractSelectedFilesTo")); - message.setArguments({dropTargetUrl.toDisplayString(QUrl::PreferLocalFile)}); - - QDBusConnection::sessionBus().call(message, QDBus::NoBlock); - - return; - } - - if (idx.isValid() && !(flags(idx) & Qt::ItemIsDropEnabled)) { - return; - } - - // Catch drops from a Task Manager and convert to usable URL. - if (!mimeData->hasUrls() && mimeData->hasFormat(QStringLiteral("text/x-orgkdeplasmataskmanager_taskurl"))) { - QList urls = {QUrl(QString::fromUtf8(mimeData->data(QStringLiteral("text/x-orgkdeplasmataskmanager_taskurl"))))}; - mimeData->setUrls(urls); - } - - if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { - if (isDropBetweenSharedViews(mimeData->urls(), dropTargetFolderUrl)) { - setSortMode(-1); - for (const auto &url : mimeData->urls()) { - m_dropTargetPositions.insert(url.fileName(), dropPos); - m_screenMapper->addMapping(mappableUrl(url), m_screen, ScreenMapper::DelayedSignal); - m_screenMapper->removeItemFromDisabledScreen(mappableUrl(url)); - } - m_dropTargetPositionsCleanup->start(); - return; - } - } - - Qt::DropAction proposedAction((Qt::DropAction)dropEvent->property("proposedAction").toInt()); - Qt::DropActions possibleActions(dropEvent->property("possibleActions").toInt()); - Qt::MouseButtons buttons(dropEvent->property("buttons").toInt()); - Qt::KeyboardModifiers modifiers(dropEvent->property("modifiers").toInt()); - - auto pos = target->mapToScene(dropPos).toPoint(); - pos = target->window()->mapToGlobal(pos); - QDropEvent ev(pos, possibleActions, mimeData, buttons, modifiers); - ev.setDropAction(proposedAction); - - KIO::DropJob *dropJob = KIO::drop(&ev, dropTargetUrl); - dropJob->uiDelegate()->setAutoErrorHandlingEnabled(true); - - // The QMimeData we extract from the DropArea's drop event is deleted as soon as this method - // ends but we need to keep a copy for when popupMenuAboutToShow fires. - QMimeData *mimeCopy = new QMimeData(); - for (const QString &format : mimeData->formats()) { - mimeCopy->setData(format, mimeData->data(format)); - } - - connect(dropJob, &KIO::DropJob::popupMenuAboutToShow, this, [this, mimeCopy, x, y, dropJob](const KFileItemListProperties &) { - emit popupMenuAboutToShow(dropJob, mimeCopy, x, y); - mimeCopy->deleteLater(); - }); - - /* - * Position files that come from a drag'n'drop event at the drop event - * target position. To do so, we first listen to copy job to figure out - * the target URL. Then we store the position of this drop event in the - * hash and eventually trigger a move request when we get notified about - * the new file event from the source model. - */ - connect(dropJob, &KIO::DropJob::copyJobStarted, this, [this, dropPos, dropTargetUrl](KIO::CopyJob* copyJob) { - auto map = [this, dropPos, dropTargetUrl](const QUrl &targetUrl) { - m_dropTargetPositions.insert(targetUrl.fileName(), dropPos); - m_dropTargetPositionsCleanup->start(); - - if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { - // assign a screen for the item before the copy is actually done, so - // filterAcceptsRow doesn't assign the default screen to it - QUrl url = resolvedUrl(); - // if the folderview's folder is a standard path, just use the targetUrl for mapping - if (targetUrl.toString().startsWith(url.toString())) { - m_screenMapper->addMapping(targetUrl, m_screen, ScreenMapper::DelayedSignal); - } else if (targetUrl.toString().startsWith(dropTargetUrl.toString())) { - // if the folderview's folder is a special path, like desktop:// , we need to convert - // the targetUrl file:// path to a desktop:/ path for mapping - auto destPath = dropTargetUrl.path(); - auto filePath = targetUrl.path(); - if (filePath.startsWith(destPath)) { - url.setPath(filePath.remove(0, destPath.length())); - m_screenMapper->addMapping(url, m_screen, ScreenMapper::DelayedSignal); - } - } - } - }; - // remember drop target position for target URL and forget about the source URL - connect(copyJob, &KIO::CopyJob::copyingDone, - this, [this, map](KIO::Job *, const QUrl &, const QUrl &targetUrl, const QDateTime &, bool, bool) { - map(targetUrl); - }); - connect(copyJob, &KIO::CopyJob::copyingLinkDone, - this, [this, map](KIO::Job *, const QUrl &, const QString &, const QUrl &targetUrl) { - map(targetUrl); - }); - }); -} - -void FolderModel::dropCwd(QObject* dropEvent) -{ - QMimeData *mimeData = qobject_cast(dropEvent->property("mimeData").value()); - - if (!mimeData) { - return; - } - - if (mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-service")) && - mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-path"))) { - const QString remoteDBusClient = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-service")); - const QString remoteDBusPath = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-path")); - - QDBusMessage message = - QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath, - QStringLiteral("org.kde.ark.DndExtract"), - QStringLiteral("extractSelectedFilesTo")); - message.setArguments(QVariantList() << m_dirModel->dirLister()->url().adjusted(QUrl::PreferLocalFile).toString()); - - QDBusConnection::sessionBus().call(message, QDBus::NoBlock); - } else { - Qt::DropAction proposedAction((Qt::DropAction)dropEvent->property("proposedAction").toInt()); - Qt::DropActions possibleActions(dropEvent->property("possibleActions").toInt()); - Qt::MouseButtons buttons(dropEvent->property("buttons").toInt()); - Qt::KeyboardModifiers modifiers(dropEvent->property("modifiers").toInt()); - - QDropEvent ev(QPoint(), possibleActions, mimeData, buttons, modifiers); - ev.setDropAction(proposedAction); - - KIO::DropJob *dropJob = KIO::drop(&ev, m_dirModel->dirLister()->url().adjusted(QUrl::PreferLocalFile)); - dropJob->uiDelegate()->setAutoErrorHandlingEnabled(true); - } -} - -void FolderModel::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) -{ - QModelIndexList indices = selected.indexes(); - indices.append(deselected.indexes()); - - QVector roles; - roles.append(SelectedRole); - - foreach(const QModelIndex &index, indices) { - emit dataChanged(index, index, roles); - } - - if (!m_selectionModel->hasSelection()) { - clearDragImages(); - } else { - foreach (const QModelIndex &idx, deselected.indexes()) { - delete m_dragImages.take(idx.row()); - } - } - - updateActions(); -} - -bool FolderModel::isBlank(int row) const -{ - if (row < 0) { - return true; - } - - return data(index(row, 0), BlankRole).toBool(); -} - -QVariant FolderModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) { - return QVariant(); - } - - if (role == BlankRole) { - return m_dragIndexes.contains(index); - } else if (role == OverlaysRole) { - const KFileItem item = itemForIndex(index); - return item.overlays(); - } else if (role == SelectedRole) { - return m_selectionModel->isSelected(index); - } else if (role == IsDirRole) { - return isDir(mapToSource(index), m_dirModel); - } else if (role == IsLinkRole) { - const KFileItem item = itemForIndex(index); - return item.isLink(); - } else if (role == IsHiddenRole) { - const KFileItem item = itemForIndex(index); - return item.isHidden(); - } else if (role == UrlRole) { - return itemForIndex(index).url(); - } else if (role == LinkDestinationUrl) { - const KFileItem item = itemForIndex(index); - - if (m_parseDesktopFiles && item.isDesktopFile()) { - const KDesktopFile file(item.targetUrl().path()); - - if (file.hasLinkType()) { - return file.readUrl(); - } - } - - return item.targetUrl(); - } else if (role == SizeRole) { - bool isDir = data(index, IsDirRole).toBool(); - - if (!isDir) { - return m_dirModel->data(mapToSource(QSortFilterProxyModel::index(index.row(), 1)), Qt::DisplayRole); - } - } else if (role == TypeRole) { - return m_dirModel->data(mapToSource(QSortFilterProxyModel::index(index.row(), 6)), Qt::DisplayRole); - } else if (role == FileNameRole) { - return itemForIndex(index).url().fileName(); - } - - return QSortFilterProxyModel::data(index, role); -} - -int FolderModel::indexForUrl(const QUrl& url) const -{ - return mapFromSource(m_dirModel->indexForUrl(url)).row(); -} - -KFileItem FolderModel::itemForIndex(const QModelIndex &index) const -{ - return m_dirModel->itemForIndex(mapToSource(index)); -} - -bool FolderModel::isDir(const QModelIndex &index, const KDirModel *dirModel) const -{ - KFileItem item = dirModel->itemForIndex(index); - if (item.isDir()) { - return true; - } - - auto it = m_isDirCache.constFind(item.url()); - if (it != m_isDirCache.constEnd()) { - return *it; - } - - if (m_parseDesktopFiles && item.isDesktopFile()) { - // Check if the desktop file is a link to a directory - KDesktopFile file(item.targetUrl().path()); - - if (!file.hasLinkType()) { - return false; - } - - const QUrl url(file.readUrl()); - - // Check if we already have a running StatJob for this URL. - if (m_isDirJobs.contains(item.url())) { - return false; - } - - if (KProtocolInfo::protocolClass(url.scheme()) != QStringLiteral(":local")) { - return false; - } - - KIO::StatJob *job = KIO::stat(url, KIO::HideProgressInfo); - job->setProperty("org.kde.plasma.folder_url", item.url()); - job->setSide(KIO::StatJob::SourceSide); - job->setDetails(0); - connect(job, &KJob::result, this, &FolderModel::statResult); - m_isDirJobs.insert(item.url(), job); - } - - return false; -} - -void FolderModel::statResult(KJob *job) -{ - KIO::StatJob *statJob = static_cast(job); - - const QUrl &url = statJob->property("org.kde.plasma.folder_url").toUrl(); - const QModelIndex &idx = index(indexForUrl(url), 0); - - if (idx.isValid() && statJob->error() == KJob::NoError) { - m_isDirCache[url] = statJob->statResult().isDir(); - - emit dataChanged(idx, idx, QVector() << IsDirRole); - } - - m_isDirJobs.remove(url); -} - -void FolderModel::evictFromIsDirCache(const KFileItemList& items) -{ - foreach (const KFileItem &item, items) { - m_screenMapper->removeFromMap(item.url()); - m_isDirCache.remove(item.url()); - } -} - -bool FolderModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - const KDirModel *dirModel = static_cast(sourceModel()); - - if (m_sortDirsFirst || left.column() == KDirModel::Size) { - bool leftIsDir = isDir(left, dirModel); - bool rightIsDir = isDir(right, dirModel); - - if (leftIsDir && !rightIsDir) { - return (sortOrder() == Qt::AscendingOrder); - } - - if (!leftIsDir && rightIsDir) { - return (sortOrder() == Qt::DescendingOrder); - } - } - - const KFileItem leftItem = dirModel->data(left, KDirModel::FileItemRole).value(); - const KFileItem rightItem = dirModel->data(right, KDirModel::FileItemRole).value(); - const int column = left.column(); - int result = 0; - - switch (column) { - case KDirModel::Size: { - if (isDir(left, dirModel) && isDir(right, dirModel)) { - const int leftChildCount = dirModel->data(left, KDirModel::ChildCountRole).toInt(); - const int rightChildCount = dirModel->data(right, KDirModel::ChildCountRole).toInt(); - if (leftChildCount < rightChildCount) - result = -1; - else if (leftChildCount > rightChildCount) - result = +1; - } else { - const KIO::filesize_t leftSize = leftItem.size(); - const KIO::filesize_t rightSize = rightItem.size(); - if (leftSize < rightSize) - result = -1; - else if (leftSize > rightSize) - result = +1; - } - - break; - } - case KDirModel::ModifiedTime: { - const long long leftTime = leftItem.entry().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1); - const long long rightTime = rightItem.entry().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1); - if (leftTime < rightTime) - result = -1; - else if (leftTime > rightTime) - result = +1; - - break; - } - case KDirModel::Type: - result = QString::compare(dirModel->data(left, Qt::DisplayRole).toString(), - dirModel->data(right, Qt::DisplayRole).toString()); - break; - - default: - break; - } - - if (result != 0) - return result < 0; - - QCollator collator; - - result = collator.compare(leftItem.text(), rightItem.text()); - - if (result != 0) - return result < 0; - - result = collator.compare(leftItem.name(), rightItem.name()); - - if (result != 0) - return result < 0; - - return QString::compare(leftItem.url().url(), rightItem.url().url(), Qt::CaseSensitive); -} - -Qt::DropActions FolderModel::supportedDragActions() const -{ - return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; -} - -inline bool FolderModel::matchMimeType(const KFileItem &item) const -{ - if (m_mimeSet.isEmpty()) { - return false; - } - - if (m_mimeSet.contains(QStringLiteral("all/all")) || m_mimeSet.contains(QStringLiteral("all/allfiles"))) { - return true; - } - - const QString mimeType = item.determineMimeType().name(); - return m_mimeSet.contains(mimeType); -} - -inline bool FolderModel::matchPattern(const KFileItem &item) const -{ - if (m_filterPatternMatchAll) { - return true; - } - - const QString name = item.name(); - QListIterator i(m_regExps); - while (i.hasNext()) { - if (i.next().exactMatch(name)) { - return true; - } - } - - return false; -} - -bool FolderModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - const KDirModel *dirModel = static_cast(sourceModel()); - const KFileItem item = dirModel->itemForIndex(dirModel->index(sourceRow, KDirModel::Name, sourceParent)); - - if (m_usedByContainment && !m_screenMapper->sharedDesktops()) { - const QUrl url = item.url(); - const int screen = m_screenMapper->screenForItem(url); - // don't do anything if the folderview is not associated with a screen - if (m_screen != -1) { - if (screen == -1) { - // The item is not associated with a screen, probably because this is the first - // time we see it or the folderview was previously used as a regular applet. - // Associated with this folderview if the view is on the first available screen - if (m_screen == m_screenMapper->firstAvailableScreen(resolvedUrl())) { - m_screenMapper->addMapping(url, m_screen, ScreenMapper::DelayedSignal); - } else { - return false; - } - } else if (m_screen != screen) { - // the item belongs to a different screen, filter it out - return false; - } - } - } - - if (m_filterMode == NoFilter) { - return true; - } - - if (m_filterMode == FilterShowMatches) { - return (matchPattern(item) && matchMimeType(item)); - } else { - return !(matchPattern(item) && matchMimeType(item)); - } -} - -void FolderModel::createActions() -{ - KIO::FileUndoManager *manager = KIO::FileUndoManager::self(); - - QAction *cut = KStandardAction::cut(this, &FolderModel::cut, this); - QAction *copy = KStandardAction::copy(this, &FolderModel::copy, this); - - QAction *undo = KStandardAction::undo(manager, &KIO::FileUndoManager::undo, this); - undo->setEnabled(manager->undoAvailable()); - undo->setShortcutContext(Qt::WidgetShortcut); - connect(manager, SIGNAL(undoAvailable(bool)), undo, SLOT(setEnabled(bool))); - connect(manager, &KIO::FileUndoManager::undoTextChanged, this, &FolderModel::undoTextChanged); - - QAction *paste = KStandardAction::paste(this, &FolderModel::paste, this); - QAction *pasteTo = KStandardAction::paste(this, &FolderModel::pasteTo, this); - - QAction *refresh = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), i18n("&Refresh View"), this); - refresh->setShortcut(QKeySequence(QKeySequence::Refresh)); - connect(refresh, &QAction::triggered, this, &FolderModel::refresh); - - QAction *rename = KStandardAction::renameFile(this, &FolderModel::requestRename, this); - QAction *trash = KStandardAction::moveToTrash(this, &FolderModel::moveSelectedToTrash, this); - - QAction *emptyTrash = new QAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18n("&Empty Trash"), this); - connect(emptyTrash, &QAction::triggered, this, &FolderModel::emptyTrashBin); - - QAction *restoreFromTrash = new QAction(i18nc("Restore from trash", "Restore"), this); - connect(restoreFromTrash, &QAction::triggered, this, &FolderModel::restoreSelectedFromTrash); - - QAction *del = KStandardAction::deleteFile(this, &FolderModel::deleteSelected, this); - - QAction *actOpen = new QAction(QIcon::fromTheme(QStringLiteral("window-new")), i18n("&Open"), this); - connect(actOpen, &QAction::triggered, this, &FolderModel::openSelected); - - m_actionCollection.addAction(QStringLiteral("open"), actOpen); - m_actionCollection.addAction(QStringLiteral("cut"), cut); - m_actionCollection.addAction(QStringLiteral("undo"), undo); - m_actionCollection.addAction(QStringLiteral("copy"), copy); - m_actionCollection.addAction(QStringLiteral("paste"), paste); - m_actionCollection.addAction(QStringLiteral("pasteto"), pasteTo); - m_actionCollection.addAction(QStringLiteral("refresh"), refresh); - m_actionCollection.addAction(QStringLiteral("rename"), rename); - m_actionCollection.addAction(QStringLiteral("trash"), trash); - m_actionCollection.addAction(QStringLiteral("del"), del); - m_actionCollection.addAction(QStringLiteral("restoreFromTrash"), restoreFromTrash); - m_actionCollection.addAction(QStringLiteral("emptyTrash"), emptyTrash); - - m_newMenu = new KNewFileMenu(&m_actionCollection, QStringLiteral("newMenu"), QApplication::desktop()); - m_newMenu->setModal(false); - connect(m_newMenu, &KNewFileMenu::directoryCreated, this, &FolderModel::newFileMenuItemCreated); - connect(m_newMenu, &KNewFileMenu::fileCreated, this, &FolderModel::newFileMenuItemCreated); - - m_copyToMenu = new KFileCopyToMenu(nullptr); -} - -QAction* FolderModel::action(const QString &name) const -{ - return m_actionCollection.action(name); -} - -QObject* FolderModel::newMenu() const -{ - return m_newMenu->menu(); -} - -void FolderModel::updateActions() -{ - const QModelIndexList indexes = m_selectionModel->selectedIndexes(); - - KFileItemList items; - QList urls; - bool hasRemoteFiles = false; - bool isTrashLink = false; - const bool isTrash = (resolvedUrl().scheme() == QLatin1String("trash")); - - if (indexes.isEmpty()) { - items << rootItem(); - } else { - items.reserve(indexes.count()); - urls.reserve(indexes.count()); - for (const QModelIndex &index : indexes) { - KFileItem item = itemForIndex(index); - if (!item.isNull()) { - hasRemoteFiles |= item.localPath().isEmpty(); - items.append(item); - urls.append(item.url()); - } - } - } - - KFileItemListProperties itemProperties(items); - // Check if we're showing the menu for the trash link - if (items.count() == 1 && items.at(0).isDesktopFile()) { - KDesktopFile file(items.at(0).localPath()); - if (file.hasLinkType() && file.readUrl() == QLatin1String("trash:/")) { - isTrashLink = true; - } - } - - if (m_newMenu) { - m_newMenu->checkUpToDate(); - m_newMenu->setPopupFiles(m_dirModel->dirLister()->url()); - // we need to set here as well, when the menu is shown via AppletInterface::eventFilter - m_menuPosition = QCursor::pos(); - - if (QAction *newMenuAction = m_actionCollection.action(QStringLiteral("newMenu"))) { - newMenuAction->setEnabled(itemProperties.supportsWriting()); - newMenuAction->setVisible(!isTrash); - } - } - - if (QAction *emptyTrash = m_actionCollection.action(QStringLiteral("emptyTrash"))) { - if (isTrash || isTrashLink) { - emptyTrash->setVisible(true); - emptyTrash->setEnabled(!isTrashEmpty()); - } else { - emptyTrash->setVisible(false); - } - } - - if (QAction *restoreFromTrash = m_actionCollection.action(QStringLiteral("restoreFromTrash"))) { - restoreFromTrash->setVisible(isTrash); - } - - if (QAction *moveToTrash = m_actionCollection.action(QStringLiteral("trash"))) { - moveToTrash->setVisible(!hasRemoteFiles && itemProperties.supportsMoving()); - } - - if (QAction *del = m_actionCollection.action(QStringLiteral("del"))) { - del->setVisible(itemProperties.supportsDeleting()); - } - - if (QAction *cut = m_actionCollection.action(QStringLiteral("cut"))) { - cut->setEnabled(itemProperties.supportsDeleting()); - cut->setVisible(!isTrash); - } - - if (QAction *paste = m_actionCollection.action(QStringLiteral("paste"))) { - bool enable = false; - - const QString pasteText = KIO::pasteActionText(QApplication::clipboard()->mimeData(), - &enable, rootItem()); - - if (enable) { - paste->setText(pasteText); - paste->setEnabled(true); - } else { - paste->setText(i18n("&Paste")); - paste->setEnabled(false); - } - - if (QAction *pasteTo = m_actionCollection.action(QStringLiteral("pasteto"))) { - pasteTo->setVisible(itemProperties.isDirectory() && itemProperties.supportsWriting()); - pasteTo->setEnabled(paste->isEnabled()); - pasteTo->setText(paste->text()); - } - } - - if (QAction *rename = m_actionCollection.action(QStringLiteral("rename"))) { - rename->setEnabled(itemProperties.supportsMoving()); - rename->setVisible(!isTrash); - } -} - -void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifiers modifiers) -{ - if (m_usedByContainment && !KAuthorized::authorize(QStringLiteral("action/kdesktop_rmb"))) { - return; - } - - updateActions(); - - const QModelIndexList indexes = m_selectionModel->selectedIndexes(); - - QMenu *menu = new QMenu(); - if (!m_fileItemActions) { - m_fileItemActions = new KFileItemActions(this); - m_fileItemActions->setParentWidget(QApplication::desktop()); - } - - if (indexes.isEmpty()) { - menu->addAction(m_actionCollection.action(QStringLiteral("newMenu"))); - menu->addSeparator(); - menu->addAction(m_actionCollection.action(QStringLiteral("paste"))); - menu->addAction(m_actionCollection.action(QStringLiteral("undo"))); - menu->addAction(m_actionCollection.action(QStringLiteral("refresh"))); - menu->addAction(m_actionCollection.action(QStringLiteral("emptyTrash"))); - menu->addSeparator(); - - KFileItemListProperties itemProperties(KFileItemList() << rootItem()); - m_fileItemActions->setItemListProperties(itemProperties); - - menu->addAction(m_fileItemActions->preferredOpenWithAction(QString())); - } else { - KFileItemList items; - QList urls; - - items.reserve(indexes.count()); - urls.reserve(indexes.count()); - for (const QModelIndex &index : indexes) { - KFileItem item = itemForIndex(index); - if (!item.isNull()) { - items.append(item); - urls.append(item.url()); - } - } - - KFileItemListProperties itemProperties(items); - - // Start adding the actions: - // "Open" and "Open with" actions - m_fileItemActions->setItemListProperties(itemProperties); - m_fileItemActions->addOpenWithActionsTo(menu); - menu->addSeparator(); - menu->addAction(m_actionCollection.action(QStringLiteral("cut"))); - menu->addAction(m_actionCollection.action(QStringLiteral("copy"))); - menu->addAction(m_actionCollection.action(QStringLiteral("paste"))); - menu->addSeparator(); - menu->addAction(m_actionCollection.action(QStringLiteral("rename"))); - menu->addAction(m_actionCollection.action(QStringLiteral("restoreFromTrash"))); - - KConfigGroup cg(KSharedConfig::openConfig(), "KDE"); - bool showDeleteCommand = cg.readEntry("ShowDeleteCommand", false); - - menu->addAction(m_actionCollection.action(QStringLiteral("emptyTrash"))); - - QAction *trashAction = m_actionCollection.action(QStringLiteral("trash")); - menu->addAction(trashAction); - trashAction->setVisible(!modifiers.testFlag(Qt::ShiftModifier)); - - QAction *deleteAction = m_actionCollection.action(QStringLiteral("del")); - menu->addAction(deleteAction); - - deleteAction->setVisible(showDeleteCommand || !trashAction->isVisible()); - - menu->addSeparator(); - - // Service actions - m_fileItemActions->addServiceActionsTo(menu); - menu->addSeparator(); - // Plugin actions - m_fileItemActions->addPluginActionsTo(menu); - - // Copy To, Move To - KSharedConfig::Ptr dolphin = KSharedConfig::openConfig(QStringLiteral("dolphinrc")); - if (KConfigGroup(dolphin, "General").readEntry("ShowCopyMoveMenu", false)) { - m_copyToMenu->setUrls(urls); - m_copyToMenu->setReadOnly(!itemProperties.supportsMoving()); - m_copyToMenu->addActionsTo(menu); - menu->addSeparator(); - } - - // Properties - if (KPropertiesDialog::canDisplay(items)) { - menu->addSeparator(); - QAction *act = new QAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18n("&Properties"), menu); - act->setShortcuts({Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter}); - QObject::connect(act, &QAction::triggered, this, &FolderModel::openPropertiesDialog); - menu->addAction(act); - } - } - - if (visualParent) { - m_menuPosition = visualParent->mapToGlobal(QPointF(0, visualParent->height())).toPoint(); - } else { - m_menuPosition = QCursor::pos(); - } - - // Used to monitor Shift modifier usage while the menu is open, to - // swap the Trash and Delete actions. - menu->installEventFilter(this); - - menu->setAttribute(Qt::WA_TranslucentBackground); - menu->winId(); //force surface creation before ensurePolish call in menu::Popup which happens before show - menu->popup(m_menuPosition); - connect(menu, &QMenu::aboutToHide, [menu]() { menu->deleteLater(); }); -} - -void FolderModel::openPropertiesDialog() -{ - const QModelIndexList indexes = m_selectionModel->selectedIndexes(); - if (indexes.isEmpty()) { - return; - } - - KFileItemList items; - items.reserve(indexes.count()); - for (const QModelIndex &index : indexes) { - KFileItem item = itemForIndex(index); - if (!item.isNull()) { - items.append(item); - } - } - - if (!KPropertiesDialog::canDisplay(items)) { - return; - } - - KPropertiesDialog::showDialog(items, nullptr, false /*non modal*/); -} - -void FolderModel::linkHere(const QUrl &sourceUrl) -{ - KIO::CopyJob *job = KIO::link(sourceUrl, m_dirModel->dirLister()->url()); - KIO::FileUndoManager::self()->recordCopyJob(job); -} - -QList FolderModel::selectedUrls() const -{ - const auto indexes = m_selectionModel->selectedIndexes(); - - QList urls; - urls.reserve(indexes.count()); - - for (const QModelIndex &index : indexes) { - urls.append(itemForIndex(index).url()); - } - - return urls; -} - -void FolderModel::copy() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - if (QAction *action = m_actionCollection.action(QStringLiteral("copy"))) { - if (!action->isEnabled()) { - return; - } - } - - QMimeData *mimeData = QSortFilterProxyModel::mimeData(m_selectionModel->selectedIndexes()); - QApplication::clipboard()->setMimeData(mimeData); -} - -void FolderModel::cut() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - if (QAction *action = m_actionCollection.action(QStringLiteral("cut"))) { - if (!action->isEnabled()) { - return; - } - } - - QMimeData *mimeData = QSortFilterProxyModel::mimeData(m_selectionModel->selectedIndexes()); - KIO::setClipboardDataCut(mimeData, true); - QApplication::clipboard()->setMimeData(mimeData); -} - -void FolderModel::paste() -{ - if (QAction *action = m_actionCollection.action(QStringLiteral("paste"))) { - if (!action->isEnabled()) { - return; - } - } - - KIO::paste(QApplication::clipboard()->mimeData(), m_dirModel->dirLister()->url()); -} - -void FolderModel::pasteTo() -{ - const QList urls = selectedUrls(); - Q_ASSERT(urls.count() == 1); - KIO::paste(QApplication::clipboard()->mimeData(), urls.first()); -} - -void FolderModel::refresh() -{ - m_errorString.clear(); - emit errorStringChanged(); - - m_dirModel->dirLister()->updateDirectory(m_dirModel->dirLister()->url()); -} - -QObject *FolderModel::appletInterface() const -{ - return m_appletInterface; -} - -void FolderModel::setAppletInterface(QObject *appletInterface) -{ - if (m_appletInterface != appletInterface) { - Q_ASSERT(!m_appletInterface); - - m_appletInterface = appletInterface; - - if (appletInterface) { - Plasma::Applet *applet = appletInterface->property("_plasma_applet").value(); - - if (applet) { - Plasma::Containment *containment = applet->containment(); - - if (containment) { - Plasma::Corona *corona = containment->corona(); - - if (corona) { - m_screenMapper->setCorona(corona); - } - setScreen(containment->screen()); - connect(containment, &Plasma::Containment::screenChanged, this, &FolderModel::setScreen); - } - } - } - - emit appletInterfaceChanged(); - } -} - -void FolderModel::moveSelectedToTrash() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - if (QAction *action = m_actionCollection.action(QStringLiteral("trash"))) { - if (!action->isEnabled()) { - return; - } - } - - const QList urls = selectedUrls(); - KIO::JobUiDelegate uiDelegate; - - if (uiDelegate.askDeleteConfirmation(urls, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job* job = KIO::trash(urls); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, urls, QUrl(QStringLiteral("trash:/")), job); - } -} - -void FolderModel::deleteSelected() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - if (QAction *action = m_actionCollection.action(QStringLiteral("del"))) { - if (!action->isEnabled()) { - return; - } - } - - const QList urls = selectedUrls(); - KIO::JobUiDelegate uiDelegate; - - if (uiDelegate.askDeleteConfirmation(urls, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job* job = KIO::del(urls); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - } -} - -void FolderModel::openSelected() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - const QList urls = selectedUrls(); - for (const QUrl &url : urls) { - (void) new KRun(url, nullptr); - } -} - -void FolderModel::undo() -{ - if (QAction *action = m_actionCollection.action(QStringLiteral("undo"))) { - // trigger() doesn't check enabled and would crash if invoked nonetheless. - if (action->isEnabled()) { - action->trigger(); - } - } -} - -void FolderModel::emptyTrashBin() -{ - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(QApplication::desktop()); - - if (uiDelegate.askDeleteConfirmation(QList(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job* job = KIO::emptyTrash(); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - } -} - -void FolderModel::restoreSelectedFromTrash() -{ - if (!m_selectionModel->hasSelection()) { - return; - } - - const auto &urls = selectedUrls(); - - KIO::RestoreJob *job = KIO::restoreFromTrash(urls); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); -} - -bool FolderModel::isTrashEmpty() -{ - KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig); - return trashConfig.group("Status").readEntry("Empty", true); -} - -void FolderModel::undoTextChanged(const QString &text) -{ - if (QAction *action = m_actionCollection.action(QStringLiteral("undo"))) { - action->setText(text); - } -} - diff --git a/kcms/colors/kcm_colors.desktop b/kcms/colors/kcm_colors.desktop deleted file mode 100644 --- a/kcms/colors/kcm_colors.desktop +++ /dev/null @@ -1,173 +0,0 @@ -[Desktop Entry] -Exec=kcmshell5 kcm_colors -Icon=preferences-desktop-color -Type=Service -X-KDE-ServiceTypes=KCModule -X-DocPath=kcontrol/colors/index.html - -X-KDE-Library=kcm_colors -X-KDE-ParentApp=kcontrol - -X-KDE-System-Settings-Parent-Category=appearance -X-KDE-Weight=60 - -Name=Colors -Name[af]=Kleure -Name[ar]=الألوان -Name[be]=Колеры -Name[be@latin]=Kolery -Name[bg]=Цветове -Name[bn]=রং -Name[bn_IN]=রং -Name[br]=Livioù -Name[bs]=Boje -Name[ca]=Colors -Name[ca@valencia]=Colors -Name[cs]=Barvy -Name[csb]=Farwë -Name[cy]=Lliwiau -Name[da]=Farver -Name[de]=Farben -Name[el]=Χρώματα -Name[en_GB]=Colours -Name[eo]=Koloroj -Name[es]=Colores -Name[et]=Värvid -Name[eu]=Koloreak -Name[fa]=رنگها -Name[fi]=Värit -Name[fr]=Couleurs -Name[fy]=Kleuren -Name[ga]=Dathanna -Name[gl]=Cores -Name[gu]=રંગો -Name[he]=צבעים -Name[hi]=रंग -Name[hne]=रंग -Name[hr]=Boje -Name[hsb]=Barby -Name[hu]=Színek -Name[ia]=Colores -Name[id]=Warna -Name[is]=Litir -Name[it]=Colori -Name[ja]=色 -Name[ka]=ცვეტები -Name[kk]=Түстер -Name[km]=ពណ៌ -Name[kn]=ಬಣ್ಣಗಳು -Name[ko]=색상 -Name[ku]=Reng -Name[lt]=Spalvos -Name[lv]=Krāsas -Name[mai]=रँग -Name[mk]=Бои -Name[ml]=നിറങ്ങള്‍ -Name[mr]=रंग -Name[ms]=Warna -Name[nb]=Farger -Name[nds]=Klören -Name[ne]=रङ -Name[nl]=Kleuren -Name[nn]=Fargar -Name[oc]=Colors -Name[or]=ରଙ୍ଗ -Name[pa]=ਰੰਗ -Name[pl]=Kolory -Name[pt]=Cores -Name[pt_BR]=Cores -Name[ro]=Culori -Name[ru]=Цвета -Name[se]=Ivnnit -Name[si]=වර්‍ණ -Name[sk]=Farby -Name[sl]=Barve -Name[sr]=Боје -Name[sr@ijekavian]=Боје -Name[sr@ijekavianlatin]=Boje -Name[sr@latin]=Boje -Name[sv]=Färger -Name[ta]=வண்ணங்கள் -Name[te]=రంగులు -Name[tg]=Рангҳо -Name[th]=สี -Name[tr]=Renkler -Name[ug]=رەڭلەر -Name[uk]=Кольори -Name[uz]=Ranglar -Name[uz@cyrillic]=Ранглар -Name[vi]=Màu sắc -Name[wa]=Coleurs -Name[xh]=Imibala -Name[x-test]=xxColorsxx -Name[zh_CN]=色彩 -Name[zh_TW]=顏色 - -Comment=Choose the color scheme -Comment[ca]=Trieu l'esquema de colors -Comment[ca@valencia]=Trieu l'esquema de colors -Comment[es]=Escoger el esquema de color -Comment[gl]=Escoller o esquema de cores -Comment[it]=Scegli lo schema di colori -Comment[nl]=Kies het kleurenschema -Comment[nn]=Vel fargeoppsett -Comment[pl]=Wybierz zestaw kolorów -Comment[pt]=Escolher o esquema de cores -Comment[pt_BR]=Escolha o esquema de cores -Comment[ru]=Выбор цветовой схемы -Comment[sk]=Vybrať farebnú schému -Comment[sv]=Välj färgschemat -Comment[uk]=Вибір теми кольорів -Comment[x-test]=xxChoose the color schemexx -Comment[zh_CN]=选择配色方案 -Comment[zh_TW]=選擇色彩主題 - - -X-KDE-Keywords=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[ar]=لون,ألوان,مخطّط,مخطط,تباين,ألوان الودجات,مخطّط ألوان,مخطط ألوان,نمط اللون,سمة اللون -X-KDE-Keywords[bs]=boje,boje,tema,kontrast,dodatak bojama,tema u boji,stil boja,tema boja -X-KDE-Keywords[ca]=colors,esquema,contrast,colors d'estris,Esquema de color,estil de color, tema de color -X-KDE-Keywords[ca@valencia]=colors,esquema,contrast,colors d'estris,Esquema de color,estil de color, tema de color -X-KDE-Keywords[da]=farver,tema,kontrast,widget-farver,farvetema,farvestil,farveskema -X-KDE-Keywords[de]=Farben,Schema,Kontrast,Farbschema,Elemente -X-KDE-Keywords[el]=χρώματα,χρώματα,σχήμα,αντίθεση,χρώματα γραφικών συστατικών,χρωματικό σχήμα,χρωματικό στιλ,θέμα χρώματος -X-KDE-Keywords[en_GB]=colours,scheme,contrast,Widget colours,Colour Scheme,colour style,colour theme -X-KDE-Keywords[es]=colores,esquema,contraste,colores de elementos gráficos,Esquema de color,estilo de color,tema de color -X-KDE-Keywords[et]=värv,värvid,skeem,kontrast,vidina värvid,värviskeem,värvistiil,värviteema -X-KDE-Keywords[eu]=kolore,koloreak,eskema,kontraste,trepetaren koloreak,kolore-eskema,kolore-estilo, kolorearen gai -X-KDE-Keywords[fi]=värit,teema,kontrasti,käyttöliittymäelementtien värit,elementtien värit,väriteema,värityyli -X-KDE-Keywords[fr]=couleurs, couleurs, schéma, contraste, couleur des composants graphiques, schéma de couleur, style de couleur, thème de couleur -X-KDE-Keywords[ga]=dathanna,scéim,codarsnacht,dathanna Giuirléidí,Scéim Datha,téama datha -X-KDE-Keywords[gl]=cores,esquema,contraste,cores do trebello,esquema de cores, tema de cores -X-KDE-Keywords[he]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,צבעים,ערכת נושא,צבע -X-KDE-Keywords[hu]=színek,színek,séma,kontraszt,Grafikai elemek színei,Színséma,színstílus,színtéma -X-KDE-Keywords[ia]=colores,colores,schema,contrasto,colores de Widget,Schema de Color,stilo de color, thema de color -X-KDE-Keywords[id]=warna,warna,skema,kontras,Widget warna,Skema Warna,gaya warna,tema warna -X-KDE-Keywords[it]=colori,schema,contrasto,colore degli oggetti,schema di colore,stile colore,tema colore -X-KDE-Keywords[kk]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[km]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[ko]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,색,색 배열,고대비 -X-KDE-Keywords[mr]=रंग, रंग, योजना, कॉन्ट्रास्ट, विजेट रंग, रंगयोजना, रंगप्रकार, रंगशैली -X-KDE-Keywords[nb]=farger,oppsett,kontrast,elementfarger,fargeoppsett,fargestil,fargetema -X-KDE-Keywords[nds]=Klöör,Klören,Schema,Kontrast,Lüttprogramm-Klören,Klöörschema,Klöörstil,Klöörmuster -X-KDE-Keywords[nl]=colors,colours, kleuren,scheme,schema,contrast,Widget colors,Widgetkleuren,Color Scheme,kleurschema,kleurstijl,kleurthema -X-KDE-Keywords[nn]=fargar,oppsett,kontrast,elementfargar,fargeoppsett,fargestil,fargetema -X-KDE-Keywords[pa]=ਰੰਗ,ਸਕੀਮ,ਕਨਟਰਾਸਟ,ਵਿਜੈਟ ਰੰਗ,ਰੰਗ ਸਕੀ,ਰੰਗ ਸਟਾਈਲ,ਰੰਗ ਥੀਮ -X-KDE-Keywords[pl]=kolory,schemat,kontrast,kolory elementów interfejsu,zestaw kolorów,styl kolorów,motyw kolorów -X-KDE-Keywords[pt]=cores,esquema,contraste,cores dos elementos,esquema de cores,estilo de cores,tema de cores -X-KDE-Keywords[pt_BR]=cor,cores,esquema,contraste,Cores do widget,Esquema de cores,estilo de cores,tema de cores -X-KDE-Keywords[ru]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,цвет,цвета,схема,контраст,цвета виджета,цветовая схема,цветовой стиль,цветовая тема -X-KDE-Keywords[sk]=farba,farby,schéma,kontrast,farby widgetov,Farebná schéma,štýl farieb,téma farieb -X-KDE-Keywords[sl]=barve,shema,tema,kontrast,barve gradnikov,barvna shema,barvna tema,barvni slog -X-KDE-Keywords[sr]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,боје,шема,контраст,боје виџета,шема боја,стил боја,тема боја -X-KDE-Keywords[sr@ijekavian]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,боје,шема,контраст,боје виџета,шема боја,стил боја,тема боја -X-KDE-Keywords[sr@ijekavianlatin]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,boje,šema,kontrast,boje vidžeta,šema boja,stil boja,tema boja -X-KDE-Keywords[sr@latin]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,boje,šema,kontrast,boje vidžeta,šema boja,stil boja,tema boja -X-KDE-Keywords[sv]=färger,schema,kontrast,Komponentfärger,Färgschema,färgstil,färgtema -X-KDE-Keywords[tr]=renkler,renk,şema,karşıtlık,kontrast,Gereç renkleri,RenkŞeması,renk biçemi,renk teması,renk biçimi -X-KDE-Keywords[uk]=кольори,кольори,схема,контраст,кольори віджетів,схема кольорів,стиль кольорів,тема кольорів,colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[x-test]=xxcolorsxx,xxcoloursxx,xxschemexx,xxcontrastxx,xxWidget colorsxx,xxColor Schemexx,xxcolor stylexx,xxcolor themexx -X-KDE-Keywords[zh_CN]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,颜色,配色方案,对比度,部件颜色,颜色方案,颜色风格,颜色主题 -X-KDE-Keywords[zh_TW]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme - -Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcms/colors/package/metadata.desktop b/kcms/colors/package/metadata.desktop deleted file mode 100644 --- a/kcms/colors/package/metadata.desktop +++ /dev/null @@ -1,123 +0,0 @@ -[Desktop Entry] -Name=Colors -Name[af]=Kleure -Name[ar]=الألوان -Name[be]=Колеры -Name[be@latin]=Kolery -Name[bg]=Цветове -Name[bn]=রং -Name[bn_IN]=রং -Name[br]=Livioù -Name[bs]=Boje -Name[ca]=Colors -Name[ca@valencia]=Colors -Name[cs]=Barvy -Name[csb]=Farwë -Name[cy]=Lliwiau -Name[da]=Farver -Name[de]=Farben -Name[el]=Χρώματα -Name[en_GB]=Colours -Name[eo]=Koloroj -Name[es]=Colores -Name[et]=Värvid -Name[eu]=Koloreak -Name[fa]=رنگها -Name[fi]=Värit -Name[fr]=Couleurs -Name[fy]=Kleuren -Name[ga]=Dathanna -Name[gl]=Cores -Name[gu]=રંગો -Name[he]=צבעים -Name[hi]=रंग -Name[hne]=रंग -Name[hr]=Boje -Name[hsb]=Barby -Name[hu]=Színek -Name[ia]=Colores -Name[id]=Warna -Name[is]=Litir -Name[it]=Colori -Name[ja]=色 -Name[ka]=ცვეტები -Name[kk]=Түстер -Name[km]=ពណ៌ -Name[kn]=ಬಣ್ಣಗಳು -Name[ko]=색상 -Name[ku]=Reng -Name[lt]=Spalvos -Name[lv]=Krāsas -Name[mai]=रँग -Name[mk]=Бои -Name[ml]=നിറങ്ങള്‍ -Name[mr]=रंग -Name[ms]=Warna -Name[nb]=Farger -Name[nds]=Klören -Name[ne]=रङ -Name[nl]=Kleuren -Name[nn]=Fargar -Name[oc]=Colors -Name[or]=ରଙ୍ଗ -Name[pa]=ਰੰਗ -Name[pl]=Kolory -Name[pt]=Cores -Name[pt_BR]=Cores -Name[ro]=Culori -Name[ru]=Цвета -Name[se]=Ivnnit -Name[si]=වර්‍ණ -Name[sk]=Farby -Name[sl]=Barve -Name[sr]=Боје -Name[sr@ijekavian]=Боје -Name[sr@ijekavianlatin]=Boje -Name[sr@latin]=Boje -Name[sv]=Färger -Name[ta]=வண்ணங்கள் -Name[te]=రంగులు -Name[tg]=Рангҳо -Name[th]=สี -Name[tr]=Renkler -Name[ug]=رەڭلەر -Name[uk]=Кольори -Name[uz]=Ranglar -Name[uz@cyrillic]=Ранглар -Name[vi]=Màu sắc -Name[wa]=Coleurs -Name[xh]=Imibala -Name[x-test]=xxColorsxx -Name[zh_CN]=色彩 -Name[zh_TW]=顏色 -Comment=Choose the color scheme -Comment[ca]=Trieu l'esquema de colors -Comment[ca@valencia]=Trieu l'esquema de colors -Comment[es]=Escoger el esquema de color -Comment[gl]=Escoller o esquema de cores -Comment[it]=Scegli lo schema di colori -Comment[nl]=Kies het kleurenschema -Comment[nn]=Vel fargeoppsett -Comment[pl]=Wybierz zestaw kolorów -Comment[pt]=Escolher o esquema de cores -Comment[pt_BR]=Escolha o esquema de cores -Comment[ru]=Выбор цветовой схемы -Comment[sk]=Vybrať farebnú schému -Comment[sv]=Välj färgschemat -Comment[uk]=Вибір теми кольорів -Comment[x-test]=xxChoose the color schemexx -Comment[zh_CN]=选择配色方案 -Comment[zh_TW]=選擇色彩主題 - -Icon=preferences-desktop-color -Type=Service -X-KDE-PluginInfo-Author=Kai Uwe Broulik -X-KDE-PluginInfo-Email=kde@privat.broulik.de -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-Name=kcm_colors -X-KDE-PluginInfo-Version= -X-KDE-PluginInfo-Website= -X-KDE-ServiceTypes=Plasma/Generic -X-Plasma-API=declarativeappletscript - -X-Plasma-MainScript=ui/main.qml diff --git a/kcms/emoticons/emoticons.desktop b/kcms/emoticons/emoticons.desktop --- a/kcms/emoticons/emoticons.desktop +++ b/kcms/emoticons/emoticons.desktop @@ -93,7 +93,7 @@ Name[x-test]=xxEmoticonsxx Name[zh_CN]=表情符号 Name[zh_TW]=表情圖示 -Comment=Emoticon Theme +Comment=Choose the emoticon theme Comment[ar]=سمة الوجوه التّعبيرية Comment[bs]=Tema emotikona Comment[ca]=Tema d'emoticones diff --git a/kcms/emoticons/emoticonslist.cpp b/kcms/emoticons/emoticonslist.cpp --- a/kcms/emoticons/emoticonslist.cpp +++ b/kcms/emoticons/emoticonslist.cpp @@ -107,7 +107,7 @@ EmoticonList::EmoticonList(QWidget *parent, const QVariantList &args) : KCModule(parent, args) { - KAboutData *about = new KAboutData(QStringLiteral("kcm_emoticons"), i18n("Emoticons"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL); + KAboutData *about = new KAboutData(QStringLiteral("kcm_emoticons"), i18n("Choose the emoticon theme"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL); setAboutData(about); // setButtons(Apply | Help); setupUi(this); diff --git a/kcms/fonts/kcm_fonts.desktop b/kcms/fonts/kcm_fonts.desktop deleted file mode 100644 --- a/kcms/fonts/kcm_fonts.desktop +++ /dev/null @@ -1,199 +0,0 @@ -[Desktop Entry] -Exec=kcmshell5 fonts -Icon=preferences-desktop-font -Type=Service -X-KDE-ServiceTypes=KCModule -X-DocPath=kcontrol/fonts/index.html - -X-KDE-Library=kcm_fonts -X-KDE-ParentApp=kcontrol - -X-KDE-System-Settings-Parent-Category=font -X-KDE-Weight=50 - -Name=Fonts -Name[af]=Skriftipes -Name[ar]=الخطوط -Name[be]=Шрыфты -Name[be@latin]=Šryfty -Name[bg]=Шрифтове -Name[bn]=ফন্ট -Name[bn_IN]=ফন্ট -Name[br]=Fontoù -Name[bs]=Fontovi -Name[ca]=Tipus de lletra -Name[ca@valencia]=Tipus de lletra -Name[cs]=Písma -Name[csb]=Fòntë -Name[cy]=Ffontiau -Name[da]=Skrifttyper -Name[de]=Schriftarten -Name[el]=Γραμματοσειρές -Name[en_GB]=Fonts -Name[eo]=Tiparoj -Name[es]=Tipos de letra -Name[et]=Fondid -Name[eu]=Letra-tipoak -Name[fa]=قلمها -Name[fi]=Fontit -Name[fr]=Polices de caractères -Name[fy]=Lettertypen -Name[ga]=Clónna -Name[gl]=Tipos de letra -Name[gu]=ફોન્ટ્સ -Name[he]=גופנים -Name[hi]=फ़ॉन्ट्स -Name[hne]=फोंट -Name[hr]=Fontovi -Name[hsb]=Pisma -Name[hu]=Betűtípusok -Name[ia]=Fontes -Name[id]=Font -Name[is]=Letur -Name[it]=Caratteri -Name[ja]=フォント -Name[ka]=ფონტები -Name[kk]=Қаріптер -Name[km]=ពុម្ព​អក្សរ -Name[kn]=ಅಕ್ಷರಶೈಲಿಗಳು -Name[ko]=글꼴 -Name[ku]=Curenivîs -Name[lt]=Šriftai -Name[lv]=Fonti -Name[mai]=फान्ट -Name[mk]=Фонтови -Name[ml]=അക്ഷരസഞ്ചയങ്ങള്‍ -Name[mr]=फॉन्ट -Name[ms]=Fon -Name[nb]=Skrifttyper -Name[nds]=Schriftoorden -Name[ne]=फन्ट -Name[nl]=Lettertypen -Name[nn]=Skrifter -Name[oc]=Poliças -Name[or]=ଅକ୍ଷର ରୂପ -Name[pa]=ਫੋਂਟ -Name[pl]=Czcionki -Name[pt]=Tipos de Letra -Name[pt_BR]=Fontes -Name[ro]=Fonturi -Name[ru]=Шрифты -Name[se]=Fonttat -Name[si]=අකුරු -Name[sk]=Písma -Name[sl]=Pisave -Name[sr]=Фонтови -Name[sr@ijekavian]=Фонтови -Name[sr@ijekavianlatin]=Fontovi -Name[sr@latin]=Fontovi -Name[sv]=Teckensnitt -Name[ta]=எழுத்துருக்கள் -Name[te]=ఫాంట్‍స్ -Name[tg]=Ҳарфҳо -Name[th]=แบบอักษรต่างๆ -Name[tr]=Yazı Tipleri -Name[ug]=خەت نۇسخىلىرى -Name[uk]=Шрифти -Name[uz]=Shriftlar -Name[uz@cyrillic]=Шрифтлар -Name[vi]=Phông chữ -Name[wa]=Fontes -Name[xh]=Uhlobo lwamagama -Name[x-test]=xxFontsxx -Name[zh_CN]=字体 -Name[zh_TW]=字型 - -Comment=Configure the system fonts -Comment[ar]=الخطوط -Comment[bs]=Fontovi -Comment[ca]=Tipus de lletra -Comment[ca@valencia]=Tipus de lletra -Comment[cs]=Písma -Comment[da]=Skrifttyper -Comment[de]=Schriftarten -Comment[el]=Γραμματοσειρές -Comment[en_GB]=Fonts -Comment[eo]=Tiparoj -Comment[es]=Tipos de letra -Comment[et]=Fondid -Comment[eu]=Letra-tipoak -Comment[fi]=Fontit -Comment[fr]=Polices de caractères -Comment[gl]=Tipos de letra -Comment[he]=גופנים -Comment[hu]=Betűtípusok -Comment[id]=Font -Comment[is]=Letur -Comment[it]=Caratteri -Comment[ja]=フォント -Comment[ko]=글꼴 -Comment[lt]=Šriftai -Comment[mr]=फॉन्ट -Comment[nb]=Skrifttype -Comment[nds]=Schriftoorden -Comment[nl]=Lettertypen -Comment[nn]=Skrifter -Comment[pa]=ਫੋਂਟ -Comment[pl]=Czcionki -Comment[pt]=Tipos de Letra -Comment[pt_BR]=Fontes -Comment[ru]=Шрифты -Comment[sk]=Písma -Comment[sl]=Pisave -Comment[sr]=Фонтови -Comment[sr@ijekavian]=Фонтови -Comment[sr@ijekavianlatin]=Fontovi -Comment[sr@latin]=Fontovi -Comment[sv]=Teckensnitt -Comment[tr]=Yazı Tipleri -Comment[uk]=Шрифти -Comment[x-test]=xxFontsxx -Comment[zh_CN]=字体 -Comment[zh_TW]=字型 - -X-KDE-Keywords=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts -X-KDE-Keywords[ar]=خطوط,حجم الخط,أنماط,طقم محارف,طقوم محارف,لوحة,لوحة تحكّم,أسطح المكتب,مدير ملفات,أشرطة أدوات,قائمة,عنوان نافذة,عنوان,نقطة/بوصة,DPI,إزالة التسنّن,خطوط سطح المكتب,خطوط شريط الأدوات,محرف,خطوط عامة -X-KDE-Keywords[bs]=slova,veličina slova,stil,znakovi,postaviti znakove,ploča,kontrolna ploča,pozadina,upravitelj datoteka,alatne trake,meni,naslov prozora,naslov,DPI,niskopropusni,slova pozadine,slova na alatnoj traci,obilježja,opći fontovi -X-KDE-Keywords[ca]=tipus de lletres,mida de tipus de lletra,estils,joc de caràcters,jocs de caràcters,plafó,plafó de control,escriptoris,Gestor de fitxers,Barres d'eines,Menú,Títol de la finestra,Títol,DPI,antialiàsing,tipus de lletra d'escriptori,tipus de lletra de barra d'eines,caràcter,tipus de lletra general -X-KDE-Keywords[ca@valencia]=tipus de lletres,mida de tipus de lletra,estils,joc de caràcters,jocs de caràcters,plafó,plafó de control,escriptoris,Gestor de fitxers,Barres d'eines,Menú,Títol de la finestra,Títol,DPI,antialiàsing,tipus de lletra d'escriptori,tipus de lletra de barra d'eines,caràcter,tipus de lletra general -X-KDE-Keywords[da]=skrifttyper,skriftstørrelse,stile,tegnsæt,panel,kontrolpanel,skriveborde,filhåndtering,værktøjslinjer,menu,vinduestitel,titel,DPI,anti-aliasing,værktøjslinjer,tegn -X-KDE-Keywords[de]=Schriftarten,Schriftgrößen,Stile,Zeichensätze,Kontrollleiste,Stile,Dateiverwaltung,Arbeitsflächen,Werkzeugleisten,Menüs,Fenstertitel,Titel,DPI,Antialiasing,Arbeitsflächenschriften,Werkzeugleistenschriften,Zeichen,Allgemeine Schriftarten -X-KDE-Keywords[el]=γραμματοσειρές,μέγεθος γραμματοσειράς,στιλ,σύνολα χαρακτήρων,πίνακας,πίνακας ελέγχου,επιφάνειες εργασίας,διαχειριστής αρχείων,γραμμές εργαλείων,μενού,τίτλος παραθύρου,τίτλος,DPI,εξομάλυνση,γραμματοσειρές επιφάνειας εργασίας,γραμματοσειρές γραμμής εργαλείων,χαρακτήρας,γενικές γραμματοσειρές -X-KDE-Keywords[en_GB]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts -X-KDE-Keywords[es]=tipos de letra,tamaño del tipo de letra,estilos,juegos de caracteres,panel,panel de control panel,escritorios,Gestor de archivos,Barras de herramientas,Menú,Título de la ventana,Título,DPI,suavizado de texto,tipos de letra del escritorio,tipos de letra de las barras de herramientas,carácter,tipos de letra generales -X-KDE-Keywords[et]=fondid,fondi suurus,kodeering,kooditabel,paneel,juhtpaneel,töölauad,failihaldur,tööriistaribad,menüü,aken,tiitel,nimetus,nimi,DPI,antialias,töölaua fondid,tööriistariba fondid,märk,märgid,sümbolid,üldised fondid -X-KDE-Keywords[eu]=letra-tipoak,letra-tamaina,estiloak,karaktere-jokoak,panela,kontrol-panela,mahaigain,fitxategi-kudeatzaile,tresna-barra,menu,leihoaren titulu,titulu,DPI,antialiasing,mahaigaineko letra-tripo,tresna-barrako letra-tipo,karaktere,letra-tipo orokor -X-KDE-Keywords[fi]=kirjasimet,fontit,kirjasinkoko,fonttikoko,tyylit,merkistöt,paneeli,ohjauskeskus,työpöydät,Tiedostonhallinta,Työkalurivit,Työkalupalkit,Valikko,Ikkunan otsikko,Otsikko,DPI,antialiasointi,työpöytäkirjasimet,työpöytäfontit,työkalurivikirjasimet, työkalurivien kirjasimet, työkalurivifontit, työkalurivien fontit,merkki,yleiskirjasimet,yleiset kirjasimet,yleisfontit,yleiset fontit -X-KDE-Keywords[fr]=polices, taille de police, styles, tables de caractères, jeux de caractères, tableau de bord, bureaux, Gestionnaire de Fichiers, Barre d'outils, Menu, Titre de fenêtre, Titre, DPI, anti crénelage, polices du bureau, police de barre d'outils, caractère, polices générales -X-KDE-Keywords[ga]=clónna,clófhoirne,clómhéid,stíleanna,tacair charachtar,painéal,painéal rialaithe,deasca,Bainisteoir Comhad,Barraí Uirlisí,Roghchlár,Teideal Fuinneoige,Teideal,PSO,frithailiasáil,clónna deisce,clófhoirne deisce,clónna barra uirlisí,carachtar,clónna ginearálta,clófhoirne ginearálta -X-KDE-Keywords[gl]=tipo de letra,letra,tamaño de letra,tamaño da letra,codificacións de caracteres,conxuntos de caracteres,panel,control,panel de control,escritorios,xestor de ficheiros,barras de ferramentas,menú,título de xanela,título,DPI,PPP,antialiasing,suavizado,tipos de letra do escritorio,tipos de letra das barras de ferramentas,carácter,tipos de letra xerais -X-KDE-Keywords[hu]=betűkészletek,betűméret,stílusok,karakterkészletek,karakterkészletek,panel,beállítópanel,asztalok,Fájlkezelő,Eszköztárak,Menü,Ablakcím,Cím,DPI,élsimítás,asztal betűkészletek,eszköztár betűkészletek,karakter,általános betűkészletek -X-KDE-Keywords[ia]=fonts,grandor de font,stilos,insimules de characteres,insimules de characteres,pannello,pannello de controlo,scriptorios,Gerente de File,Barra de instrumentos,menu,Titulo de Fenestra,Titulo,DPI,anti-aliasing,fonts de scriptorio, fonts de barra de titulo, character,fonts general -X-KDE-Keywords[id]=fon,ukuran fon,gaya,charset,set karakter,panel,panel kendali,desktop,FileManager,Bilah Alat,Menu,Judul Window,Judul,DPI,anti-alias,font desktop,font bilah alat,karakter,font umum -X-KDE-Keywords[it]=caratteri,dimensione dei caratteri,stili,codifiche,insiemi di caratteri,pannello,pannello di controllo,desktop,gestore dei file,barre degli strumenti,menu,titolo della finestra,titolo,DPI,anti-aliasing,caratteri del desktop,caratteri della barra degli strumenti,carattere,caratteri generali -X-KDE-Keywords[kk]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts -X-KDE-Keywords[km]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts -X-KDE-Keywords[ko]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,글꼴,스타일,창 제목,글자 -X-KDE-Keywords[mr]=फॉन्ट्स, फॉन्ट साईज, कॅरेक्टर, कॅरेक्टर सेटस, पँनल, कन्ट्रोल पँनल, डेस्कटॉप्स, फाईल मेनेजर, टूलबार्स, मेन्यू, चौकट टाईटल, टाईटल, डी पी आय , अन्टी अलायझिंग, डेस्कटॉप फॉन्टस, टूलबार फॉन्टस, कॅरेक्टर, जनरल फॉन्ट्स -X-KDE-Keywords[nb]=skrifter,skriftstørrelse,stiler,tegnsett,panel,kontrollpanel,skrivebord,filbehandler,Verktøylinje,Meny,Vindiustittel,tittel,DPI,kantutjevning,skrivebordsskrifter,verktøylinjeskrifter,generelle skrifter -X-KDE-Keywords[nds]=Schriftoorden,Schrift,Stilen,Tekensetten,Paneel,Stüerpaneel,Schriefdisch,Dateipleger,Warktüüchbalkens,Menü,Finstertitel,Titel,DPI,Kantstreken,anti-aliasing,Schriefdisch,Teken -X-KDE-Keywords[nl]=lettertypes,lettertype,tekengrootte,stijlen,tekensets,paneel,besturingspaneel,bureaubladen,bestandsbeheerder,werkbalken,menu,venstertitel,titel,DPI,anti-aliasing,lettertypen van bureaublad,lettertypen van werkbalk,teken,algemene lettertypes -X-KDE-Keywords[nn]=skrifter,skriftstorleik,stilar,teiknsett,teiknkodingar,panel,kontrollpanel,skrivebord,filhandsamar,verktøylinje,meny,vindaugstittel,tittel,DPI,PPT,kantutjamning,skrivebordsskrifter,verktøylinjeskrifter,generelle skriftar -X-KDE-Keywords[pl]=czcionki,rozmiar czcionki,style,zestaw znaków,panel,panel sterowania,pulpity,Menadżer plików,Paski narzędzi,Menu,Tytuł okna,Tytuł,DPI,wygładzanie,czcionki pulpitu,czcionki pasków narzędzi,znak,czcionki ogólne -X-KDE-Keywords[pt]=tipos de letra,tamanho de letra,estilos,codificações,codificações de caracteres,painel,painel de controlo,ecrãs,gestor de ficheiros,barras de ferramentas,menu,título da janela,título,PPP,suavização,tipos de letra do ecrã,tipos de letra da barra de ferramentas,carácter,tipos de letra gerais -X-KDE-Keywords[pt_BR]=fontes,tamanho da fonte,estilos,codificações,codificações de caracteres,painel,painel de controle,áreas de trabalho,gerenciador de arquivos,barras de ferramentas,Menu,Título da janela,Título,PPP,anti-aliasing,fontes da área de trabalho,fontes da barra de ferramentas,caractere,fontes gerais -X-KDE-Keywords[ru]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,шрифты,размер шрифтов,стили,кодировки,панель,панель управления,рабочие столы,диспетчер файлов,панель инструментов,меню,заголовок окна,заголовок,сглаживание,шрифты рабочего стола,шрифты панели инструментов,символы,общие шрифты -X-KDE-Keywords[sk]=písmo,veľkosť písma,štýly,znakové sady,sady znakov,panel,ovládací panel,plochy,Správca súborov,Panely nástrojov,Ponuka,Titulok okna,Titulok,DPI,anti-aliasing,písma plochy,písma nástrojových panelov,znak,všeobecné písma -X-KDE-Keywords[sl]=pisave,velikost pisav,slogi,nabori znakov,znakovni nabori,pult,nadzorna plošča,namizja,upravljalnik datotek,datotečni upravljalnik,orodjarne,orodne vrstice,meni,naslov okna,naslovna vrstica,naslov,ločljivost,točk na palec,glajenje robov,namizne pisave,pisave namizja,pisave orodjarne, pisave orodne vrstice,znak,splošne pisave -X-KDE-Keywords[sr]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,фонт,величина фонта,стил,кодирање,панел,контролни панел,површ,менаџер фајлова,траке алатки,мени,наслов прозора,тпи,омекшавање,фонт површи,фонт траке алатки,знакови,општи фонт -X-KDE-Keywords[sr@ijekavian]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,фонт,величина фонта,стил,кодирање,панел,контролни панел,површ,менаџер фајлова,траке алатки,мени,наслов прозора,тпи,омекшавање,фонт површи,фонт траке алатки,знакови,општи фонт -X-KDE-Keywords[sr@ijekavianlatin]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,font,veličina fonta,stil,kodiranje,panel,kontrolni panel,površ,menadžer fajlova,trake alatki,meni,naslov prozora,tpi,omekšavanje,font površi,font trake alatki,znakovi,opšti font -X-KDE-Keywords[sr@latin]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,font,veličina fonta,stil,kodiranje,panel,kontrolni panel,površ,menadžer fajlova,trake alatki,meni,naslov prozora,tpi,omekšavanje,font površi,font trake alatki,znakovi,opšti font -X-KDE-Keywords[sv]=teckensnitt,teckenstorlek,stil,teckenuppsättningar,panel,kontrollpanel,skrivbord,Filhanterare,Verktygsrader,Meny,Fönsternamn,Namn,Punkter/tum,kantutjämning,skrivbordsteckensnitt,verktygsradsteckensnitt,tecken,allmänna teckensnitt -X-KDE-Keywords[tr]=yazı tipi,yazı tipi boyutu,karakterler,karakter setleri,panel,denetim paneli,masaüstleri,Dosya Yöneticisi,Araç Çubukları,Menü,Pencere Başlığı,Başlık,DPI,yumuşatma,anti-aliasing,masaüstü yazı tipleri,araç çubuğu yazı tipleri,karakter,genel yazı tipleri,biçemler -X-KDE-Keywords[uk]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,шрифт,шрифти,розмір,розмір шрифту,стиль,стилі,гарнітура,гарнітури,кодування,набір,символ,символи,набір символів,панель,панель керування,стільниця,стільниці,файл,керування,керування файлами,менеджер,панель інструментів,меню,заголовок,заголовок вікна,роздільність,згладжування,шрифти стільниці,шрифти панелі,символ,загальні шрифти -X-KDE-Keywords[x-test]=xxfontsxx,xxfont sizexx,xxstylesxx,xxcharsetsxx,xxcharacter setsxx,xxpanelxx,xxcontrol panelxx,xxdesktopsxx,xxFileManagerxx,xxToolbarsxx,xxMenuxx,xxWindow Titlexx,xxTitlexx,xxDPIxx,xxanti-aliasingxx,xxdesktop fontsxx,xxtoolbar fontsxx,xxcharacterxx,xxgeneral fontsxx -X-KDE-Keywords[zh_CN]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts,字体字体大小,样式,字符集,面板,控制面板,桌面,文件管理器,工具栏,菜单,窗口标题,标题,反锯齿,桌面字体,工具栏字体,字符,常规字体 -X-KDE-Keywords[zh_TW]=fonts,font size,styles,charsets,character sets,panel,control panel,desktops,FileManager,Toolbars,Menu,Window Title,Title,DPI,anti-aliasing,desktop fonts,toolbar fonts,character,general fonts - -Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcms/fonts/package/metadata.desktop b/kcms/fonts/package/metadata.desktop deleted file mode 100644 --- a/kcms/fonts/package/metadata.desktop +++ /dev/null @@ -1,155 +0,0 @@ -[Desktop Entry] -Name=Fonts -Name[af]=Skriftipes -Name[ar]=الخطوط -Name[be]=Шрыфты -Name[be@latin]=Šryfty -Name[bg]=Шрифтове -Name[bn]=ফন্ট -Name[bn_IN]=ফন্ট -Name[br]=Fontoù -Name[bs]=Fontovi -Name[ca]=Tipus de lletra -Name[ca@valencia]=Tipus de lletra -Name[cs]=Písma -Name[csb]=Fòntë -Name[cy]=Ffontiau -Name[da]=Skrifttyper -Name[de]=Schriftarten -Name[el]=Γραμματοσειρές -Name[en_GB]=Fonts -Name[eo]=Tiparoj -Name[es]=Tipos de letra -Name[et]=Fondid -Name[eu]=Letra-tipoak -Name[fa]=قلمها -Name[fi]=Fontit -Name[fr]=Polices de caractères -Name[fy]=Lettertypen -Name[ga]=Clónna -Name[gl]=Tipos de letra -Name[gu]=ફોન્ટ્સ -Name[he]=גופנים -Name[hi]=फ़ॉन्ट्स -Name[hne]=फोंट -Name[hr]=Fontovi -Name[hsb]=Pisma -Name[hu]=Betűtípusok -Name[ia]=Fontes -Name[id]=Font -Name[is]=Letur -Name[it]=Caratteri -Name[ja]=フォント -Name[ka]=ფონტები -Name[kk]=Қаріптер -Name[km]=ពុម្ព​អក្សរ -Name[kn]=ಅಕ್ಷರಶೈಲಿಗಳು -Name[ko]=글꼴 -Name[ku]=Curenivîs -Name[lt]=Šriftai -Name[lv]=Fonti -Name[mai]=फान्ट -Name[mk]=Фонтови -Name[ml]=അക്ഷരസഞ്ചയങ്ങള്‍ -Name[mr]=फॉन्ट -Name[ms]=Fon -Name[nb]=Skrifttyper -Name[nds]=Schriftoorden -Name[ne]=फन्ट -Name[nl]=Lettertypen -Name[nn]=Skrifter -Name[oc]=Poliças -Name[or]=ଅକ୍ଷର ରୂପ -Name[pa]=ਫੋਂਟ -Name[pl]=Czcionki -Name[pt]=Tipos de Letra -Name[pt_BR]=Fontes -Name[ro]=Fonturi -Name[ru]=Шрифты -Name[se]=Fonttat -Name[si]=අකුරු -Name[sk]=Písma -Name[sl]=Pisave -Name[sr]=Фонтови -Name[sr@ijekavian]=Фонтови -Name[sr@ijekavianlatin]=Fontovi -Name[sr@latin]=Fontovi -Name[sv]=Teckensnitt -Name[ta]=எழுத்துருக்கள் -Name[te]=ఫాంట్‍స్ -Name[tg]=Ҳарфҳо -Name[th]=แบบอักษรต่างๆ -Name[tr]=Yazı Tipleri -Name[ug]=خەت نۇسخىلىرى -Name[uk]=Шрифти -Name[uz]=Shriftlar -Name[uz@cyrillic]=Шрифтлар -Name[vi]=Phông chữ -Name[wa]=Fontes -Name[xh]=Uhlobo lwamagama -Name[x-test]=xxFontsxx -Name[zh_CN]=字体 -Name[zh_TW]=字型 - -Comment=Configure the system fonts -Comment[ar]=الخطوط -Comment[bs]=Fontovi -Comment[ca]=Tipus de lletra -Comment[ca@valencia]=Tipus de lletra -Comment[cs]=Písma -Comment[da]=Skrifttyper -Comment[de]=Schriftarten -Comment[el]=Γραμματοσειρές -Comment[en_GB]=Fonts -Comment[eo]=Tiparoj -Comment[es]=Tipos de letra -Comment[et]=Fondid -Comment[eu]=Letra-tipoak -Comment[fi]=Fontit -Comment[fr]=Polices de caractères -Comment[gl]=Tipos de letra -Comment[he]=גופנים -Comment[hu]=Betűtípusok -Comment[id]=Font -Comment[is]=Letur -Comment[it]=Caratteri -Comment[ja]=フォント -Comment[ko]=글꼴 -Comment[lt]=Šriftai -Comment[mr]=फॉन्ट -Comment[nb]=Skrifttype -Comment[nds]=Schriftoorden -Comment[nl]=Lettertypen -Comment[nn]=Skrifter -Comment[pa]=ਫੋਂਟ -Comment[pl]=Czcionki -Comment[pt]=Tipos de Letra -Comment[pt_BR]=Fontes -Comment[ru]=Шрифты -Comment[sk]=Písma -Comment[sl]=Pisave -Comment[sr]=Фонтови -Comment[sr@ijekavian]=Фонтови -Comment[sr@ijekavianlatin]=Fontovi -Comment[sr@latin]=Fontovi -Comment[sv]=Teckensnitt -Comment[tr]=Yazı Tipleri -Comment[uk]=Шрифти -Comment[x-test]=xxFontsxx -Comment[zh_CN]=字体 -Comment[zh_TW]=字型 - -Icon=preferences-desktop-font -Keywords= -Type=Service -X-KDE-ParentApp= -X-KDE-PluginInfo-Author=Antonis Tsiapaliokas -X-KDE-PluginInfo-Email=antonis.tsiapaliokas@kde.org -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-Name=kcm_fonts -X-KDE-PluginInfo-Version= -X-KDE-PluginInfo-Website=https://www.kde.org/plasma-desktop -X-KDE-ServiceTypes=Plasma/Generic -X-Plasma-API=declarativeappletscript - -X-Plasma-MainScript=ui/main.qml diff --git a/kcms/icons/kcm_icons.desktop b/kcms/icons/kcm_icons.desktop --- a/kcms/icons/kcm_icons.desktop +++ b/kcms/icons/kcm_icons.desktop @@ -103,7 +103,7 @@ Name[zh_CN]=图标 Name[zh_TW]=圖示 -Comment=Icon Theme +Comment=Choose the icon theme Comment[ar]=سمة الأيقونات Comment[bs]=Tema ikone Comment[ca]=Tema d'icones diff --git a/kcms/icons/main.cpp b/kcms/icons/main.cpp --- a/kcms/icons/main.cpp +++ b/kcms/icons/main.cpp @@ -82,7 +82,7 @@ // to be able to access its enums qmlRegisterUncreatableType("org.kde.private.kcms.icons", 1, 0, "KIconLoader", QString()); - KAboutData* about = new KAboutData(QStringLiteral("kcm5_icons"), i18n("Icons"), QStringLiteral("1.0"), + KAboutData* about = new KAboutData(QStringLiteral("kcm5_icons"), i18n("Choose the icon theme"), QStringLiteral("1.0"), i18n("Icons Control Panel Module"), KAboutLicense::GPL, i18n("(c) 2000-2003 Geert Jansen")); about->addAuthor(i18n("Geert Jansen"), QString(), QStringLiteral("jansen@kde.org")); diff --git a/kcms/icons/package/metadata.desktop b/kcms/icons/package/metadata.desktop --- a/kcms/icons/package/metadata.desktop +++ b/kcms/icons/package/metadata.desktop @@ -90,7 +90,7 @@ Name[x-test]=xxIconsxx Name[zh_CN]=图标 Name[zh_TW]=圖示 -Comment=Icon Theme +Comment=Choose the icon theme Comment[ar]=سمة الأيقونات Comment[bs]=Tema ikone Comment[ca]=Tema d'icones diff --git a/kcms/kfontinst/kcmfontinst/FontFilter.cpp b/kcms/kfontinst/kcmfontinst/FontFilter.cpp deleted file mode 100644 --- a/kcms/kfontinst/kcmfontinst/FontFilter.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/* - * KFontInst - KDE Font Installer - * - * Copyright 2003-2007 Craig Drummond - * - * ---- - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "FontFilter.h" -#include "FontFilterProxyStyle.h" -#include "FontList.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace KFI -{ - -static const int constArrowPad(5); - -static void deselectCurrent(QActionGroup *act) -{ - QAction *prev(act->checkedAction()); - if(prev) - prev->setChecked(false); -} - -static void deselectCurrent(KSelectAction *act) -{ - deselectCurrent(act->selectableActionGroup()); -} - -// FIXME: Go back to using StyleSheets instead of a proxy style -// once Qt has been fixed not to mess with widget font when -// using StyleSheets -class CFontFilterStyle : public CFontFilterProxyStyle -{ - public: - - CFontFilterStyle(CFontFilter *parent, int ol) : CFontFilterProxyStyle(parent), overlap(ol) {} - - QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override; - - int overlap; -}; - -QRect CFontFilterStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const -{ - if (SE_LineEditContents==element) - { - QRect rect(style()->subElementRect(SE_LineEditContents, option, widget)); - - return rect.adjusted(overlap, 0, -overlap, 0); - } - - return CFontFilterProxyStyle::subElementRect(element, option, widget); -} - -struct SortAction -{ - SortAction(QAction *a) : action(a) { } - bool operator<(const SortAction &o) const { return action->text().localeAwareCompare(o.action->text())<0; } - QAction *action; -}; - -static void sortActions(KSelectAction *group) -{ - if(group->actions().count()>1) - { - QList actions=group->actions(); - QList::ConstIterator it(actions.constBegin()), - end(actions.constEnd()); - QList sorted; - - for(; it!=end; ++it) - { - sorted.append(SortAction(*it)); - group->removeAction(*it); - } - - qSort(sorted); - QList::ConstIterator s(sorted.constBegin()), - sEnd(sorted.constEnd()); - - for(; s!=sEnd; ++s) - group->addAction((*s).action); - } -} - -CFontFilter::CFontFilter(QWidget *parent) - : KLineEdit(parent) -{ - setClearButtonShown(true); - setTrapReturnKey(true); - - itsMenuButton = new QLabel(this); - itsMenuButton->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - itsMenuButton->setCursor(Qt::ArrowCursor); - itsMenuButton->setToolTip(i18n("Set Criteria")); - - itsMenu=new QMenu(this); - itsPixmaps[CRIT_FAMILY]=SmallIcon("draw-text"); - itsPixmaps[CRIT_STYLE]=SmallIcon("format-text-bold"); - itsPixmaps[CRIT_FOUNDRY]=SmallIcon("user-identity"); - itsPixmaps[CRIT_FONTCONFIG]=SmallIcon("system-search"); - itsPixmaps[CRIT_FILETYPE]=SmallIcon("preferences-desktop-font-installer"); - itsPixmaps[CRIT_FILENAME]=SmallIcon("application-x-font-type1"); - itsPixmaps[CRIT_LOCATION]=SmallIcon("folder"); - itsPixmaps[CRIT_WS]=SmallIcon("character-set"); - - itsActionGroup=new QActionGroup(this); - addAction(CRIT_FAMILY, i18n("Family"), true); - addAction(CRIT_STYLE, i18n("Style"), false); - - KSelectAction *foundryMenu=new KSelectAction(QIcon(itsPixmaps[CRIT_FOUNDRY]), i18n("Foundry"), this); - itsActions[CRIT_FOUNDRY]=foundryMenu; - itsMenu->addAction(itsActions[CRIT_FOUNDRY]); - foundryMenu->setData((int)CRIT_FOUNDRY); - foundryMenu->setVisible(false); - connect(foundryMenu, SIGNAL(triggered(QString)), SLOT(foundryChanged(QString))); - - addAction(CRIT_FONTCONFIG, i18n("FontConfig Match"), false); - - KSelectAction *ftMenu=new KSelectAction(QIcon(itsPixmaps[CRIT_FILETYPE]), i18n("File Type"), this); - itsActions[CRIT_FILETYPE]=ftMenu; - itsMenu->addAction(itsActions[CRIT_FILETYPE]); - ftMenu->setData((int)CRIT_FILETYPE); - - QStringList::ConstIterator it(CFontList::fontMimeTypes.constBegin()), - end(CFontList::fontMimeTypes.constEnd()); - QMimeDatabase db; - for(; it!=end; ++it) - if((*it)!="application/vnd.kde.fontspackage") - { - QMimeType mime = db.mimeTypeForName(*it); - - KToggleAction *act=new KToggleAction(QIcon::fromTheme(mime.iconName()), mime.comment(), this); - - ftMenu->addAction(act); - act->setChecked(false); - - QStringList mimes; - foreach (QString pattern, mime.globPatterns()) - mimes.append(pattern.remove(QStringLiteral("*."))); - act->setData(mimes); - } - - sortActions(ftMenu); - connect(ftMenu, SIGNAL(triggered(QString)), SLOT(ftChanged(QString))); - itsCurrentFileTypes.clear(); - - addAction(CRIT_FILENAME, i18n("File Name"), false); - addAction(CRIT_LOCATION, i18n("File Location"), false); - - KSelectAction *wsMenu=new KSelectAction(QIcon(itsPixmaps[CRIT_WS]), i18n("Writing System"), this); - itsActions[CRIT_WS]=wsMenu; - itsMenu->addAction(itsActions[CRIT_WS]); - wsMenu->setData((int)CRIT_WS); - - itsCurrentWs=QFontDatabase::Any; - for(int i=QFontDatabase::Latin; iaddAction(wsAct); - wsAct->setChecked(false); - wsAct->setData(i); - } - sortActions(wsMenu); - connect(wsMenu, SIGNAL(triggered(QString)), SLOT(wsChanged(QString))); - - setCriteria(CRIT_FAMILY); - setStyle(new CFontFilterStyle(this, itsMenuButton->width())); -} - -void CFontFilter::setFoundries(const QSet ¤tFoundries) -{ - QAction *act(((KSelectAction *)itsActions[CRIT_FOUNDRY])->currentAction()); - QString prev(act && act->isChecked() ? act->text() : QString()); - bool changed(false); - QList prevFoundries(((KSelectAction *)itsActions[CRIT_FOUNDRY])->actions()); - QList::ConstIterator fIt(prevFoundries.constBegin()), - fEnd(prevFoundries.constEnd()); - QSet foundries(currentFoundries); - - // Determine which of 'foundries' are new ones, and which old ones need to be removed... - for(; fIt!=fEnd; ++fIt) - { - if(foundries.contains((*fIt)->text())) - foundries.remove((*fIt)->text()); - else - { - ((KSelectAction *)itsActions[CRIT_FOUNDRY])->removeAction(*fIt); - (*fIt)->deleteLater(); - changed=true; - } - } - - if(!foundries.isEmpty()) - { - // Add foundries to menu - replacing '&' with '&&', as '&' is taken to be - // a shortcut! - QSet::ConstIterator it(foundries.begin()), - end(foundries.end()); - - for(; it!=end; ++it) - { - QString foundry(*it); - - foundry.replace("&", "&&"); - ((KSelectAction *)itsActions[CRIT_FOUNDRY])->addAction(foundry); - } - changed=true; - } - - if(changed) - { - sortActions((KSelectAction *)itsActions[CRIT_FOUNDRY]); - if(!prev.isEmpty()) - { - act=((KSelectAction *)itsActions[CRIT_FOUNDRY])->action(prev); - if(act) - ((KSelectAction *)itsActions[CRIT_FOUNDRY])->setCurrentAction(act); - else - ((KSelectAction *)itsActions[CRIT_FOUNDRY])->setCurrentItem(0); - } - - itsActions[CRIT_FOUNDRY]->setVisible(((KSelectAction *)itsActions[CRIT_FOUNDRY])->actions().count()); - } -} - -QSize CFontFilter::sizeHint() const -{ - return QSize(fontMetrics().width(placeholderText())+56, KLineEdit::sizeHint().height()); -} - -void CFontFilter::filterChanged() -{ - QAction *act(itsActionGroup->checkedAction()); - - if(act) - { - ECriteria crit((ECriteria)act->data().toInt()); - - if(itsCurrentCriteria!=crit) - { - deselectCurrent((KSelectAction *)itsActions[CRIT_FOUNDRY]); - deselectCurrent((KSelectAction *)itsActions[CRIT_FILETYPE]); - deselectCurrent((KSelectAction *)itsActions[CRIT_WS]); - setText(QString()); - itsCurrentWs=QFontDatabase::Any; - itsCurrentFileTypes.clear(); - - setCriteria(crit); - setPlaceholderText(i18n("Filter by %1...", act->text().toLower())); - setReadOnly(false); - } - } -} - -void CFontFilter::ftChanged(const QString &ft) -{ - deselectCurrent((KSelectAction *)itsActions[CRIT_FOUNDRY]); - deselectCurrent((KSelectAction *)itsActions[CRIT_WS]); - deselectCurrent(itsActionGroup); - - QAction *act(((KSelectAction *)itsActions[CRIT_FILETYPE])->currentAction()); - - if(act) - itsCurrentFileTypes=act->data().toStringList(); - itsCurrentCriteria=CRIT_FILETYPE; - setReadOnly(true); - setCriteria(itsCurrentCriteria); - setText(ft); - setPlaceholderText(text()); -} - -void CFontFilter::wsChanged(const QString &writingSystemName) -{ - deselectCurrent((KSelectAction *)itsActions[CRIT_FOUNDRY]); - deselectCurrent((KSelectAction *)itsActions[CRIT_FILETYPE]); - deselectCurrent(itsActionGroup); - - QAction *act(((KSelectAction *)itsActions[CRIT_WS])->currentAction()); - - if(act) - itsCurrentWs=(QFontDatabase::WritingSystem)act->data().toInt(); - itsCurrentCriteria=CRIT_WS; - setReadOnly(true); - setCriteria(itsCurrentCriteria); - setText(writingSystemName); - setPlaceholderText(text()); -} - -void CFontFilter::foundryChanged(const QString &foundry) -{ - deselectCurrent((KSelectAction *)itsActions[CRIT_WS]); - deselectCurrent((KSelectAction *)itsActions[CRIT_FILETYPE]); - deselectCurrent(itsActionGroup); - - itsCurrentCriteria=CRIT_FOUNDRY; - setReadOnly(true); - setText(foundry); - setPlaceholderText(text()); - setCriteria(itsCurrentCriteria); -} - -void CFontFilter::addAction(ECriteria crit, const QString &text, bool on) -{ - itsActions[crit]=new KToggleAction(QIcon(itsPixmaps[crit]), - text, this); - itsMenu->addAction(itsActions[crit]); - itsActionGroup->addAction(itsActions[crit]); - itsActions[crit]->setData((int)crit); - itsActions[crit]->setChecked(on); - if(on) - setPlaceholderText(i18n("Type here to filter on %1", text.toLower())); - connect(itsActions[crit], SIGNAL(toggled(bool)), SLOT(filterChanged())); -} - -void CFontFilter::resizeEvent(QResizeEvent *ev) -{ - KLineEdit::resizeEvent(ev); - - int frameWidth(style()->pixelMetric(QStyle::PM_DefaultFrameWidth)), - y((height()-itsMenuButton->height())/2); - - if (qApp->isLeftToRight()) - itsMenuButton->move(frameWidth + 2, y); - else - itsMenuButton->move(size().width() - frameWidth - itsMenuButton->width() - 2, y); -} - -void CFontFilter::mousePressEvent(QMouseEvent *ev) -{ - if(Qt::LeftButton==ev->button() && itsMenuButton->underMouse()) - itsMenu->popup(mapToGlobal(QPoint(0, height())), nullptr); - else - KLineEdit::mousePressEvent(ev); -} - -void CFontFilter::setCriteria(ECriteria crit) -{ - QPixmap arrowmap(itsPixmaps[crit].width()+constArrowPad, itsPixmaps[crit].height()); - - QColor bgnd(palette().color(QPalette::Active, QPalette::Base)); - bgnd.setAlphaF(0.0); - arrowmap.fill(bgnd); - - QPainter p(&arrowmap); - - p.drawPixmap(0, 0, itsPixmaps[crit]); - QStyleOption opt; - opt.state = QStyle::State_Enabled; - opt.rect = QRect(arrowmap.width()-(constArrowPad+1), arrowmap.height()-(constArrowPad+1), constArrowPad, constArrowPad); - style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &opt, &p, itsMenuButton); - p.end(); - - itsMenuButton->setPixmap(arrowmap); - itsMenuButton->resize(arrowmap.width(), arrowmap.height()); - itsCurrentCriteria=crit; - - emit criteriaChanged(crit, ((qulonglong)1) << (int)itsCurrentWs, itsCurrentFileTypes); -} - -} - diff --git a/kcms/kfontinst/kcmfontinst/KCmFontInst.cpp b/kcms/kfontinst/kcmfontinst/KCmFontInst.cpp --- a/kcms/kfontinst/kcmfontinst/KCmFontInst.cpp +++ b/kcms/kfontinst/kcmfontinst/KCmFontInst.cpp @@ -185,7 +185,7 @@ KIconLoader::global()->addAppDir(KFI_NAME); - KAboutData *about = new KAboutData(QStringLiteral("fontinst"), i18n("KDE Font Manager"), QStringLiteral("1.0"), QString(), + KAboutData *about = new KAboutData(QStringLiteral("fontinst"), i18n("Install, preview and remove fonts"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL, i18n("(C) Craig Drummond, 2000 - 2009")); about->addAuthor(i18n("Craig Drummond"), i18n("Developer and maintainer"), QStringLiteral("craig@kde.org")); setAboutData(about); diff --git a/kcms/kfontinst/kcmfontinst/fontinst.desktop b/kcms/kfontinst/kcmfontinst/fontinst.desktop --- a/kcms/kfontinst/kcmfontinst/fontinst.desktop +++ b/kcms/kfontinst/kcmfontinst/fontinst.desktop @@ -68,7 +68,7 @@ Name[zh_CN]=字体管理 Name[zh_TW]=字型管理 -Comment=Font Installation, Preview and Removal +Comment=Install, preview and remove fonts Comment[ar]=ثبّت الخطوط، وعاينها وأزلها Comment[bs]=Instalacija fonta, pregled i uklanjanje Comment[ca]=Instal·lació, vista prèvia i eliminació dels tipus de lletra diff --git a/kcms/style/kcmstyle.cpp b/kcms/style/kcmstyle.cpp --- a/kcms/style/kcmstyle.cpp +++ b/kcms/style/kcmstyle.cpp @@ -170,7 +170,7 @@ KGlobal::dirs()->addResourceType("themes", "data", "kstyle/themes"); KAboutData *about = - new KAboutData( QStringLiteral("kcmstyle"), i18n("KDE Style Module"), QStringLiteral("1.0"), + new KAboutData( QStringLiteral("kcmstyle"), i18n("Configure widget style and behavior"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL, i18n("(c) 2002 Karol Szwed, Daniel Molkentin")); diff --git a/kcms/style/style.desktop b/kcms/style/style.desktop --- a/kcms/style/style.desktop +++ b/kcms/style/style.desktop @@ -58,7 +58,7 @@ Name[x-test]=xxWidget Stylexx Name[zh_CN]=部件风格 Name[zh_TW]=元件樣式 -Comment=Widget Style and Behavior +Comment=Configure widget style and behavior Comment[ar]=نمط الودجات وسلوكها Comment[bs]=Stil i ponašanje grafičke kontrole Comment[ca]=Estil i comportament dels estris