diff --git a/kcms/activities/PrivacyTab.cpp b/kcms/activities/PrivacyTab.cpp index f1c3cee24..c64056af1 100644 --- a/kcms/activities/PrivacyTab.cpp +++ b/kcms/activities/PrivacyTab.cpp @@ -1,225 +1,230 @@ /* * Copyright (C) 2012 - 2016 by Ivan Cukic * * 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) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * 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, see . */ #include "PrivacyTab.h" #include #include #include #include #include #include #include #include +#include #include "ui_PrivacyTabBase.h" #include "BlacklistedApplicationsModel.h" #include "definitions.h" #include #include "kactivities-kcm-features.h" #include "common/dbus/common.h" #include "utils.h" class PrivacyTab::Private : public Ui::PrivacyTabBase { public: KSharedConfig::Ptr mainConfig; KSharedConfig::Ptr pluginConfig; BlacklistedApplicationsModel *blacklistedApplicationsModel; QObject *viewBlacklistedApplicationsRoot; std::unique_ptr viewBlacklistedApplications; Private() : viewBlacklistedApplicationsRoot(nullptr) , viewBlacklistedApplications(nullptr) { } }; PrivacyTab::PrivacyTab(QWidget *parent) : QWidget(parent) , d() { d->setupUi(this); d->mainConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerdrc")); d->pluginConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerd-pluginsrc")); // Keep history initialization d->spinKeepHistory->setRange(0, INT_MAX); - d->spinKeepHistory->setSpecialValueText(i18nc("unlimited number of months", "forever")); + d->spinKeepHistory->setSpecialValueText(i18nc("unlimited number of months", "Forever")); connect(d->spinKeepHistory, SIGNAL(valueChanged(int)), this, SLOT(spinKeepHistoryValueChanged(int))); spinKeepHistoryValueChanged(0); // Clear recent history button auto menu = new QMenu(this); connect(menu->addAction(i18n("Forget the last hour")), &QAction::triggered, this, &PrivacyTab::forgetLastHour); connect(menu->addAction(i18n("Forget the last two hours")), &QAction::triggered, this, &PrivacyTab::forgetTwoHours); connect(menu->addAction(i18n("Forget a day")), &QAction::triggered, this, &PrivacyTab::forgetDay); connect(menu->addAction(i18n("Forget everything")), &QAction::triggered, this, &PrivacyTab::forgetAll); d->buttonClearRecentHistory->setMenu(menu); // Blacklist applications d->blacklistedApplicationsModel = new BlacklistedApplicationsModel(this); new QGridLayout(d->viewBlacklistedApplicationsContainer); d->viewBlacklistedApplications = createView(d->viewBlacklistedApplicationsContainer); d->viewBlacklistedApplications->rootContext()->setContextProperty( QStringLiteral("applicationModel"), d->blacklistedApplicationsModel); setViewSource(d->viewBlacklistedApplications, QStringLiteral("/qml/privacyTab/BlacklistApplicationView.qml")); // React to changes connect(d->radioRememberAllApplications, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(d->radioDontRememberApplications, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(d->spinKeepHistory, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); connect(d->blacklistedApplicationsModel, SIGNAL(changed()), this, SIGNAL(changed())); connect(d->radioRememberSpecificApplications, SIGNAL(toggled(bool)), d->blacklistedApplicationsModel, SLOT(setEnabled(bool))); connect(d->radioRememberSpecificApplications, SIGNAL(toggled(bool)), d->viewBlacklistedApplicationsContainer, SLOT(setEnabled(bool))); connect(d->radioRememberSpecificApplications, SIGNAL(toggled(bool)), d->checkBlacklistAllNotOnList, SLOT(setEnabled(bool))); defaults(); d->checkBlacklistAllNotOnList->setEnabled(false); d->blacklistedApplicationsModel->setEnabled(false); d->viewBlacklistedApplicationsContainer->setEnabled(false); + + d->messageWidget->setVisible(false); } PrivacyTab::~PrivacyTab() { } void PrivacyTab::defaults() { d->radioRememberAllApplications->click(); d->spinKeepHistory->setValue(0); d->blacklistedApplicationsModel->defaults(); } void PrivacyTab::load() { d->blacklistedApplicationsModel->load(); const auto statisticsConfig = d->pluginConfig->group(SQLITE_PLUGIN_CONFIG_KEY); const auto whatToRemember = static_cast(statisticsConfig.readEntry( "what-to-remember", static_cast(AllApplications))); d->radioRememberAllApplications->setChecked(whatToRemember == AllApplications); d->radioRememberSpecificApplications->setChecked(whatToRemember == SpecificApplications); d->radioDontRememberApplications->setChecked(whatToRemember == NoApplications); d->spinKeepHistory->setValue( statisticsConfig.readEntry("keep-history-for", 0)); d->checkBlacklistAllNotOnList->setChecked( statisticsConfig.readEntry("blocked-by-default", false)); } void PrivacyTab::save() { d->blacklistedApplicationsModel->save(); auto statisticsConfig = d->pluginConfig->group(SQLITE_PLUGIN_CONFIG_KEY); const auto whatToRemember = d->radioRememberSpecificApplications->isChecked() ? SpecificApplications : d->radioDontRememberApplications->isChecked() ? NoApplications : /* otherwise */ AllApplications; statisticsConfig.writeEntry("what-to-remember", static_cast(whatToRemember)); statisticsConfig.writeEntry("keep-history-for", d->spinKeepHistory->value()); statisticsConfig.writeEntry("blocked-by-default", d->checkBlacklistAllNotOnList->isChecked()); statisticsConfig.sync(); auto pluginListConfig = d->mainConfig->group("Plugins"); pluginListConfig.writeEntry("org.kde.ActivityManager.ResourceScoringEnabled", whatToRemember != NoApplications); pluginListConfig.sync(); } void PrivacyTab::forget(int count, const QString &what) { KAMD_DBUS_DECL_INTERFACE(rankingsservice, Resources/Scoring, ResourcesScoring); rankingsservice.asyncCall(QStringLiteral("DeleteRecentStats"), QString(), count, what); + + d->messageWidget->animatedShow(); } void PrivacyTab::forgetLastHour() { forget(1, QStringLiteral("h")); } void PrivacyTab::forgetTwoHours() { forget(2, QStringLiteral("h")); } void PrivacyTab::forgetDay() { forget(1, QStringLiteral("d")); } void PrivacyTab::forgetAll() { forget(0, QStringLiteral("everything")); } void PrivacyTab::spinKeepHistoryValueChanged(int value) { static auto months = ki18ncp("unit of time. months to keep the history", " month", " months"); if (value) { d->spinKeepHistory->setPrefix( - i18nc("for in 'keep history for 5 months'", "for ")); + i18nc("for in 'keep history for 5 months'", "For ")); d->spinKeepHistory->setSuffix(months.subs(value).toString()); } } diff --git a/kcms/activities/imports/dialog.cpp b/kcms/activities/imports/dialog.cpp index 2d434d876..1e90922e8 100644 --- a/kcms/activities/imports/dialog.cpp +++ b/kcms/activities/imports/dialog.cpp @@ -1,307 +1,300 @@ /* * Copyright (C) 2015 - 2016 by Ivan Cukic * * 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) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * 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, see . */ #include "dialog.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../kactivities-kcm-features.h" #include "kactivities/info.h" #include "kactivities/controller.h" #include "features_interface.h" #include "common/dbus/common.h" #include "utils/continue_with.h" #include "utils/d_ptr_implementation.h" #include "../utils.h" class Dialog::Private { public: Private(Dialog *parent) : q(parent) , activityName(QStringLiteral("activityName")) , activityDescription(QStringLiteral("activityDescription")) , activityIcon(QStringLiteral("activityIcon")) , activityWallpaper(QStringLiteral("activityWallpaper")) , activityIsPrivate(true) , activityShortcut(QStringLiteral("activityShortcut")) , features(new KAMD_DBUS_CLASS_INTERFACE(Features, Features, q)) { } Dialog *const q; QVBoxLayout *layout; QTabWidget *tabs; QQuickWidget *tabGeneral; - QQuickWidget *tabOther; KMessageWidget *message; QDialogButtonBox *buttons; QString defaultOKText; QQuickWidget *createTab(const QString &title, const QString &file) { auto view = new QQuickWidget(); view->setResizeMode(QQuickWidget::SizeRootObjectToView); view->setClearColor(QGuiApplication::palette().window().color()); view->rootContext()->setContextProperty(QStringLiteral("dialog"), q); if (setViewSource(view, QStringLiteral("/qml/activityDialog/") + file)) { tabs->addTab(view, title); - - auto root = view->rootObject(); - Q_ASSERT(root); - QMetaObject::invokeMethod(root, "load", Qt::DirectConnection); - } else { message->setText(i18n("Error loading the QML files. Check your installation.\nMissing %1", QStringLiteral(KAMD_KCM_DATADIR) + QStringLiteral("/qml/activityDialog/") + file)); message->setVisible(true); } return view; } void setFocus(QQuickWidget *widget) { // TODO: does not work... widget->setFocus(); auto root = widget->rootObject(); if (!root) return; QMetaObject::invokeMethod(widget->rootObject(), "setFocus", Qt::DirectConnection); } QString activityId; QString activityName; QString activityDescription; QString activityIcon; QString activityWallpaper; bool activityIsPrivate; QString activityShortcut; KActivities::Controller activities; org::kde::ActivityManager::Features *features; }; void Dialog::showDialog(const QString &id) { static Dialog *dialog = nullptr; // If we use the regular singleton here (static value instead of static ptr), // we will crash on exit because of Qt... if (!dialog) { dialog = new Dialog(); } dialog->init(id); dialog->show(); } Dialog::Dialog(QObject *parent) : QDialog() , d(this) { - resize(600, 500); + resize(550, 400); d->layout = new QVBoxLayout(this); // Message widget for showing errors d->message = new KMessageWidget(this); d->message->setMessageType(KMessageWidget::Error); d->message->setVisible(false); d->layout->addWidget(d->message); // Tabs d->tabs = new QTabWidget(this); d->layout->addWidget(d->tabs); d->tabGeneral = d->createTab(i18n("General"), QStringLiteral("GeneralTab.qml")); - d->tabOther = d->createTab(i18n("Other"), QStringLiteral("OtherTab.qml")); // Buttons d->buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); d->layout->QLayout::addWidget(d->buttons); connect(d->buttons->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, this, &Dialog::save); connect(d->buttons, &QDialogButtonBox::rejected, this, &Dialog::close); d->defaultOKText = d->buttons->button(QDialogButtonBox::Ok)->text(); } void Dialog::init(const QString &activityId) { setWindowTitle(activityId.isEmpty() ? i18nc("@title:window", "Create a New Activity") : i18nc("@title:window", "Activity Settings")); d->buttons->button(QDialogButtonBox::Ok)->setText( activityId.isEmpty() ? i18nc("@action:button", "Create") : d->defaultOKText); d->tabs->setCurrentIndex(0); setActivityId(activityId); setActivityName(QString()); setActivityDescription(QString()); - setActivityIcon(QString()); + setActivityIcon(QStringLiteral("preferences-activities")); setActivityIsPrivate(false); setActivityShortcut(QKeySequence()); if (!activityId.isEmpty()) { KActivities::Info activityInfo(activityId); setActivityName(activityInfo.name()); setActivityDescription(activityInfo.description()); setActivityIcon(activityInfo.icon()); // finding the key shortcut const auto shortcuts = KGlobalAccel::self()->globalShortcut( QStringLiteral("ActivityManager"), QStringLiteral("switch-to-activity-") + activityId); setActivityShortcut(shortcuts.isEmpty() ? QKeySequence() : shortcuts.first()); // is private? auto result = d->features->GetValue( QStringLiteral("org.kde.ActivityManager.Resources.Scoring/isOTR/") + activityId); auto watcher = new QDBusPendingCallWatcher(result, this); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [&] (QDBusPendingCallWatcher *watcher) mutable { QDBusPendingReply reply = *watcher; setActivityIsPrivate(reply.value().variant().toBool()); watcher->deleteLater(); }); } } Dialog::~Dialog() { } void Dialog::showEvent(QShowEvent *event) { // Setting the focus d->setFocus(d->tabGeneral); } #define IMPLEMENT_PROPERTY(Scope, Type, PType, PropName) \ Type Dialog::activity##PropName() const \ { \ auto root = d->tab##Scope->rootObject(); \ \ if (!root) { \ qDebug() << "Root does not exist"; \ return Type(); \ } \ \ return root->property("activity" #PropName).value(); \ } \ \ void Dialog::setActivity##PropName(PType value) \ { \ auto root = d->tab##Scope->rootObject(); \ \ if (!root) { \ qDebug() << "Root does not exist"; \ return; \ } \ \ root->setProperty("activity" #PropName, value); \ } IMPLEMENT_PROPERTY(General, QString, const QString &, Id) IMPLEMENT_PROPERTY(General, QString, const QString &, Name) IMPLEMENT_PROPERTY(General, QString, const QString &, Description) IMPLEMENT_PROPERTY(General, QString, const QString &, Icon) IMPLEMENT_PROPERTY(General, QString, const QString &, Wallpaper) -IMPLEMENT_PROPERTY(Other, QKeySequence, const QKeySequence &, Shortcut) -IMPLEMENT_PROPERTY(Other, bool, bool, IsPrivate) +IMPLEMENT_PROPERTY(General, QKeySequence, const QKeySequence &, Shortcut) +IMPLEMENT_PROPERTY(General, bool, bool, IsPrivate) #undef IMPLEMENT_PROPERTY void Dialog::save() { if (activityId().isEmpty()) { create(); } else { saveChanges(activityId()); } } void Dialog::create() { using namespace kamd::utils; continue_with( d->activities.addActivity(activityName()), [this](const optional_view &activityId) { if (activityId.is_initialized()) { saveChanges(activityId.get()); } }); } void Dialog::saveChanges(const QString &activityId) { d->activities.setActivityName(activityId, activityName()); d->activities.setActivityDescription(activityId, activityDescription()); d->activities.setActivityIcon(activityId, activityIcon()); // setting the key shortcut QAction action(nullptr); action.setProperty("isConfigurationAction", true); action.setProperty("componentName", QStringLiteral("ActivityManager")); action.setObjectName(QStringLiteral("switch-to-activity-") + activityId); KGlobalAccel::self()->removeAllShortcuts(&action); KGlobalAccel::self()->setGlobalShortcut(&action, activityShortcut()); // is private? d->features->SetValue(QStringLiteral("org.kde.ActivityManager.Resources.Scoring/isOTR/") + activityId, QDBusVariant(activityIsPrivate())); close(); } diff --git a/kcms/activities/imports/qml/activityDialog/GeneralTab.qml b/kcms/activities/imports/qml/activityDialog/GeneralTab.qml index f8100cc5f..2deffe243 100644 --- a/kcms/activities/imports/qml/activityDialog/GeneralTab.qml +++ b/kcms/activities/imports/qml/activityDialog/GeneralTab.qml @@ -1,164 +1,90 @@ /* vim:set foldmethod=marker: * * Copyright (C) 2015 Ivan Cukic * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * 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. */ -import QtQuick 2.2 -import QtQuick.Controls 1.0 as QtControls +import QtQuick 2.5 +import QtQuick.Controls 2.5 as QQC2 -import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.kirigami 2.5 as Kirigami +import org.kde.kquickcontrols 2.0 as KQuickControls +import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons -import "./components" as Local - -Item { +Kirigami.FormLayout { id: root function setFocus() { activityName.forceActiveFocus(); - console.log("GeneralTab: Set focus called"); } property string activityId: "" property alias activityName : activityName.text property alias activityDescription : activityDescription.text - property alias activityIcon : buttonIcon.iconName - property alias activityWallpaper : imageWallpaper.source - - height : content.childrenRect.height + 4 * units.smallSpacing - width : content.childrenRect.width + 4 * units.smallSpacing - - Column { - id: content - - anchors { - fill: parent - margins: 2 * units.smallSpacing - } - - spacing: units.smallSpacing - - QtControls.Label { - font.bold: true - text: i18nd("kcm_activities5", "Activity information") - } - - property int labelWidth : 2 * units.largeSpacing + - Math.max(activityName.desiredLabelWidth, activityDescription.desiredLabelWidth) + property alias activityIcon : activityIcon.icon.name + property alias activityIsPrivate : activityIsPrivate.checked + property alias activityShortcut : activityShortcut.keySequence - Local.LabeledTextField { - id: activityName - label: i18nd("kcm_activities5", "Name:") - - labelWidth: content.labelWidth - } - - Local.LabeledTextField { - id: activityDescription - label: i18nd("kcm_activities5", "Description:") + Item { + height: Kirigami.Units.smallSpacing + } - labelWidth: content.labelWidth + QQC2.Button { + id: activityIcon + implicitHeight: Kirigami.Units.iconSizes.medium + Kirigami.Units.largeSpacing * 2 + implicitWidth: height + icon.height: Kirigami.Units.iconSizes.medium + icon.width: Kirigami.Units.iconSizes.medium + icon.name: "preferences-activities" + Kirigami.FormData.label: i18nd("kcm_activities5", "Icon:") + + KQuickControlsAddons.IconDialog { + id: iconDialog + onIconNameChanged: activityIcon.icon.name = iconName } - Item { - width: parent.width - height: units.smallSpacing + onClicked: { + iconDialog.open(); } + } - Row { - height : units.iconSizes.large * 3 - width : childrenRect.width - spacing : units.largeSpacing - - Item { - id: panelWallpaper - - visible: false - - height: parent.height - width: buttonChangeWallpaper.width + imageWallpaper.width + units.smallSpacing - - QtControls.Label { - id: labelWallpaper - font.bold: true - text: i18nd("kcm_activities5", "Wallpaper") - } - - QtControls.Button { - id: buttonChangeWallpaper - width: content.labelWidth - text: i18ndc("kcm_activities5", "@action:button", "Change...") - - anchors { - verticalCenter: imageWallpaper.verticalCenter - } - } - - Image { - id: imageWallpaper - source: "" - - width: height / 3 * 4 - - anchors { - top: labelWallpaper.bottom - bottom: parent.bottom - left: buttonChangeWallpaper.right - - leftMargin: units.smallSpacing - } - - } - } - - Item { - id: panelIcon - - height : parent.height - width : parent.height - - QtControls.Label { - id: labelIcon - font.bold: true - text: i18nd("kcm_activities5", "Icon") - } + QQC2.TextField { + id: activityName + Kirigami.FormData.label: i18nd("kcm_activities5", "Name:") + } - Item { - anchors { - top: labelIcon.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - } + QQC2.TextField { + id: activityDescription + Kirigami.FormData.label: i18nd("kcm_activities5", "Description:") + } - Local.IconChooser { - id: buttonIcon + Kirigami.Separator { + Kirigami.FormData.isSection: true + } - width: height - height: 2 * units.iconSizes.large + QQC2.CheckBox { + id: activityIsPrivate + Kirigami.FormData.label: i18nd("kcm_activities5", "Privacy:") + text: i18nd("kcm_activities5", "Do not track usage for this activity") + } - anchors { - centerIn: parent - } - } - } - } - } + KQuickControls.KeySequenceItem { + id: activityShortcut + Kirigami.FormData.label: i18nd("kcm_activities5", "Shortcut for switching:") } } - diff --git a/kcms/activities/imports/qml/activityDialog/OtherTab.qml b/kcms/activities/imports/qml/activityDialog/OtherTab.qml deleted file mode 100644 index 8eff44959..000000000 --- a/kcms/activities/imports/qml/activityDialog/OtherTab.qml +++ /dev/null @@ -1,55 +0,0 @@ -/* vim:set foldmethod=marker: - * - * Copyright (C) 2015 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * 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. - */ - -import QtQuick 2.2 -import QtQuick.Controls 1.0 as QtControls - -import "./components" as Local - -Item { - id: root - - property alias activityIsPrivate : checkPrivate.checked - property alias activityShortcut : panelShortcut.keySequence - - height : content.childrenRect.height + 4 * units.smallSpacing - width : content.childrenRect.width + 4 * units.smallSpacing - - Column { - anchors { - fill: parent - margins: 2 * units.smallSpacing - } - - QtControls.CheckBox { - id: checkPrivate - - text: i18nd("kcm_activities5", "Private - do not track usage for this activity") - - width: parent.width - } - - Local.ShortcutChooser { - id: panelShortcut - - width: parent.width - } - } -} diff --git a/kcms/activities/imports/qml/activityDialog/components/DialogButtons.qml b/kcms/activities/imports/qml/activityDialog/components/DialogButtons.qml deleted file mode 100644 index 62f1d3433..000000000 --- a/kcms/activities/imports/qml/activityDialog/components/DialogButtons.qml +++ /dev/null @@ -1,58 +0,0 @@ -/* vim:set foldmethod=marker: - * - * Copyright (C) 2015 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 as QtControls - -Row { - id: root - - property alias acceptText: buttonAccept.text - property alias acceptIcon: buttonAccept.iconName - - property alias cancelText: buttonCancel.text - property alias cancelIcon: buttonCancel.iconName - - signal accepted() - signal canceled() - - spacing: units.smallSpacing - - height : buttonAccept.height //childrenRect.height - width : buttonAccept.width + spacing + buttonCancel.width - - QtControls.Button { - id: buttonAccept - - text: i18ndc("kcm_activities5", "@action:button", "Apply") - iconName: "list-add" - - onClicked: root.accepted() - } - - QtControls.Button { - id: buttonCancel - - text: i18ndc("kcm_activities5", "@action:button", "Cancel") - iconName: "dialog-cancel" - - onClicked: root.canceled() - } -} diff --git a/kcms/activities/imports/qml/activityDialog/components/IconChooser.qml b/kcms/activities/imports/qml/activityDialog/components/IconChooser.qml deleted file mode 100644 index f0a26d994..000000000 --- a/kcms/activities/imports/qml/activityDialog/components/IconChooser.qml +++ /dev/null @@ -1,42 +0,0 @@ -/* vim:set foldmethod=marker: - * - * Copyright (C) 2015 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 as QtControls -import org.kde.kquickcontrols 2.0 as KQuickControls -import org.kde.kquickcontrolsaddons 2.0 as KQuickControls - -QtControls.Button { - id: root - - width: height - height: units.iconSizes.medium - - iconName: "preferences-activities" - - KQuickControls.IconDialog { - id: iconDialog - onIconNameChanged: root.iconName = iconName - } - - onClicked: { - iconDialog.open(); - } -} diff --git a/kcms/activities/imports/qml/activityDialog/components/LabeledTextField.qml b/kcms/activities/imports/qml/activityDialog/components/LabeledTextField.qml deleted file mode 100644 index 56cebf751..000000000 --- a/kcms/activities/imports/qml/activityDialog/components/LabeledTextField.qml +++ /dev/null @@ -1,57 +0,0 @@ -/* vim:set foldmethod=marker: - * - * Copyright (C) 2015 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * 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. - */ - -import QtQuick 2.2 -import QtQuick.Controls 1.0 as QtControls - -import org.kde.plasma.core 2.0 as PlasmaCore - -Item { - property alias text : textField.text - property alias label : label.text - - property alias labelWidth : label.width - property alias desiredLabelWidth : label.contentWidth - - height : textField.height - width : parent.width - - QtControls.Label { - id: label - - horizontalAlignment: Text.AlignRight - - anchors { - left: parent.left - verticalCenter: textField.verticalCenter - } - } - - QtControls.TextField { - id: textField - - anchors { - left : label.right - right : parent.right - - leftMargin : units.smallSpacing - } - } -} diff --git a/kcms/activities/imports/qml/activityDialog/components/ShortcutChooser.qml b/kcms/activities/imports/qml/activityDialog/components/ShortcutChooser.qml deleted file mode 100644 index ace5e6140..000000000 --- a/kcms/activities/imports/qml/activityDialog/components/ShortcutChooser.qml +++ /dev/null @@ -1,42 +0,0 @@ -/* vim:set foldmethod=marker: - * - * Copyright (C) 2015 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * 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. - */ - -import QtQuick 2.2 -import QtQuick.Controls 1.0 as QtControls - -import org.kde.plasma.core 2.0 as PlasmaCore - -import org.kde.kquickcontrols 2.0 as KQuickControls -import org.kde.kquickcontrolsaddons 2.0 as KQuickControls - -Row { - spacing: units.smallSpacing - - property alias keySequence: buttonKeyShorcut.keySequence - - QtControls.Label { - anchors.verticalCenter: parent.verticalCenter - text: i18nd("kcm_activities5", "Shortcut for switching to this activity:") - } - - KQuickControls.KeySequenceItem { - id: buttonKeyShorcut - } -} diff --git a/kcms/activities/kcm_activities.desktop b/kcms/activities/kcm_activities.desktop index 783757bfd..ba4ac49ed 100644 --- a/kcms/activities/kcm_activities.desktop +++ b/kcms/activities/kcm_activities.desktop @@ -1,110 +1,111 @@ [Desktop Entry] +Exec=kcmshell5 activities Icon=preferences-desktop-activities Type=Service X-KDE-ServiceTypes=KCModule X-KDE-ModuleType=Library X-KDE-Library=kcm_activities X-KDE-FactoryName=kcm_activities X-KDE-ParentApp=kcontrol X-KDE-System-Settings-Parent-Category=desktopbehavior X-KDE-Weight=80 X-DocPath=plasma-desktop/activities-interface.html Name=Activities Name[ar]=الأنشطة Name[bg]=Дейности Name[bs]=Motor aktivnosti Name[ca]=Activitats Name[ca@valencia]=Activitats Name[cs]=Aktivity Name[da]=Aktiviteter Name[de]=Aktivitäten Name[el]=Δραστηριότητες Name[en_GB]=Activities Name[es]=Actividades Name[et]=Tegevused Name[eu]=Jarduerak Name[fa]=فعالیتها Name[fi]=Aktiviteetit Name[fr]=Activités Name[ga]=Gníomhaíochtaí Name[gl]=Actividades Name[he]=פעילויות Name[hr]=Aktivnosti Name[hu]=Aktivitások Name[ia]=Activitates Name[id]=Activities Name[is]=Virknistjóri Name[it]=Attività Name[ja]=アクティビティ Name[kk]=Белсенділіктер Name[km]=សកម្មភាព Name[ko]=활동 Name[lt]=Veiklos Name[lv]=Aktivitātes Name[mr]=कार्यपध्दती Name[nb]=Aktiviteter Name[nds]=Aktiviteten Name[nl]=Activiteiten Name[nn]=Aktivitetar Name[pa]=ਸਰਗਰਮੀਆਂ Name[pl]=Aktywności Name[pt]=Actividades Name[pt_BR]=Atividades Name[ro]=Activități Name[ru]=Комнаты Name[sk]=Aktivity Name[sl]=Dejavnosti Name[sr]=активности Name[sr@ijekavian]=активности Name[sr@ijekavianlatin]=aktivnosti Name[sr@latin]=aktivnosti Name[sv]=Aktiviteter Name[tr]=Etkinlikler Name[ug]=پائالىيەتلەر Name[uk]=Простори дій Name[vi]=Hoạt động Name[wa]=Activités Name[x-test]=xxActivitiesxx Name[zh_CN]=活动 Name[zh_TW]=活動 Comment=Activities help you to focus on a specific task Comment[ca]=Les activitats ajuden a centrar-vos en una tasca específica Comment[ca@valencia]=Les activitats ajuden a centrar-vos en una tasca específica Comment[da]=Aktiviteter hjælper dig med at fokusere på en specifik opgave Comment[de]=Aktivitäten helfen Ihnen dabei, sich auf eine Aufgabe zu konzentrieren Comment[el]=Οι δραστηριότητες σας βοηθούν να εστιάζετε σε μια συγκεκριμένη εργασία Comment[en_GB]=Activities help you to focus on a specific task Comment[es]=Las actividades le ayudan a centrarse en una determinada tarea Comment[et]=Tegevused aitavad keskenduda konkreetsele ülesandele Comment[eu]=Jarduerek zeregin batean arreta jartzen laguntzen dute Comment[fi]=Aktiviteetit auttavat sinua keskittymään yhteen asiaan Comment[fr]=Les activités vous aident à vous concentrer sur une tâche spécifique Comment[gl]=As actividades axudan a centrarse en tarefas concretas. Comment[he]=פעלויות עוזרות לך להתמקד בחלון אחד Comment[hu]=Az aktivitások segítenek egy-egy feladatra koncentrálni Comment[id]=Activities membantu Anda untuk fokus pada tugas yang khusus Comment[it]=Le attività ti aiutano a concentrarti su un compito specifico Comment[ja]=アクティビティは一つの作業に集中する手助けをします Comment[ko]=활동을 사용하면 개별 작업에 집중할 수 있습니다 Comment[nl]=Activiteiten helpen u om u te focussen op een specifieke taak Comment[nn]=Aktivitetar hjelper deg å fokusera på oppgåver Comment[pa]=ਖਾਸ ਕੰਮ ਉੱਤੇ ਧਿਆਨ ਲਗਾਉਣ ਲਈ ਮਦਦ ਵਾਸਤੇ ਸਰਗਰਮੀਆਂ Comment[pl]=Aktywności pomagają ci skupić się na danym zadaniu Comment[pt]=As actividades ajudam-no a focar-se numa tarefa específica Comment[pt_BR]=Ajuda-o a se concentrar em uma tarefa específica Comment[ru]=Комнаты помогают сконцентрироваться на конкретной задаче Comment[sk]=Aktivity vám pomôžu sústrediť sa na určitú úlohu Comment[sl]=Dejavnosti vam pomagajo, da se osredotočite na določeno opravilo Comment[sr]=Активности вам помажу да се усредсредите на одређени задатак Comment[sr@ijekavian]=Активности вам помажу да се усредсредите на одређени задатак Comment[sr@ijekavianlatin]=Aktivnosti vam pomažu da se usredsredite na određeni zadatak Comment[sr@latin]=Aktivnosti vam pomažu da se usredsredite na određeni zadatak Comment[sv]=Aktiviteter hjälper dig att fokusera på en viss uppgift Comment[tr]=Etkinlikler belirli bir göreve odaklanmanıza yardımcı olur Comment[uk]=Простори дій допоможуть вам зосередитися на певному завданні Comment[x-test]=xxActivities help you to focus on a specific taskxx Comment[zh_CN]=活动帮助您专注于特定任务 Comment[zh_TW]=活動可以幫您聚焦於特定工作 diff --git a/kcms/activities/qml/activitiesTab/ActivitiesView.qml b/kcms/activities/qml/activitiesTab/ActivitiesView.qml index 2c0fd554b..68ddb75e9 100644 --- a/kcms/activities/qml/activitiesTab/ActivitiesView.qml +++ b/kcms/activities/qml/activitiesTab/ActivitiesView.qml @@ -1,193 +1,88 @@ /* vim:set foldenable foldmethod=marker: * * Copyright (C) 2015 Ivan Cukic * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * 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. */ -import QtQuick 2.0 -import org.kde.kquickcontrolsaddons 2.0 -import QtQuick.Controls 1.0 as QtControls +import QtQuick 2.5 +import QtQuick.Controls 2.5 as QQC2 +import QtQuick.Layouts 1.0 import org.kde.activities 0.1 as Activities import org.kde.activities.settings 0.1 -import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.kirigami 2.5 as Kirigami -Item { +ColumnLayout { id: root - anchors.fill: parent - - QtControls.Button { - id: buttonCreateActivity - - text: i18nd("kcm_activities5", "Create activity...") - iconName: "list-add" - - anchors { - top: parent.top - left: parent.left - } - - onClicked: ActivitySettings.newActivity(); - - enabled: !dialogCreateActivityLoader.itemVisible - visible: ActivitySettings.newActivityAuthorized - } - - Loader { - id: dialogCreateActivityLoader - - property bool itemVisible: status == Loader.Ready && item.visible - - z: 1 - - anchors { - top: buttonCreateActivity.bottom - left: buttonCreateActivity.left - } - } - - QtControls.ScrollView { - anchors { - top: buttonCreateActivity.bottom - topMargin: units.smallSpacing - left: parent.left - right: parent.right - bottom: parent.bottom - } - - enabled: !dialogCreateActivityLoader.itemVisible + QQC2.ScrollView { + Layout.fillHeight: true + Layout.fillWidth: true + Component.onCompleted: background.visible = true; ListView { id: activitiesList - width: parent.width - // anchors.fill: parent model: Activities.ActivityModel { id: kactivities } - SystemPalette { - id: palette - colorGroup: SystemPalette.Active - } - - /////////////////////////////////////////////////////////////////// - delegate: Rectangle { - width: parent.width + delegate: Kirigami.SwipeListItem { + hoverEnabled: true - height: units.iconSizes.medium + units.smallSpacing * 2 + contentItem: RowLayout { + id: row - color: (model.index % 2 == 0) ? palette.base : palette.alternateBase - - Item { - id: header - - anchors { - fill: parent - margins: units.smallSpacing - } - - QIconItem { + Kirigami.Icon { id: icon - icon: model.icon - - width: height - height: parent.height - - anchors { - left: parent.left - top: parent.top - } + height: Kirigami.Units.iconSizes.medium + width: height + source: model.icon } - QtControls.Label { + QQC2.Label { + Layout.fillWidth: true text: model.name - - anchors { - left: icon.right - right: buttons.left - leftMargin: units.largeSpacing - verticalCenter: icon.verticalCenter - } } - - Row { - id: buttons - - spacing: units.smallSpacing - height: parent.height - - anchors { - right: parent.right - - verticalCenter: parent.verticalCenter - } - - QtControls.Button { - id: buttonConfigure - - iconName: "configure" - - onClicked: ActivitySettings.configureActivity(model.id); - } - - QtControls.Button { - id: buttonDelete - - iconName: "edit-delete" - - onClicked: ActivitySettings.deleteActivity(model.id); - - visible: ActivitySettings.newActivityAuthorized - - // Disable the button when there's only one activity - enabled: activitiesList.count > 1 - } - - visible: !dialogDeleteLoader.itemVisible - } - - visible: !dialogConfigureLoader.itemVisible } - Loader { - id: dialogConfigureLoader - - property bool itemVisible: status == Loader.Ready && item.visible - - anchors { - left: parent.left - top: parent.top - } - } - - Loader { - id: dialogDeleteLoader - - property bool itemVisible: status == Loader.Ready && item.visible - - anchors { - left: parent.left - top: header.bottom + actions: [ + Kirigami.Action { + icon.name: "configure" + tooltip: i18nc("@info:tooltip", "Configure " + model.name + " activity...") + onTriggered: ActivitySettings.configureActivity(model.id); + }, + Kirigami.Action { + visible: ActivitySettings.newActivityAuthorized + enabled: activitiesList.count > 1 + icon.name: "edit-delete" + tooltip: i18nc("@info:tooltip", "Delete " + model.name + " activity") + onTriggered: ActivitySettings.deleteActivity(model.id); } - } + ] } - /////////////////////////////////////////////////////////////////// } } + + QQC2.Button { + id: buttonCreateActivity + visible: ActivitySettings.newActivityAuthorized + text: i18nd("kcm_activities5", "Create New...") + icon.name: "list-add" + onClicked: ActivitySettings.newActivity(); + } } diff --git a/kcms/activities/qml/privacyTab/BlacklistApplicationView.qml b/kcms/activities/qml/privacyTab/BlacklistApplicationView.qml index 765537772..981ea694f 100644 --- a/kcms/activities/qml/privacyTab/BlacklistApplicationView.qml +++ b/kcms/activities/qml/privacyTab/BlacklistApplicationView.qml @@ -1,107 +1,90 @@ /* vim:set foldenable foldmethod=marker: * * Copyright (C) 2012 Ivan Cukic * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * 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. */ -import QtQuick 2.0 -import org.kde.kquickcontrolsaddons 2.0 -import QtQuick.Controls 1.0 as QtControls - -QtControls.ScrollView { - anchors.fill: parent - - Flow { - id: main - - SystemPalette { - id: colors - } - - width: parent.parent.width - - property int minimumHeight: 100 - - spacing: 16 - - height: Math.max(childrenRect.height, minimumHeight) - - opacity: applicationModel.enabled ? 1 : .3 - Behavior on opacity { NumberAnimation { duration: 150 } } - - Repeater { - model: applicationModel - Column { - id: item - - property bool blocked: model.blocked - - Item { - id: mainIcon - - width : 64 + 20 - height : 64 + 20 - - QIconItem { - id: icon - icon: model.icon - - anchors.fill : parent - anchors.margins : 10 - - opacity: item.blocked ? 0.5 : 1.0 - Behavior on opacity { NumberAnimation { duration: 150 } } - } - - QIconItem { - id: iconNo - icon: "dialog-cancel" +import QtQuick 2.5 +import QtQuick.Controls 2.5 as QQC2 + +import org.kde.kirigami 2.5 as Kirigami + +QQC2.ScrollView { + enabled: applicationModel.enabled + Component.onCompleted: background.visible = true; + + GridView { + id: gridView + cellHeight: Kirigami.Units.gridUnit * 5 + cellWidth: Kirigami.Units.gridUnit * 9 + model: applicationModel + delegate: Item { + height: gridView.cellHeight + width: gridView.cellWidth + + Rectangle { + anchors.fill: parent + visible: mouseArea.containsMouse + color: Kirigami.Theme.hoverColor + } - anchors { - right : parent.right - bottom : parent.bottom - } + Kirigami.Icon { + id: icon + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.verticalCenter + height: Kirigami.Units.iconSizes.medium + width: height + source: model.icon + opacity: model.blocked ? 0.6 : 1.0 - width : 48 - height : 48 - opacity : (1 - icon.opacity) * 2 - } + Behavior on opacity { NumberAnimation { duration: 100 } } + } - MouseArea { - onClicked: applicationModel.toggleApplicationBlocked(model.index) - anchors.fill: parent - } - } + Kirigami.Icon { + anchors.bottom: icon.bottom + anchors.right: icon.right + height: Kirigami.Units.iconSizes.small + width: height + source: "emblem-unavailable" + opacity: model.blocked ? 1.0 : 0.0 - Text { - elide : Text.ElideRight - width : mainIcon.width + Behavior on opacity { NumberAnimation { duration: 100 } } + } - text : model.title - opacity : icon.opacity - color : colors.windowText + QQC2.Label { + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.verticalCenter + width: parent.width - 20 + text: model.title + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap + opacity: model.blocked ? 0.6 : 1.0 + + Behavior on opacity { NumberAnimation { duration: 100 } } + } - anchors.margins : 10 - anchors.horizontalCenter : parent.horizontalCenter - horizontalAlignment : Text.AlignHCenter - } + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: applicationModel.toggleApplicationBlocked(model.index) } } } - } - diff --git a/kcms/activities/ui/MainConfigurationWidgetBase.ui b/kcms/activities/ui/MainConfigurationWidgetBase.ui index 302ebdec6..191af019b 100644 --- a/kcms/activities/ui/MainConfigurationWidgetBase.ui +++ b/kcms/activities/ui/MainConfigurationWidgetBase.ui @@ -1,28 +1,28 @@ MainConfigurationWidgetBase 0 0 - 760 - 613 + 500 + 500 -1 changed() diff --git a/kcms/activities/ui/PrivacyTabBase.ui b/kcms/activities/ui/PrivacyTabBase.ui index caab35756..ec2eacd27 100644 --- a/kcms/activities/ui/PrivacyTabBase.ui +++ b/kcms/activities/ui/PrivacyTabBase.ui @@ -1,120 +1,126 @@ PrivacyTabBase 0 0 - 631 - 479 + 500 + 500 - + - + - Remember opened documents: + Cleared the activity history. + + + KMessageWidget::Positive + + + + .. - - - + + + Qt::AlignHCenter|Qt::AlignTop + + + + + Remember opened documents: + + + + + + + For a&ll applications + + + true + + + + + + + &Do not remember + + + + + + + O&nly for specific applications: + + + + + - - - For a&ll applications - - - true - - + - + - &Do not remember + Clear History - - - - - - O&nly for specific applications + + + .. - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - Keep history - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 40 - 20 - - - - - - - - Clear recent history + Keep history: 0 0 - - - Blacklist all applications not on this list + + + 6 - + + + + Blacklist applications not on the list + + + + + + + KMessageWidget + QFrame +
kmessagewidget.h
+
+
diff --git a/kcms/activities/ui/SwitchingTabBase.ui b/kcms/activities/ui/SwitchingTabBase.ui index d3f2f4ee9..c8d85e129 100644 --- a/kcms/activities/ui/SwitchingTabBase.ui +++ b/kcms/activities/ui/SwitchingTabBase.ui @@ -1,66 +1,69 @@ SwitchingTabBase 0 0 - 666 - 558 + 500 + 500 - - - General + + + Qt::AlignHCenter|Qt::AlignTop - - - - - Remember the current virtual desktop for each activity (needs restart) - - - - - + + + + Remember for each activity (needs restart) + + + + + + + Current virtual desktop: + + + + - - - Shortcuts + + + Shortcuts: - - - - - + + + Qt::Vertical 20 195 KShortcutsEditor QWidget
kshortcutseditor.h