diff --git a/kcms/launch/CMakeLists.txt b/kcms/launch/CMakeLists.txt --- a/kcms/launch/CMakeLists.txt +++ b/kcms/launch/CMakeLists.txt @@ -1,29 +1,27 @@ -# KI18N Translation Domain for this library -add_definitions(-DTRANSLATION_DOMAIN=\"kcmlaunch\") - +# KI18N Translation Domain for this library. +add_definitions(-DTRANSLATION_DOMAIN=\"kcmlaunchfeedback\") ########### next target ############### -set(kcm_launch_PART_SRCS kcmlaunch.cpp ) +set(kcm_launchfeedback_PART_SRCS launchfeedback.cpp) set_source_files_properties(${KWIN_EFFECTS_INTERFACE} PROPERTIES INCLUDE "interface_util.h") -qt5_add_dbus_interface( kcm_launch_PART_SRCS ${KWIN_EFFECTS_INTERFACE} kwin_interface ) - - - -add_library(kcm_launch MODULE ${kcm_launch_PART_SRCS}) +qt5_add_dbus_interface(kcm_launchfeedback_PART_SRCS ${KWIN_EFFECTS_INTERFACE} kwin_interface) +add_library(kcm_launchfeedback MODULE ${kcm_launchfeedback_PART_SRCS}) -target_link_libraries(kcm_launch +target_link_libraries(kcm_launchfeedback Qt5::DBus - KF5::KCMUtils KF5::I18n + KF5::KCMUtils + KF5::QuickAddons ) -install(TARGETS kcm_launch DESTINATION ${PLUGIN_INSTALL_DIR} ) - +kcoreaddons_desktop_to_json(kcm_launchfeedback "kcm_launchfeedback.desktop") ########### install files ############### -install( FILES kcmlaunch.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install(TARGETS kcm_launchfeedback DESTINATION ${PLUGIN_INSTALL_DIR}/kcms) +install(FILES kcm_launchfeedback.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +kpackage_install_package(package kcm_launchfeedback kcms) diff --git a/kcms/launch/Messages.sh b/kcms/launch/Messages.sh --- a/kcms/launch/Messages.sh +++ b/kcms/launch/Messages.sh @@ -1,2 +1,2 @@ #! /usr/bin/env bash -$XGETTEXT *.cpp -o $podir/kcmlaunch.pot +$XGETTEXT `find . -name \*.cpp -o -name \*.qml` -o $podir/kcmlaunchfeedback.pot diff --git a/kcms/launch/kcmlaunch.desktop b/kcms/launch/kcm_launchfeedback.desktop rename from kcms/launch/kcmlaunch.desktop rename to kcms/launch/kcm_launchfeedback.desktop --- a/kcms/launch/kcmlaunch.desktop +++ b/kcms/launch/kcm_launchfeedback.desktop @@ -2,10 +2,10 @@ Icon=preferences-desktop-launch-feedback Type=Service X-KDE-ServiceTypes=KCModule -X-DocPath=kcontrol/kcmlaunch/index.html -Exec=kcmshell5 kcmlaunch +X-DocPath=kcontrol/kcmlaunchfeedback/index.html +Exec=kcmshell5 launchfeedback -X-KDE-Library=kcm_launch +X-KDE-Library=kcm_launchfeedback X-KDE-ParentApp=kcontrol X-KDE-System-Settings-Parent-Category=applications @@ -163,7 +163,7 @@ X-KDE-Keywords[gl]=aplicación,aplicativo,programa,inicio,iniciar,ocupado,cursor,indicador,rato, punteiro,rebotar,rodar,rotar,xirar,disco,informe,barra de tarefas X-KDE-Keywords[hu]=alkalmazás,indítás,indítás,elfoglalt,kurzor,visszajelzés,egér,mutató,pattogás,forgatás,csavarás,lemez,indítás,program,jelentés,feladatsáv X-KDE-Keywords[ia]=application,initio,lancea,occupate,cursor,retro information,mus,punctator,saltante,rotante,torneante,disco,initio,programma,reporto,barra de carga -X-KDE-Keywords[id]=aplikasi,start,jalankan,sibuk,kursor,umpan balik,mouse,penunjuk,memantul,rotasi,berputar,cakram,startup,program,laporan,bilah tugas +X-KDE-Keywords[id]=aplikasi,start,jalankan,sibuk,kursor,umpan balik,tetikus,penunjuk,memantul,rotasi,berputar,cakram,startup,program,laporan,batang tugas X-KDE-Keywords[it]=applicazione,avvia,esegui,occupato,puntatore,segnale di avvio,mouse,puntatore,rimbalza,rotazione,disco,avvio,programma,resoconto,barra dei processi X-KDE-Keywords[kk]=application,start,launch,busy,cursor,feedback,mouse,pointer,bouncing,rotating,spinning,disk,startup,program,report,taskbar X-KDE-Keywords[km]=application,start,launch,busy,cursor,feedback,mouse,pointer,bouncing,rotating,spinning,disk,startup,program,report,taskbar diff --git a/kcms/launch/kcmlaunch.h b/kcms/launch/kcmlaunch.h deleted file mode 100644 --- a/kcms/launch/kcmlaunch.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2001 Rik Hemsley (rikkus) - * - * 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 - */ - -#ifndef __kcmlaunch_h__ -#define __kcmlaunch_h__ - -#include - -class QCheckBox; -class QComboBox; -class QLabel; - -class QSpinBox; - -class LaunchConfig : public KCModule -{ - Q_OBJECT - - public: - - explicit LaunchConfig(QWidget * parent = 0, const QVariantList &list = QVariantList() ); - - virtual ~LaunchConfig(); - - void load() override; - void save() override; - void defaults() override; - - protected Q_SLOTS: - - void checkChanged(); - void slotBusyCursor(int); - void slotTaskbarButton(bool); - - protected: - - enum FeedbackStyle - { - BusyCursor = 1 << 0, - TaskbarButton = 1 << 1, - - Default = BusyCursor | TaskbarButton - }; - - - private: - - QLabel * lbl_cursorTimeout; - QLabel * lbl_taskbarTimeout; - QComboBox * cb_busyCursor; - QCheckBox * cb_taskbarButton; - QSpinBox * sb_cursorTimeout; - QSpinBox * sb_taskbarTimeout; - -}; - -#endif diff --git a/kcms/launch/kcmlaunch.cpp b/kcms/launch/kcmlaunch.cpp deleted file mode 100644 --- a/kcms/launch/kcmlaunch.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2001 Rik Hemsley (rikkus) - * - * 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 - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "kcmlaunch.h" -#include "kwin_interface.h" -#include - -K_PLUGIN_FACTORY(LaunchFactory, - registerPlugin(); -) -static const int s_startupDefaultTimeout = 5; - - -LaunchConfig::LaunchConfig(QWidget * parent, const QVariantList &) - : KCModule(parent) -{ - QVBoxLayout* Form1Layout = new QVBoxLayout( this ); - Form1Layout->setMargin( 0 ); - - setQuickHelp( i18n ( "

Launch Feedback

" - " You can configure the application-launch feedback here." ) ); - - QGroupBox* GroupBox1 = new QGroupBox(i18n( "Bus&y Cursor" )); - GroupBox1->setWhatsThis( i18n( - "

Busy Cursor

\n" - "KDE offers a busy cursor for application startup notification.\n" - "To enable the busy cursor, select one kind of visual feedback\n" - "from the combobox.\n" - "It may occur, that some applications are not aware of this startup\n" - "notification. In this case, the cursor stops blinking after the time\n" - "given in the section 'Startup indication timeout'")); - - QGridLayout* GroupBox1Layout = new QGridLayout(); - GroupBox1->setLayout( GroupBox1Layout ); - Form1Layout->addWidget(GroupBox1); - - GroupBox1Layout->setColumnStretch( 1, 1 ); - - cb_busyCursor = new QComboBox( GroupBox1); - cb_busyCursor->setObjectName( QStringLiteral("cb_busyCursor") ); - cb_busyCursor->insertItem( 0, i18n( "No Busy Cursor" ) ); - cb_busyCursor->insertItem( 1, i18n( "Passive Busy Cursor" ) ); - cb_busyCursor->insertItem( 2, i18n( "Blinking Cursor" ) ); - cb_busyCursor->insertItem( 3, i18n( "Bouncing Cursor" ) ); - GroupBox1Layout->addWidget( cb_busyCursor, 0, 0 ); - connect(cb_busyCursor, static_cast(&QComboBox::activated), this, &LaunchConfig::slotBusyCursor); - connect(cb_busyCursor, static_cast(&QComboBox::activated), this, &LaunchConfig::checkChanged); - - lbl_cursorTimeout = new QLabel( GroupBox1 ); - lbl_cursorTimeout->setObjectName( QStringLiteral("TextLabel1") ); - lbl_cursorTimeout->setText( i18n( "&Startup indication timeout:" ) ); - GroupBox1Layout->addWidget( lbl_cursorTimeout, 2, 0 ); - sb_cursorTimeout = new QSpinBox( GroupBox1); - sb_cursorTimeout->setRange( 0, 99 ); - sb_cursorTimeout->setSuffix( i18n(" sec") ); - GroupBox1Layout->addWidget( sb_cursorTimeout, 2, 1 ); - lbl_cursorTimeout->setBuddy( sb_cursorTimeout ); - connect(sb_cursorTimeout, static_cast(&QSpinBox::valueChanged), this, &LaunchConfig::checkChanged); - - QGroupBox* GroupBox2 = new QGroupBox( i18n( "Taskbar &Notification" ) ); - GroupBox2->setWhatsThis( i18n("

Taskbar Notification

\n" - "You can enable a second method of startup notification which is\n" - "used by the taskbar where a button with a rotating hourglass appears,\n" - "symbolizing that your started application is loading.\n" - "It may occur, that some applications are not aware of this startup\n" - "notification. In this case, the button disappears after the time\n" - "given in the section 'Startup indication timeout'")); - - QGridLayout* GroupBox2Layout = new QGridLayout(); - GroupBox2->setLayout( GroupBox2Layout ); - Form1Layout->addWidget( GroupBox2 ); - GroupBox2Layout->setColumnStretch( 1, 1 ); - - cb_taskbarButton = new QCheckBox( GroupBox2 ); - cb_taskbarButton->setObjectName( QStringLiteral("cb_taskbarButton") ); - cb_taskbarButton->setText( i18n( "Enable &taskbar notification" ) ); - GroupBox2Layout->addWidget( cb_taskbarButton, 0, 0, 1, 2 ); - connect(cb_taskbarButton, &QCheckBox::toggled, this, &LaunchConfig::slotTaskbarButton); - connect(cb_taskbarButton, &QCheckBox::toggled, this, &LaunchConfig::checkChanged); - - lbl_taskbarTimeout = new QLabel( GroupBox2 ); - lbl_taskbarTimeout->setObjectName( QStringLiteral("TextLabel2") ); - lbl_taskbarTimeout->setText( i18n( "Start&up indication timeout:" ) ); - GroupBox2Layout->addWidget( lbl_taskbarTimeout, 1, 0 ); - sb_taskbarTimeout = new QSpinBox( GroupBox2); - sb_taskbarTimeout->setRange( 0, 99 ); - sb_taskbarTimeout->setSuffix( i18n(" sec") ); - GroupBox2Layout->addWidget( sb_taskbarTimeout, 1, 1 ); - lbl_taskbarTimeout->setBuddy( sb_taskbarTimeout ); - connect(sb_taskbarTimeout, static_cast(&QSpinBox::valueChanged), this, &LaunchConfig::checkChanged); - - Form1Layout->addStretch(); -} - -LaunchConfig::~LaunchConfig() -{ -} - -void -LaunchConfig::slotBusyCursor(int i) -{ - lbl_cursorTimeout->setEnabled( i != 0 ); - sb_cursorTimeout->setEnabled( i != 0 ); -} - -void -LaunchConfig::slotTaskbarButton(bool b) -{ - lbl_taskbarTimeout->setEnabled( b ); - sb_taskbarTimeout->setEnabled( b ); -} - -void -LaunchConfig::load() -{ - KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals); - KConfigGroup c = conf.group("FeedbackStyle"); - - bool busyCursor = - c.readEntry("BusyCursor", (bool)(Default & BusyCursor)); - - bool taskbarButton = - c.readEntry("TaskbarButton", (bool)(Default & TaskbarButton)); - - cb_taskbarButton->setChecked(taskbarButton); - - c= conf.group( "BusyCursorSettings" ); - sb_cursorTimeout->setValue( c.readEntry( "Timeout", s_startupDefaultTimeout )); - bool busyBlinking =c.readEntry("Blinking", false); - bool busyBouncing =c.readEntry("Bouncing", true); - if ( !busyCursor ) - cb_busyCursor->setCurrentIndex(0); - else if ( busyBlinking ) - cb_busyCursor->setCurrentIndex(2); - else if ( busyBouncing ) - cb_busyCursor->setCurrentIndex(3); - else - cb_busyCursor->setCurrentIndex(1); - - c= conf.group( "TaskbarButtonSettings" ); - sb_taskbarTimeout->setValue( c.readEntry( "Timeout", s_startupDefaultTimeout )); - - slotBusyCursor( cb_busyCursor->currentIndex() ); - slotTaskbarButton( taskbarButton ); - - emit changed( false ); -} - -void -LaunchConfig::save() -{ - KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals); - KConfigGroup c = conf.group("FeedbackStyle"); - - c.writeEntry("BusyCursor", cb_busyCursor->currentIndex() != 0); - c.writeEntry("TaskbarButton", cb_taskbarButton->isChecked()); - - c = conf.group("BusyCursorSettings"); - c.writeEntry( "Timeout", sb_cursorTimeout->value()); - c.writeEntry("Blinking", cb_busyCursor->currentIndex() == 2); - c.writeEntry("Bouncing", cb_busyCursor->currentIndex() == 3); - - c = conf.group("TaskbarButtonSettings"); - c.writeEntry( "Timeout", sb_taskbarTimeout->value()); - - c.sync(); - - emit changed( false ); - - org::kde::kwin::Effects kwin(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus()); - kwin.reconfigureEffect(QStringLiteral("startupfeedback")); -} - -void -LaunchConfig::defaults() -{ - cb_busyCursor->setCurrentIndex(3); // bouncing cursor - cb_taskbarButton->setChecked( (bool)(Default & TaskbarButton) ); - - sb_cursorTimeout->setValue( s_startupDefaultTimeout ); - sb_taskbarTimeout->setValue( s_startupDefaultTimeout ); - - slotBusyCursor(3); - slotTaskbarButton( (bool)(Default & TaskbarButton) ); - - checkChanged(); -} - -void -LaunchConfig::checkChanged() -{ - KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals); - KConfigGroup c = conf.group("FeedbackStyle"); - - bool savedBusyCursor = - c.readEntry("BusyCursor", (bool)(Default & BusyCursor)); - - bool savedTaskbarButton = - c.readEntry("TaskbarButton", (bool)(Default & TaskbarButton)); - - c = conf.group("BusyCursorSettings"); - unsigned int savedCursorTimeout = c.readEntry( "Timeout", s_startupDefaultTimeout ); - bool savedBusyBlinking =c.readEntry("Blinking", false); - bool savedBusyBouncing =c.readEntry("Bouncing", true); - - c = conf.group("TaskbarButtonSettings"); - unsigned int savedTaskbarTimeout = c.readEntry( "Timeout", s_startupDefaultTimeout ); - - bool newBusyCursor =cb_busyCursor->currentIndex()!=0; - - bool newTaskbarButton =cb_taskbarButton->isChecked(); - - bool newBusyBlinking= cb_busyCursor->currentIndex()==2; - bool newBusyBouncing= cb_busyCursor->currentIndex()==3; - - unsigned int newCursorTimeout = sb_cursorTimeout->value(); - - unsigned int newTaskbarTimeout = sb_taskbarTimeout->value(); - - emit changed( - savedBusyCursor != newBusyCursor - || - savedTaskbarButton != newTaskbarButton - || - savedCursorTimeout != newCursorTimeout - || - savedTaskbarTimeout != newTaskbarTimeout - || - savedBusyBlinking != newBusyBlinking - || - savedBusyBouncing != newBusyBouncing - ); -} - -#include "kcmlaunch.moc" diff --git a/kcms/launch/launchfeedback.h b/kcms/launch/launchfeedback.h new file mode 100644 --- /dev/null +++ b/kcms/launch/launchfeedback.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2001 Rik Hemsley (rikkus) + * Copyright (C) 2017 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 + */ + +#ifndef LAUNCHFEEDBACK_H +#define LAUNCHFEEDBACK_H + +#include + +class LaunchFeedback : public KQuickAddons::ConfigModule +{ + Q_OBJECT + + Q_PROPERTY(int busyCursorCurrentIndex READ busyCursorCurrentIndex WRITE setBusyCursorCurrentIndex NOTIFY busyCursorCurrentIndexChanged) + + Q_PROPERTY(bool taskManagerNotification READ taskManagerNotification WRITE setTaskManagerNotification NOTIFY taskManagerNotificationChanged) + + Q_PROPERTY(int notificationTimeout READ notificationTimeout WRITE setNotificationTimeout NOTIFY notificationTimeoutChanged) + + public: + explicit LaunchFeedback(QObject* parent = 0, const QVariantList &list = QVariantList()); + virtual ~LaunchFeedback(); + + int busyCursorCurrentIndex() const; + void setBusyCursorCurrentIndex(int index); + + bool taskManagerNotification() const; + void setTaskManagerNotification(bool enabled); + + int notificationTimeout() const; + void setNotificationTimeout(int duration); + + public Q_SLOTS: + void load(); + void save(); + void defaults(); + + Q_SIGNALS: + void busyCursorCurrentIndexChanged() const; + + void taskManagerNotificationChanged() const; + + void notificationTimeoutChanged() const; + + private: + void updateNeedsSave(); + + int m_busyCursorCurrentIndex; + + bool m_taskManagerNotification; + + int m_notificationTimeout; +}; + +#endif diff --git a/kcms/launch/launchfeedback.cpp b/kcms/launch/launchfeedback.cpp new file mode 100644 --- /dev/null +++ b/kcms/launch/launchfeedback.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2001 Rik Hemsley (rikkus) + * Copyright (C) 2017 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 + */ + +#include "launchfeedback.h" + +#include +#include +#include +#include +#include + +#include "kwin_interface.h" + +#define STARTUP_DEFAULT_TIMEOUT 5 + +K_PLUGIN_FACTORY_WITH_JSON(LaunchFactory, "kcm_launchfeedback.json", registerPlugin();) + +LaunchFeedback::LaunchFeedback(QObject *parent, const QVariantList &args) + : KQuickAddons::ConfigModule(parent, args) + , m_busyCursorCurrentIndex(3) + , m_taskManagerNotification(true) + , m_notificationTimeout(STARTUP_DEFAULT_TIMEOUT) +{ + KAboutData *about = new KAboutData("kcm_launchfeedback", + i18n("Configure application launch feedback"), + "0.2", QString(), KAboutLicense::LGPL); + setAboutData(about); + + setButtons(Apply | Default); +} + +LaunchFeedback::~LaunchFeedback() +{ +} + +int LaunchFeedback::busyCursorCurrentIndex() const +{ + return m_busyCursorCurrentIndex; +} + +void LaunchFeedback::setBusyCursorCurrentIndex(int index) +{ + if (m_busyCursorCurrentIndex != index) { + m_busyCursorCurrentIndex = index; + + emit busyCursorCurrentIndexChanged(); + + updateNeedsSave(); + } +} + +bool LaunchFeedback::taskManagerNotification() const +{ + return m_taskManagerNotification; +} + +void LaunchFeedback::setTaskManagerNotification(bool enabled) +{ + if (m_taskManagerNotification != enabled) { + m_taskManagerNotification = enabled; + + emit taskManagerNotificationChanged(); + + updateNeedsSave(); + } +} + +int LaunchFeedback::notificationTimeout() const +{ + return m_notificationTimeout; +} + +void LaunchFeedback::setNotificationTimeout(int duration) +{ + if (m_notificationTimeout != duration) { + m_notificationTimeout = duration; + + emit notificationTimeoutChanged(); + + updateNeedsSave(); + } +} + +void LaunchFeedback::load() +{ + KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals); + KConfigGroup c = conf.group("FeedbackStyle"); + + const bool busyCursor = c.readEntry("BusyCursor", true); + + setTaskManagerNotification(c.readEntry("TaskbarButton", true)); + + c = conf.group("BusyCursorSettings"); + + setNotificationTimeout(c.readEntry("Timeout", STARTUP_DEFAULT_TIMEOUT)); + + bool busyBlinking = c.readEntry("Blinking", false); + bool busyBouncing = c.readEntry("Bouncing", true); + + if (!busyCursor) { + setBusyCursorCurrentIndex(0); + } else if (busyBlinking) { + setBusyCursorCurrentIndex(2); + } else if (busyBouncing) { + setBusyCursorCurrentIndex(3); + } else { + setBusyCursorCurrentIndex(1); + } +} + +void LaunchFeedback::save() +{ + KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals); + KConfigGroup c = conf.group("FeedbackStyle"); + + c.writeEntry("BusyCursor", m_busyCursorCurrentIndex != 0); + c.writeEntry("TaskbarButton", m_taskManagerNotification); + + c = conf.group("BusyCursorSettings"); + c.writeEntry("Timeout", m_notificationTimeout); + c.writeEntry("Blinking", m_busyCursorCurrentIndex == 2); + c.writeEntry("Bouncing", m_busyCursorCurrentIndex == 3); + + c = conf.group("TaskbarButtonSettings"); + c.writeEntry( "Timeout", m_notificationTimeout); + + c.sync(); + + setNeedsSave(false); + + org::kde::kwin::Effects kwin(QStringLiteral("org.kde.KWin"), + QStringLiteral("/Effects"), + QDBusConnection::sessionBus()); + kwin.reconfigureEffect(QStringLiteral("startupfeedback")); +} + +void LaunchFeedback::defaults() +{ + setBusyCursorCurrentIndex(3); // Bouncing cursor. + + setTaskManagerNotification(true); + + setNotificationTimeout(STARTUP_DEFAULT_TIMEOUT); +} + +void LaunchFeedback::updateNeedsSave() +{ + bool needsSave = false; + + KConfig conf(QStringLiteral("klaunchrc"), KConfig::NoGlobals); + KConfigGroup c = conf.group("FeedbackStyle"); + + const bool savedBusyCursor = c.readEntry("BusyCursor", true); + + if (m_taskManagerNotification != c.readEntry("TaskbarButton", true)) { + needsSave = true; + } + + c = conf.group("BusyCursorSettings"); + + if (m_notificationTimeout != c.readEntry("Timeout", STARTUP_DEFAULT_TIMEOUT)) { + needsSave = true; + } + + int savedBusyCursorIndex = 3; // Bouncing cursor (default); + + bool savedBusyBlinking = c.readEntry("Blinking", false); + bool savedBusyBouncing = c.readEntry("Bouncing", true); + + if (!savedBusyCursor) { + savedBusyCursorIndex = 0; + } else if (savedBusyBlinking) { + savedBusyCursorIndex = 2; + } else if (savedBusyBouncing) { + savedBusyCursorIndex = 3; + } else { + savedBusyCursorIndex = 1; + } + + if (m_busyCursorCurrentIndex != savedBusyCursorIndex) { + needsSave = true; + } + + setNeedsSave(needsSave); +} + +#include "launchfeedback.moc" diff --git a/kcms/launch/package/contents/ui/main.qml b/kcms/launch/package/contents/ui/main.qml new file mode 100644 --- /dev/null +++ b/kcms/launch/package/contents/ui/main.qml @@ -0,0 +1,120 @@ +/* + Copyright (c) 2017 Eike Hein + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 as QtControls +import org.kde.kirigami 2.3 as Kirigami +import org.kde.kcm 1.1 + +SimpleKCM { + id: root + + ConfigModule.quickHelp: i18n("Launch Feedback") + + function applyBusyCursorCurrentIndex() { + if (kcm.busyCursorCurrentIndex == 0) { + busyCursorDisabled.checked = true; + } else if (kcm.busyCursorCurrentIndex == 1) { + busyCursorStatic.checked = true; + } else if (kcm.busyCursorCurrentIndex == 2) { + busyCursorBlinking.checked = true; + } else if (kcm.busyCursorCurrentIndex == 3) { + busyCursorBouncing.checked = true; + } + } + + Kirigami.FormLayout { + id: formLayout + + Connections { + target: kcm + + onBusyCursorCurrentIndexChanged: applyBusyCursorCurrentIndex() + + onTaskManagerNotificationChanged: taskManagerNotification.checked = kcm.taskManagerNotification + + onNotificationTimeoutChanged: notificationTimeout.value = kcm.notificationTimeout + } + + ColumnLayout { + Kirigami.FormData.label: i18n("Cursor:") + + QtControls.RadioButton { + id: busyCursorDisabled + + text: i18n("No Feedback") + + onCheckedChanged: Qt.later(function() { kcm.busyCursorCurrentIndex = 0; }) + } + + QtControls.RadioButton { + id: busyCursorStatic + + text: i18n("Static") + + onCheckedChanged: Qt.later(function() { kcm.busyCursorCurrentIndex = 1; }) + } + + QtControls.RadioButton { + id: busyCursorBlinking + + text: i18n("Blinking") + + onCheckedChanged: Qt.later(function() { kcm.busyCursorCurrentIndex = 2; }) + } + + QtControls.RadioButton { + id: busyCursorBouncing + + text: i18n("Bouncing") + + onCheckedChanged: Qt.later(function() { kcm.busyCursorCurrentIndex = 3; }) + } + } + + QtControls.CheckBox { + id: taskManagerNotification + + Kirigami.FormData.label: i18n("Task Manager:") + + text: i18n("Enable animation") + + checked: kcm.taskManagerNotification + onCheckedChanged: kcm.taskManagerNotification = checked + } + + QtControls.SpinBox { + id: notificationTimeout + + Kirigami.FormData.label: i18n("Stop animation after:") + + stepSize: 1 + + enabled: taskManagerNotification.checked + + value: kcm.notificationTimeout + onValueChanged: kcm.notificationTimeout = value + + textFromValue: function(value, locale) { return i18np("%1 sec", "%1 secs", value)} + } + } + + Component.onCompleted: applyBusyCursorCurrentIndex() +} + diff --git a/kcms/launch/package/metadata.desktop b/kcms/launch/package/metadata.desktop new file mode 100644 --- /dev/null +++ b/kcms/launch/package/metadata.desktop @@ -0,0 +1,145 @@ +[Desktop Entry] +Name=Launch Feedback +Name[af]=Lanseer Terugvoer +Name[ar]=إطلاق تغذية استرجاعيّة +Name[be@latin]=Vyjaŭleńnie ŭklučeńnia +Name[bg]=Обратна връзка +Name[bn]=লঞ্চ ফীডব্যাক +Name[bs]=Odziv pri pokretanju +Name[ca]=Reacció en iniciar +Name[ca@valencia]=Reacció en iniciar +Name[cs]=Odezva při spouštění aplikací +Name[csb]=Zrëszanié programów +Name[cy]=Adborth wrth Gychwyn +Name[da]=Opstartsfeedback +Name[de]=Programmstartanzeige +Name[el]=Ειδοποίηση εκκίνησης +Name[en_GB]=Launch Feedback +Name[eo]=Lanĉosignilo +Name[es]=Notificación de lanzamiento +Name[et]=Käivitamise tagasiside +Name[eu]=Abiaraztearen informazioa +Name[fa]=راه‌اندازی بازخورد +Name[fi]=Käynnistymisen ilmaiseminen +Name[fr]=Témoin de démarrage +Name[fy]=Begjinmelding +Name[ga]=Aiseolas Tosaithe +Name[gl]=Notificación de inicio +Name[gu]=પ્રતિસાદ શરૂ કરો +Name[he]=משוב הפעלת יישומים +Name[hi]=फ़ीडबैक चलाएँ +Name[hne]=फीडबैक चलाव +Name[hr]=Potvrda pokretanja +Name[hsb]=Feedback za startowanje +Name[hu]=Alkalmazásindítási effektus +Name[ia]=Retorno de lanceamento +Name[id]=Jalankan Umpan Balik +Name[is]=Upplýsingar um ræsingu +Name[it]=Segnale di avvio delle applicazioni +Name[ja]=起動フィードバック +Name[ka]=პროგრამის გაშვება +Name[kk]=Жегу барысы +Name[km]=ប្រតិកម្ម​ពេល​ចាប់ផ្ដើម +Name[kn]=ಪ್ರಕ್ಷೇಪಣಾ (ಲಾಂಚ್) ಪ್ರತ್ಯಾದಾನ (ಫೀಡ್ ಬ್ಯಾಕ್) +Name[ko]=실행 피드백 +Name[ku]=Yêdekê bide destpê kirin +Name[lt]=Paleidimo atsakas +Name[lv]=Atbildes palaidējs +Name[mai]=फीडबैक चलाबू +Name[mk]=Повратна инфо. за старт +Name[ml]=അഭിപ്രായങ്ങള്‍ ലഭ്യമാക്കുക +Name[mr]=प्रक्षेपण प्रतिसाद +Name[ms]=Lancar Maklum Balas +Name[nb]=Oppstartsmelding +Name[nds]=Startanimatschoon +Name[ne]=पृष्ठपोषण सुरुआत गर्नुहोस् +Name[nl]=Opstartnotificatie +Name[nn]=Programstart­melding +Name[pa]=ਫੀਡਬੈਕ ਲਾਂਚ ਕਰੋ +Name[pl]=Wrażenia przy uruchamianiu +Name[pt]=Comportamento da Execução +Name[pt_BR]=Aviso de execução +Name[ro]=Indicator de execuție +Name[ru]=Запуск приложений +Name[se]=Prográmmaálggahan ávaštus +Name[si]=ප්‍රතිචාරය ධාවනය කරන්න +Name[sk]=Odozva pri spustení aplikácie +Name[sl]=Odziv zagona +Name[sr]=Одзив при покретању +Name[sr@ijekavian]=Одзив при покретању +Name[sr@ijekavianlatin]=Odziv pri pokretanju +Name[sr@latin]=Odziv pri pokretanju +Name[sv]=Gensvar vid start +Name[ta]=கருத்தை தொடங்கு +Name[te]=లాంచ్ ప్రతిస్పందన +Name[tg]=Запуск приложений +Name[th]=ตอบสนองการเรียกโปรแกรม +Name[tr]=Başlatma Geribildirimi +Name[ug]=قايتما ئىنكاسنى قوزغات +Name[uk]=Показ запуску +Name[uz]=Dastur ishga tushish xabarnomasi +Name[uz@cyrillic]=Дастур ишга тушиш хабарномаси +Name[vi]=Khởi chạy Phản hồi +Name[wa]=Ritoû d' enondaedje +Name[xh]=Launch Feedback +Name[x-test]=xxLaunch Feedbackxx +Name[zh_CN]=启动反馈 +Name[zh_TW]=程式啟動回饋風格 + +Comment=Application Launch Feedback +Comment[ar]=تطبيق لإطلاق تغذية استرجاعيّة +Comment[bs]=Povratna veza pokretanja aplikacije +Comment[ca]=Reacció en iniciar les aplicacions +Comment[ca@valencia]=Reacció en iniciar les aplicacions +Comment[cs]=Odezva při spouštění aplikací +Comment[da]=Feedback ved programopstart +Comment[de]=Anwendungsstartanzeige +Comment[el]=Ειδοποίηση εκκίνησης εφαρμογών +Comment[en_GB]=Application Launch Feedback +Comment[es]=Notificación del lanzamiento de aplicaciones +Comment[et]=Rakenduste käivitamise tagasiside +Comment[eu]=Aplikazio jaurtitzearen informazioa +Comment[fi]=Ohjelmien käynnistymisen ilmaiseminen +Comment[fr]=Indicateur de lancement d'application +Comment[gl]=Indicación do inicio dun aplicativo +Comment[he]=משוב הפעלת יישומים +Comment[hu]=Alkalmazásindítási effektus +Comment[id]=Umpan Balik Jalankan Aplikasi +Comment[is]=Upplýsingar við forritaræsingu +Comment[it]=Segnale di avvio delle applicazioni +Comment[ja]=アプリケーションの起動フィードバック +Comment[ko]=프로그램 실행 피드백 +Comment[lt]=Programų paleidimo atsakas +Comment[mr]=अनुप्रयोग प्रक्षेपण प्रतिसाद +Comment[nb]=Tilbakemelding ved programstart +Comment[nds]=Startanimatschoon +Comment[nl]=Terugkoppeling van starten van toepassing +Comment[nn]=Melding om programstart +Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਲਾਂਚ ਫੀਡਬੈਕ +Comment[pl]=Wrażenia przy uruchamianiu programów +Comment[pt]=Reacção de Lançamento das Aplicações +Comment[pt_BR]=Aviso de execução dos aplicativos +Comment[ru]=Настройка отклика приложений при запуске +Comment[sk]=Odozva spúšťača aplikácií +Comment[sl]=Odziv zagona programa +Comment[sr]=Одзив при покретању програма +Comment[sr@ijekavian]=Одзив при покретању програма +Comment[sr@ijekavianlatin]=Odziv pri pokretanju programa +Comment[sr@latin]=Odziv pri pokretanju programa +Comment[sv]=Gensvar vid programstart +Comment[tr]=Uygulama Başlatıcısı Geri Beslemesi +Comment[uk]=Супровід запуску програм +Comment[x-test]=xxApplication Launch Feedbackxx +Comment[zh_CN]=应用程序启动反馈 +Comment[zh_TW]=應用程式啟動回饋 + +Icon=preferences-desktop-launch-feedback +Encoding=UTF-8 +Type=Service +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-Name=kcm_launchfeedback +X-KDE-ServiceTypes=Plasma/Generic +X-Plasma-API=declarativeappletscript + +X-Plasma-MainScript=ui/main.qml +X-Plasma-RemoteLocation=