diff --git a/CMakeLists.txt b/CMakeLists.txt index 744129e0..7435c51e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,6 @@ set_package_properties(X11 PROPERTIES TYPE REQUIRED ) -add_feature_info("libXcomposite" X11_Xcomposite_FOUND "The X11 Composite extension library may be used by Plasma and KWin") add_feature_info("libXSync" X11_XSync_FOUND "The X11 synchronization may be used by KWin") add_feature_info("libXinput" X11_Xinput_FOUND "The X11 XINPUT extension library may be used by touchpad handler") add_feature_info("libXRes" X11_XRes_FOUND "The X Resource library may be used by ksysguard") @@ -217,12 +216,6 @@ add_feature_info(wrestool "ICO thumbnails support in KIO slave" ) -find_program(QRENCODE_EXECUTABLE qrencode) -add_feature_info(qrencode - QRENCODE_EXECUTABLE - "QR Code support in klipper" -) - find_program(CTAGS_EXECUTABLE ctags ctags-universal ctags-exuberant exctags uctags) add_feature_info(ctags CTAGS_EXECUTABLE @@ -291,7 +284,6 @@ add_subdirectory(qguiplatformplugin_kde) add_subdirectory(ksysguard) add_subdirectory(kcontrol) -add_subdirectory(klipper) add_subdirectory(kmenuedit) add_subdirectory(krunner) add_subdirectory(kinfocenter) @@ -306,7 +298,6 @@ endif(LightDM_FOUND) add_subdirectory(cursors) add_subdirectory(plasma) -add_subdirectory(statusnotifierwatcher) add_subdirectory(kstyles) # Imported from kde-runtime and other sub-projects diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index f5c9b159..35018fcd 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -7,12 +7,9 @@ check_function_exists(nice HAVE_NICE) check_include_files(malloc.h HAVE_MALLOC_H) kde4_bool_to_01(FONTCONFIG_FOUND HAVE_FONTCONFIG) # kcontrol/fonts kde4_bool_to_01(FREETYPE_FOUND HAVE_FREETYPE) # kcontrol/fonts -kde4_bool_to_01(X11_Xcomposite_FOUND HAVE_XCOMPOSITE) # plasma, kwin kde4_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) # many uses -kde4_bool_to_01(X11_Xdamage_FOUND HAVE_XDAMAGE) # kwin -kde4_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) # klipper, kicker, kwin +kde4_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) # kicker, kwin kde4_bool_to_01(X11_Xkb_FOUND HAVE_XKB) # kglobalaccel -kde4_bool_to_01(X11_Xrandr_FOUND HAVE_XRANDR) # kwin kde4_bool_to_01(X11_XSync_FOUND HAVE_XSYNC) # kwin kde4_bool_to_01(X11_XRes_FOUND HAVE_XRES) # ksysguard kde4_bool_to_01(X11_dpms_FOUND HAVE_DPMS) # kscreensaver diff --git a/config-X11.h.cmake b/config-X11.h.cmake index 07aa92b4..3134ec85 100644 --- a/config-X11.h.cmake +++ b/config-X11.h.cmake @@ -1,15 +1,6 @@ -/* Define if you have the XRandR extension */ -#cmakedefine HAVE_XRANDR 1 - -/* Define if you have the XDamage extension */ -#cmakedefine HAVE_XDAMAGE 1 - /* Define if you have the XKB extension */ #cmakedefine HAVE_XKB 1 -/* Define if you have the XComposite extension */ -#cmakedefine HAVE_XCOMPOSITE 1 - /* Define to 1 if you have Xcursor */ #cmakedefine HAVE_XCURSOR 1 diff --git a/dolphin/src/dolphin.desktop b/dolphin/src/dolphin.desktop index 5890e068..b09048ed 100755 --- a/dolphin/src/dolphin.desktop +++ b/dolphin/src/dolphin.desktop @@ -188,4 +188,3 @@ MimeType=inode/directory; InitialPreference=10 StartupNotify=true X-KDE-MediaPlayer=informationpanel -X-KDE-HasTrayOption=true diff --git a/kate/part/view/kateview.cpp b/kate/part/view/kateview.cpp index 96fe5ccf..df30e435 100644 --- a/kate/part/view/kateview.cpp +++ b/kate/part/view/kateview.cpp @@ -341,7 +341,7 @@ void KateView::setupActions() m_cut = a = ac->addAction(KStandardAction::Cut, this, SLOT(cut())); a->setWhatsThis(i18n("Cut the selected text and move it to the clipboard")); - m_paste = a = ac->addAction(KStandardAction::PasteText, this, SLOT(paste())); + m_paste = a = ac->addAction(KStandardAction::Paste, this, SLOT(paste())); a->setWhatsThis(i18n("Paste previously copied or cut clipboard contents")); m_copy = a = ac->addAction(KStandardAction::Copy, this, SLOT(copy())); diff --git a/kate/src/data/kate.desktop b/kate/src/data/kate.desktop index 62f7f187..fcd5abaf 100755 --- a/kate/src/data/kate.desktop +++ b/kate/src/data/kate.desktop @@ -121,7 +121,6 @@ MimeType=text/plain; Exec=kate --icon '%i' --caption '%c' -b %U StartupNotify=true X-KDE-HasTempFileOption=true -X-KDE-HasTrayOption=true Icon=kate X-DocPath=kate/index.html Type=Application diff --git a/kcontrol/keys/schemes/kde3.kksrc b/kcontrol/keys/schemes/kde3.kksrc index 6d127611..0be19b46 100644 --- a/kcontrol/keys/schemes/kde3.kksrc +++ b/kcontrol/keys/schemes/kde3.kksrc @@ -84,11 +84,6 @@ Name[zh_CN]=三个修饰键的 KDE 默认值 Name[zh_TW]=KDE 預設 3 個變更鍵 Uses Win Modifier=false -[klipper][Global Shortcuts] -clipboard_action=Ctrl+Alt+X -repeat_action=Ctrl+Alt+R -show-on-mouse-pos=Ctrl+Alt+V - [krunner][Global Shortcuts] Run Command=Alt+F2 Show System Activity=Ctrl+Esc @@ -128,8 +123,8 @@ Walk Through Desktop List (Reverse)=Ctrl+Shift+Tab Walk Through Desktop List=Ctrl+Tab Walk Through Desktops (Reverse)=none Walk Through Desktops=none -Walk Through Windows (Reverse)=Alt+Shift+Tab -Walk Through Windows=Alt+Tab +Toggle Present Windows (Current desktop)=Alt+Tab +Toggle Present Windows (Window class)=Alt+Shift+Tab Window Close=Alt+F4 Window Lower=none Window Maximize Horizontal=none diff --git a/kcontrol/keys/schemes/kde4.kksrc b/kcontrol/keys/schemes/kde4.kksrc index d187d3b9..9017954f 100644 --- a/kcontrol/keys/schemes/kde4.kksrc +++ b/kcontrol/keys/schemes/kde4.kksrc @@ -84,11 +84,6 @@ Name[zh_CN]=四个修饰键的 KDE 默认值 Name[zh_TW]=KDE 預設 4 個變更鍵 Uses Win Modifier=true -[klipper][Global Shortcuts] -clipboard_action=Meta+Ctrl+X -repeat_action=Meta+Ctrl+R -show-on-mouse-pos=Meta+Ctrl+V - [krunner][Global Shortcuts] Run Command=Meta+Return; Alt+F2 Show System Activity=Meta+Ctrl+Pause @@ -128,8 +123,8 @@ Walk Through Desktop List (Reverse)=none Walk Through Desktop List=none Walk Through Desktops (Reverse)=Meta+Shift+Tab Walk Through Desktops=Meta+Tab -Walk Through Windows (Reverse)=Alt+Shift+Tab -Walk Through Windows=Alt+Tab +Toggle Present Windows (Current desktop)=Alt+Tab +Toggle Present Windows (Window class)=Alt+Shift+Tab Window Close=Alt+Esc; Alt+F4 Window Lower=none Window Maximize Horizontal=Meta+= diff --git a/kcontrol/keys/schemes/mac4.kksrc b/kcontrol/keys/schemes/mac4.kksrc index 46e4dcf6..2c595b1c 100644 --- a/kcontrol/keys/schemes/mac4.kksrc +++ b/kcontrol/keys/schemes/mac4.kksrc @@ -89,11 +89,6 @@ Name[zh_CN]=Mac 方案 Name[zh_TW]=Mac 機制 Uses Win Modifier=true -[klipper][Global Shortcuts] -clipboard_action=Ctrl+Alt+X -repeat_action=Ctrl+Alt+R -show-on-mouse-pos=Ctrl+Alt+V - [krunner][Global Shortcuts] Run Command=Alt+F2 Show System Activity=Ctrl+Esc @@ -133,8 +128,8 @@ Walk Through Desktop List (Reverse)=none Walk Through Desktop List=none Walk Through Desktops (Reverse)=Alt+Shift+Tab Walk Through Desktops=Alt+Tab -Walk Through Windows (Reverse)=Ctrl+Shift+Tab -Walk Through Windows=Ctrl+Tab +Toggle Present Windows (Current desktop)=Ctrl+Tab +Toggle Present Windows (Window class)=Ctrl+Shift+Tab Window Close=Alt+F4 Window Lower=none Window Maximize Horizontal=none diff --git a/kcontrol/keys/schemes/split_kksrc b/kcontrol/keys/schemes/split_kksrc index 9fab61e4..fb35182d 100755 --- a/kcontrol/keys/schemes/split_kksrc +++ b/kcontrol/keys/schemes/split_kksrc @@ -29,7 +29,6 @@ foreach my $file( @ARGV ) my $process = 0; my @kwin; my @krunner; - my @klipper; my @kxkb; for( <$FILEHD> ) { @@ -65,10 +64,6 @@ foreach my $file( @ARGV ) /Switch to Next Keyboard Layout/ and do { push @kxkb, $_; next; }; - /clipboard_action/ and do { push @klipper, $_; next; }; - /repeat_action/ and do { push @klipper, $_; next; }; - /show_klipper_popup/ and do { push @klipper, $_; next; }; - /Halt without Confirmation/ and do { s/Halt without Confirmation/Halt Without Confirmation/; push @krunner, $_; next; }; /Lock Session/ and do { push @krunner, $_; next; }; /Log Out/ and do { push @krunner, $_; next; }; @@ -82,8 +77,6 @@ foreach my $file( @ARGV ) print $OLDHD $_; } - print $NEWHD "\n[klipper][Global Shortcuts]\n"; - print $NEWHD sort @klipper; print $NEWHD "\n[krunner][Global Shortcuts]\n"; print $NEWHD sort @krunner; print $NEWHD "\n[kwin][Global Shortcuts]\n"; diff --git a/kcontrol/keys/schemes/unix3.kksrc b/kcontrol/keys/schemes/unix3.kksrc index 1d95dff8..56df0a09 100644 --- a/kcontrol/keys/schemes/unix3.kksrc +++ b/kcontrol/keys/schemes/unix3.kksrc @@ -89,11 +89,6 @@ Name[zh_CN]=Unix 方案 Name[zh_TW]=UNIX 機制 Uses Win Modifier=false -[klipper][Global Shortcuts] -clipboard_action=none -repeat_action=Ctrl+Alt+R -show-on-mouse-pos=none - [krunner][Global Shortcuts] Run Command=Alt+F2 Show System Activity=Ctrl+Esc @@ -133,8 +128,8 @@ Walk Through Desktop List (Reverse)=Ctrl+Shift+Tab Walk Through Desktop List=none Walk Through Desktops (Reverse)=none Walk Through Desktops=Ctrl+Tab -Walk Through Windows (Reverse)=Alt+Shift+Tab -Walk Through Windows=Alt+F11 +Toggle Present Windows (Current desktop)=Alt+F11 +Toggle Present Windows (Window class)=Alt+Shift+Tab Window Close=none Window Lower=none Window Maximize Horizontal=none diff --git a/kcontrol/keys/schemes/win3.kksrc b/kcontrol/keys/schemes/win3.kksrc index d902b9d2..49422f1b 100644 --- a/kcontrol/keys/schemes/win3.kksrc +++ b/kcontrol/keys/schemes/win3.kksrc @@ -88,11 +88,6 @@ Name[zh_CN]=Windows 方案(无 Win 键) Name[zh_TW]=Windows 機制(沒有 Win 鍵) Uses Win Modifier=false -[klipper][Global Shortcuts] -clipboard_action=none -repeat_action=none -show-on-mouse-pos=none - [krunner][Global Shortcuts] Run Command=none Show System Activity=Ctrl+Alt+Del @@ -132,8 +127,8 @@ Walk Through Desktop List (Reverse)=none Walk Through Desktop List=none Walk Through Desktops (Reverse)=Ctrl+Alt+Shift+Tab Walk Through Desktops=Ctrl+Alt+Tab -Walk Through Windows (Reverse)=Alt+Shift+Tab -Walk Through Windows=Alt+Tab +Toggle Present Windows (Current desktop)=Alt+Tab +Toggle Present Windows (Window class)=Alt+Shift+Tab Window Close=Alt+F4 Window Lower=none Window Maximize Horizontal=none diff --git a/kcontrol/keys/schemes/win4.kksrc b/kcontrol/keys/schemes/win4.kksrc index a65096c4..bc4e69f2 100644 --- a/kcontrol/keys/schemes/win4.kksrc +++ b/kcontrol/keys/schemes/win4.kksrc @@ -88,11 +88,6 @@ Name[zh_CN]=Windows 方案(有 Win 键) Name[zh_TW]=Windows 機制(有 Win 鍵) Uses Win Modifier=true -[klipper][Global Shortcuts] -clipboard_action=none -repeat_action=none -show-on-mouse-pos=none - [krunner][Global Shortcuts] Run Command=Meta+R Show System Activity=Ctrl+Alt+Del @@ -132,8 +127,8 @@ Walk Through Desktop List (Reverse)=none Walk Through Desktop List=none Walk Through Desktops (Reverse)=Meta+Shift+Tab Walk Through Desktops=Meta+Tab -Walk Through Windows (Reverse)=Alt+Shift+Tab -Walk Through Windows=Alt+Tab +Toggle Present Windows (Current desktop)=Alt+Tab +Toggle Present Windows (Window class)=Alt+Shift+Tab Window Close=Alt+F4 Window Lower=none Window Maximize Horizontal=none diff --git a/kcontrol/keys/schemes/wm3.kksrc b/kcontrol/keys/schemes/wm3.kksrc index 0e540f61..158c25fd 100644 --- a/kcontrol/keys/schemes/wm3.kksrc +++ b/kcontrol/keys/schemes/wm3.kksrc @@ -83,11 +83,6 @@ Name[x-test]=xxWindowMaker (3 Modifier Keys)xx Name[zh_CN]=WindowMaker (三个修饰键) Name[zh_TW]=WindowMaker(3 個變更鍵) -[klipper][Global Shortcuts] -clipboard_action=Ctrl+Alt+X -repeat_action=Ctrl+Alt+R -show-on-mouse-pos=Ctrl+Alt+V - [krunner][Global Shortcuts] Run Command=Alt+F2 Show System Activity=Ctrl+Esc @@ -127,8 +122,8 @@ Walk Through Desktop List (Reverse)=Ctrl+Shift+Tab Walk Through Desktop List=Ctrl+Tab Walk Through Desktops (Reverse)=none Walk Through Desktops=none -Walk Through Windows (Reverse)=Alt+Shift+Tab -Walk Through Windows=Alt+Tab +Toggle Present Windows (Current desktop)=Alt+Tab +Toggle Present Windows (Window class)=Alt+Shift+Tab Window Close=Alt+Esc Window Lower=none Window Maximize Horizontal=none diff --git a/kcontrol/randr/CMakeLists.txt b/kcontrol/randr/CMakeLists.txt index c967d32b..5a9d09a8 100644 --- a/kcontrol/randr/CMakeLists.txt +++ b/kcontrol/randr/CMakeLists.txt @@ -42,34 +42,8 @@ install( ########### next target ############### -set(krandrtray_SRCS - ${randrinternal_PART_SRCS} - main.cpp - krandrtray.cpp - krandrapp.cpp -) - -add_executable(krandrtray ${krandrtray_SRCS}) - -target_link_libraries(krandrtray - KDE4::kcmutils - ${X11_Xrandr_LIB} - ${X11_LIBRARIES} -) - -install( - TARGETS krandrtray - DESTINATION ${KDE4_BIN_INSTALL_DIR} -) - -########### next target ############### - install( FILES randr.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR} ) -install( - PROGRAMS krandrtray.desktop - DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR} -) diff --git a/kcontrol/randr/krandrapp.cpp b/kcontrol/randr/krandrapp.cpp deleted file mode 100644 index 3d79d59f..00000000 --- a/kcontrol/randr/krandrapp.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2007 Gustavo Pichorim Boiko - * Copyright (c) 2002,2003 Hamish Rodda - * - * 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 - -#include -#include "krandrapp.h" -#include "moc_krandrapp.cpp" -#include "krandrtray.h" -#include "randrscreen.h" -#include - -KRandRApp::KRandRApp() -{ - m_display = new RandRDisplay(); - m_tray = new KRandRSystemTray(m_display); - m_tray->setObjectName("RANDRTray"); - - // do not close when the last window is closed: - // the system tray is not considered a window, so when the confirm dialog is - // closed, the application exits - setQuitOnLastWindowClosed(false); -} - -bool KRandRApp::x11EventFilter(XEvent* e) -{ - if (m_display->canHandle(e)) { - m_display->handleEvent(e); - } - - return KApplication::x11EventFilter(e); -} diff --git a/kcontrol/randr/krandrapp.h b/kcontrol/randr/krandrapp.h deleted file mode 100644 index fa17c1bb..00000000 --- a/kcontrol/randr/krandrapp.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2007 Gustavo Pichorim Boiko - * Copyright (c) 2002 Hamish Rodda - * - * 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 KRANDRAPP_H -#define KRANDRAPP_H - -#include - -class KRandRSystemTray; -class RandRConfig; -class RandRDisplay; - -class KRandRApp : public KUniqueApplication -{ - Q_OBJECT -public: - KRandRApp(); - - virtual bool x11EventFilter(XEvent * e); - -private: - KRandRSystemTray *m_tray; - RandRDisplay *m_display; -}; - -#endif // KRANDRAPP_H diff --git a/kcontrol/randr/krandrtray.cpp b/kcontrol/randr/krandrtray.cpp deleted file mode 100644 index 836ad263..00000000 --- a/kcontrol/randr/krandrtray.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2007 Gustavo Pichorim Boiko - * Copyright (c) 2002,2003 Hamish Rodda - * - * 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 - -#include "krandrtray.h" -#include "moc_krandrtray.cpp" -#include "randrscreen.h" -#include "randroutput.h" -#include "randrmode.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -KRandRSystemTray::KRandRSystemTray(RandRDisplay *dpy, QWidget* parent) - : KStatusNotifierItem(parent), - m_help(new KHelpMenu(parent, KGlobal::mainComponent().aboutData(), false, actionCollection())), - m_display(dpy) -{ - setIconByName("preferences-desktop-display-randr"); - setCategory(Hardware); - - m_menu = new KMenu(associatedWidget()); - setContextMenu(m_menu); - setStatus(Active); - - //TODO: probably we need an about to show signal - connect(m_menu, SIGNAL(aboutToShow()), this, SLOT(slotPrepareMenu())); - m_display->refresh(); - updateToolTip(); - - OutputMap outputs = m_display->currentScreen()->outputs(); - foreach(RandROutput *output, outputs) { - connect(output, SIGNAL(outputChanged(RROutput,int)), this, SLOT(slotPrepareMenu())); - connect(output, SIGNAL(outputChanged(RROutput,int)), this, SLOT(updateToolTip())); - } -} - -KRandRSystemTray::~KRandRSystemTray() -{ - if (m_kcm) { - delete m_kcm.data(); - } -} - -void KRandRSystemTray::activate(const QPoint &pos) -{ - Q_UNUSED(pos) - slotPrefs(); -} - -void KRandRSystemTray::slotPrepareMenu() -{ - QAction *action; - - m_menu->clear(); - - if (!m_display->isValid()) { - action = m_menu->addAction(i18n("Required X Extension Not Available")); - action->setEnabled(false); - } else { - m_screenPopups.clear(); - for (int s = 0; s < m_display->numScreens(); s++) { - m_display->setCurrentScreen(s); - if (s == QX11Info::appScreen()) { - /*lastIndex = menu->insertItem(i18n("Screen %1").arg(s+1)); - menu->setItemEnabled(lastIndex, false);*/ - } else { - KMenu* subMenu = new KMenu(i18n("Screen %1", s+1), m_menu ); - subMenu->setObjectName( QString("screen%1").arg(s+1) ); - m_screenPopups.append(subMenu); - populateMenu(subMenu); - action = m_menu->addMenu(subMenu); - connect(subMenu, SIGNAL(activated(int)), SLOT(slotScreenActivated())); - } - } - - m_display->setCurrentScreen(m_display->screenIndexOfWidget(m_menu)); - if (m_display->needsRefresh()) { - kDebug() << "Configuration dirty, reloading settings..."; - m_display->refresh(); - updateToolTip(); - } - - populateMenu(m_menu); - } - - m_menu->addSeparator(); - - KAction *actPrefs = actionCollection()->addAction( QString() ); - actPrefs->setIcon( KIcon( "configure" ) ); - actPrefs->setText( i18n( "Configure Display..." ) ); - - connect( actPrefs, SIGNAL(triggered(bool)), SLOT(slotPrefs()) ); - m_menu->addAction( actPrefs ); - - m_menu->addMenu(/*SmallIcon("help-contents"),KStandardGuiItem::help().text(),*/ m_help->menu()); - QAction *quitAction = actionCollection()->action(KStandardAction::name(KStandardAction::Quit)); - m_menu->addAction( quitAction ); -} - -void KRandRSystemTray::slotScreenActivated() -{ - m_display->setCurrentScreen(m_screenPopups.indexOf(static_cast(sender()))); -} - -void KRandRSystemTray::updateToolTip() -{ - const QString icon = "preferences-desktop-display-randr"; - QString title = i18n("Display"); - QString subTitle = i18n("Resize, rotate and configure screens."); - if (m_display->isValid()) { - OutputMap outputs = m_display->currentScreen()->outputs(); - if (outputs.count() <= 0) { - return; - } - - RandRScreen *screen = m_display->currentScreen(); - Q_ASSERT(screen); - - if (screen->outputsUnified() && screen->connectedCount() > 1) { - SizeList sizes = screen->unifiedSizes(); - if (!sizes.isEmpty()) { - const QSize currentSize = screen->rect().size(); - subTitle = i18n("Resolution: %1 x %2", - QString::number(currentSize.width()), - QString::number(currentSize.height())); - int rotations = screen->unifiedRotations(); - if (rotations != RandR::Rotate0) { - int rotation = RandR::Rotate0; - foreach (RandROutput *output, screen->outputs()) { - if (output->isActive()) { - rotation = output->rotation(); - break; - } - } - - if (rotation != RandR::Rotate0) { - subTitle += "
" + i18n("Rotation: %1", RandR::rotationName(1 << rotation)); - } - } - } - } else { - QString details = ""; - bool first = true; - foreach(RandROutput *output, outputs) { - if (output->isConnected()) { - if (!output->isActive()) { - details += ""; - details += ""; - } else { - if (first) { - first = false; - details += ""; - } else { - details += ""; - } - details += ""; - - QSize currentSize = output->rect().size(); - if (output->rotation() & (RandR::Rotate90 | RandR::Rotate270)) { - currentSize = QSize(currentSize.height(), currentSize.width()); - } - details += "" + i18n("", - QString::number(currentSize.width()), - QString::number(currentSize.height())); - RateList rates = output->refreshRates(); - if (rates.count()) { - details += ""; - } - - int rotations = output->rotations(); - if (rotations != RandR::Rotate0 && output->rotation() != RandR::Rotate0) { - details += ""; - } - } - } - } - - if (details != "
 
" + output->name() - + " (" + i18n("Disabled") + ")
 
 
" + output->name() - + "
Resolution: %1 x %2
" + i18n("Refresh: ") + "" - + ki18n("%1 Hz").subs(output->refreshRate(), 0, 'f', 1).toString() - + "
" + i18n("Rotation: ") + "" - + RandR::rotationName(1 << output->rotation()) - + "
") { - subTitle = details + "
"; - } - } - } - - setToolTip(icon, title, subTitle); -} - -void KRandRSystemTray::populateMenu(KMenu* menu) -{ - QAction *action; - QActionGroup *actionGroup; - - OutputMap outputs = m_display->currentScreen()->outputs(); - if (outputs.count() <= 0) { - return; - } - - RandRScreen *screen = m_display->currentScreen(); - Q_ASSERT(screen); - - // if the outputs are unified, do not show output-specific size - // changing options in the tray. - if (screen->outputsUnified() && screen->connectedCount() > 1) { - SizeList sizes = screen->unifiedSizes(); - - if (sizes.count()) { - // populate unified sizes - QSize currentSize; - currentSize = screen->rect().size(); - - menu->addTitle(SmallIcon("view-fullscreen"), i18n("Screen Size")); - actionGroup = populateSizes(menu, sizes, currentSize); - connect(actionGroup, SIGNAL(triggered(QAction*)), screen, SLOT(slotResizeUnified(QAction*))); - - // if the outputs are unified, we can rotate the screen on all outputs - int rotations = screen->unifiedRotations(); - if (rotations != RandR::Rotate0) { - menu->addTitle(SmallIcon("view-refresh"), i18n("Orientation")); - int rotation = RandR::Rotate0; - foreach(RandROutput *output, screen->outputs()) { - if (output->isActive()) { - rotation = output->rotation(); - break; - } - } - - actionGroup = populateRotations(menu, rotations, rotation); - connect(actionGroup, SIGNAL(triggered(QAction*)), screen, SLOT(slotRotateUnified(QAction*))); - } - } - } else { - if (screen->connectedCount() != 1) { - menu->addTitle(SmallIcon("view-fullscreen"), i18n("Outputs")); - } - - RandROutput *primary = screen->primaryOutput(); - - foreach(RandROutput *output, outputs) { - if (output->isConnected()) { - KMenu *outputMenu; - if (screen->connectedCount() == 1) { - outputMenu = menu; - } else { - outputMenu = new KMenu(output->name()); - } - outputMenu->setIcon(SmallIcon(output->icon())); - outputMenu->addTitle(SmallIcon("view-fullscreen"), i18n("%1 - Screen Size", output->name())); - - QSize currentSize = output->rect().size(); - - // if the output is rotated 90 or 270, the returned rect is inverted - // so we need to invert the size before comparing - if (output->rotation() & (RandR::Rotate90 | RandR::Rotate270)) { - currentSize = QSize(currentSize.height(), currentSize.width()); - } - - actionGroup = populateSizes(outputMenu, output->sizes(), currentSize); - connect( - actionGroup, SIGNAL(triggered(QAction*)), - output, SLOT(slotChangeSize(QAction*)), - Qt::QueuedConnection - ); - - // if there is only one output active, do not show the disable option - // this prevents the user from doing wrong things ;) - kDebug() << "Active outputs: " << screen->activeCount(); - if (screen->activeCount() != 1) { - action = outputMenu->addAction(i18n("Disable")); - if (!output->crtc()) { - QFont font = action->font(); - font.setBold(true); - action->setFont(font); - } - connect(action, SIGNAL(triggered(bool)), output, SLOT(slotDisable())); - } - - // Display the rotations - int rotations = output->rotations(); - // Don't display the rotation options if there is no point (ie. none are supported) - // XFree86 4.3 does not include rotation support. - if (rotations != RandR::Rotate0) { - outputMenu->addTitle(SmallIcon("view-refresh"), i18n("Orientation")); - actionGroup = populateRotations(outputMenu, rotations, output->rotation()); - connect( - actionGroup, SIGNAL(triggered(QAction*)), - output, SLOT(slotChangeRotation(QAction*)), - Qt::QueuedConnection - ); - } - - // refresh rate - RateList rates = output->refreshRates(); - if (rates.count()) { - outputMenu->addTitle(SmallIcon("chronometer"), i18n("Refresh Rate")); - actionGroup = populateRates(outputMenu, rates, output->refreshRate()); - connect( - actionGroup, SIGNAL(triggered(QAction*)), - output, SLOT(slotChangeRefreshRate(QAction*)), - Qt::QueuedConnection - ); - } - - if (screen->connectedCount() != 1) { - outputMenu->addSeparator(); - action = outputMenu->addAction( - i18nc("(checkbox) designate this output as the primary output", "Primary output"), - output, - SLOT(slotSetAsPrimary(bool)) - ); - action->setCheckable(true); - action->setChecked(primary == output); - } - - - if (screen->connectedCount() != 1) { - menu->addMenu(outputMenu); - } - } - } - } - // if there is more than one output connected, give the option to unify the outputs - if (screen->connectedCount() != 1 && !screen->unifiedSizes().isEmpty()) { - menu->addSeparator(); - action = menu->addAction( i18n("Unify Outputs"), screen, SLOT(slotUnifyOutputs(bool)) ); - action->setCheckable(true); - action->setChecked(screen->outputsUnified()); - } -} - -QActionGroup *KRandRSystemTray::populateRotations(KMenu *menu, int rotations, int rotation) -{ - QAction *action; - QActionGroup *rotateGroup = new QActionGroup(menu); - rotateGroup->setExclusive(true); - - for (int i = 0; i < 6; i++) { - if ((1 << i) & rotations) { - action = menu->addAction(QIcon(RandR::rotationIcon(1 << i, rotation)), RandR::rotationName(1 << i)); - action->setCheckable(true); - - action->setData(1 << i); - if (rotation & (1 << i)) { - action->setChecked(true); - } - rotateGroup->addAction(action); - } - } - return rotateGroup; -} - -QActionGroup *KRandRSystemTray::populateSizes(KMenu *menu, const SizeList &sizes, const QSize &size) -{ - QAction *action; - QActionGroup *sizeGroup = new QActionGroup(menu); - sizeGroup->setExclusive(true); - for (int i = 0; i < sizes.count(); ++i) { - QSize s = sizes[i]; - action = menu->addAction(QString("%1 x %2").arg(s.width()).arg(s.height())); - action->setCheckable(true); - action->setData(s); - if (s == size) { - action->setChecked(true); - } - sizeGroup->addAction(action); - } - return sizeGroup; -} - -QActionGroup *KRandRSystemTray::populateRates(KMenu *menu, const RateList &rates, float rate) -{ - QAction *action; - QActionGroup *rateGroup = new QActionGroup(menu); - rateGroup->setExclusive(true); - - foreach(float r, rates) { - action = menu->addAction(ki18n("%1 Hz").subs(r, 0, 'f', 1).toString()); - action->setCheckable(true); - action->setData(r); - if (r == rate) { - action->setChecked(true); - } - rateGroup->addAction(action); - } - return rateGroup; -} - -void KRandRSystemTray::slotPrefs() -{ - if (!m_kcm) { - KCMultiDialog *kcm = new KCMultiDialog( associatedWidget() ); - kcm->setFaceType( KCMultiDialog::Plain ); - kcm->setWindowTitle( i18n( "Configure Display" ) ); - kcm->addModule( "randr" ); - kcm->setAttribute(Qt::WA_DeleteOnClose); - m_kcm = kcm; - } else if (KWindowSystem::activeWindow() == m_kcm.data()->winId()) { - m_kcm.data()->hide(); - return; - } - - KWindowSystem::setOnDesktop(m_kcm.data()->winId(), KWindowSystem::currentDesktop()); - m_kcm.data()->show(); - m_kcm.data()->raise(); - KWindowSystem::forceActiveWindow(m_kcm.data()->winId()); -} -// vim:noet:sts=8:sw=8: diff --git a/kcontrol/randr/krandrtray.desktop b/kcontrol/randr/krandrtray.desktop deleted file mode 100755 index ba4eea6b..00000000 --- a/kcontrol/randr/krandrtray.desktop +++ /dev/null @@ -1,259 +0,0 @@ -[Desktop Entry] -Name=KRandRTray -Name[af]=KRandRTray -Name[ar]=ضبط شاشة كيدي -Name[ast]=KRandRTray -Name[be]=Змена параметраў манітора -Name[be@latin]=KRandRTray -Name[bg]=KRandRTray -Name[bn]=KRandRTray -Name[bn_IN]=KRandRTray -Name[br]=KRandRTray -Name[bs]=KRandRTray -Name[ca]=KRandRTray -Name[ca@valencia]=KRandRTray -Name[cs]=KRandRTray -Name[csb]=KRandRTray -Name[da]=KRandRTray -Name[de]=KRandRTray -Name[el]=KRandRTray -Name[en_GB]=KRandRTray -Name[eo]=KRandRTray -Name[es]=KRandRTray -Name[et]=KRandRTray -Name[eu]=KRandRTray -Name[fi]=KRandRTray -Name[fr]=KRandRTray -Name[fy]=KRandRTray -Name[ga]=KRandRTray -Name[gl]=KRandRTray -Name[gu]=KRandRTray -Name[he]=KRandRTray -Name[hi]=के-रैँड-आर-ट्रे -Name[hne]=के-रैँड-आर-ट्रे -Name[hr]=KRandRTray -Name[hsb]=KRandRTray -Name[hu]=Képernyőfelbontás -Name[ia]=KRandRTray -Name[id]=KRandRTray -Name[is]=KRandRTray -Name[ja]=KRandRTray -Name[ka]=KRandRTray -Name[kk]=KRandRTray -Name[km]=KRandRTray -Name[kn]=ಕೆರಾಂಡರ್ಟ್ರೇ -Name[ko]=KRandRTray -Name[ku]=KRandRTray -Name[lt]=KRandRTray -Name[lv]=KRandRTray -Name[mai]=के-रैँड-आर-ट्रे -Name[mk]=KRandRTray -Name[ml]=KRandRTray -Name[mr]=के रैँडआर ट्रे -Name[ms]=KRandRTray -Name[nb]=KRandRTray -Name[nds]=KRandRTray -Name[ne]=KRandR ट्रे -Name[nl]=KRandRTray -Name[nn]=KRandRTray -Name[oc]=KRandRTray -Name[or]=KRandRTray -Name[pa]=KRandRTray -Name[pl]=KRandRTray -Name[pt]=KRandRTray -Name[pt_BR]=Ícone do KRandR -Name[ro]=KRandRTray -Name[ru]=KRandRTray -Name[se]=KRandRTray -Name[si]=KRandRTray -Name[sk]=KRandRTray -Name[sl]=KRandRTray -Name[sr]=К‑рандр-касета -Name[sr@ijekavian]=К‑рандр-касета -Name[sr@ijekavianlatin]=K‑RandR-kaseta -Name[sr@latin]=K‑RandR-kaseta -Name[sv]=Krandrtray -Name[ta]=KRandRTray -Name[te]=KRandRTray -Name[tg]=KRandRTray -Name[th]=KRandRTray -Name[tr]=KRandRTray -Name[ug]=KRandRTray -Name[uk]=KRandRTray -Name[uz]=KRandRTray -Name[uz@cyrillic]=KRandRTray -Name[vi]=KRandRTray -Name[wa]=KRandRTray -Name[x-test]=xxKRandRTrayxx -Name[zh_CN]=KRandRTray -Name[zh_TW]=KRandRTray -GenericName=Screen Resize & Rotate -GenericName[af]=Skerm Hervergroot & Roteer -GenericName[ar]=إعادة تحجيم وتدوير الشاشة -GenericName[ast]=Redimensionar y voltiar pantalla -GenericName[be]=Змена памераў экрана і перагортванне -GenericName[be@latin]=Aplet dla źmieny pamieraŭ i pavarotu ekrana -GenericName[bg]=Големина и въртене на екрана -GenericName[bn]=পর্দা মাপবদল ও আবর্তন -GenericName[br]=Adventañ ha treiñ ar skramm -GenericName[bs]=Promjena veličine i rotacija ekrana -GenericName[ca]=Amida i gira la pantalla -GenericName[ca@valencia]=Amida i gira la pantalla -GenericName[cs]=Změna velikosti a rotace obrazovky -GenericName[csb]=Òbrócenié ë zjinaka miarë ekranu -GenericName[cy]=Newid Maint a Cylchdroi'r Sgrîn -GenericName[da]=Ændr størrelse på skærm og Rotér -GenericName[de]=Bildschirmgröße & -ausrichtung ändern -GenericName[el]=Αλλαγή μεγέθους & Περιστροφή οθόνης -GenericName[en_GB]=Screen Resize & Rotate -GenericName[eo]=Regrandigi kaj turni ekranon -GenericName[es]=Redimensionar y rotar pantalla -GenericName[et]=Ekraani suuruse muutmine ja pööramine -GenericName[eu]=Pantailaren neurria-aldatzea eta biratzea -GenericName[fa]=تغییر اندازه و چرخش پرده -GenericName[fi]=Näytön kuvan koon muuttaminen ja kuvan kääntäminen -GenericName[fr]=Redimensionnement et rotation de l'écran -GenericName[fy]=Skerm rotearje en grutte wizigje -GenericName[ga]=An scáileán a rothlú agus a mhéid a athrú -GenericName[gl]=Rotar e mudar o tamaño da pantalla -GenericName[gu]=સ્ક્રિન માપ બદલો અને ફેરવો -GenericName[he]=שינוי גודל המסך וסיבובו -GenericName[hi]=स्क्रीन आकार बदलें व घुमाएँ -GenericName[hne]=स्क्रीन आकार बदलव अउ घुमाव -GenericName[hr]=Veličine i orijentacija zaslona -GenericName[hsb]=Wobrazowku připrawić a wjerćeć -GenericName[hu]=Képernyőbeállító -GenericName[ia]=Redimensiona & Rota le schermo -GenericName[id]=Ubah Ukuran & Rotasi Layar -GenericName[is]=Stærð og snúningur skjáa -GenericName[ja]=スクリーンのリサイズと回転 -GenericName[ka]=ეკრანის ზომა და ორიენტაცია -GenericName[kk]=Экранды өзгерту & бұрау -GenericName[km]=ប្ដូរ​ទំហំ និង​បង្វិល​អេក្រង់ -GenericName[kn]=ತೆರೆಯ ಗಾತ್ರ ಬದಲಿಸು ಮತ್ತು ತಿರುಗಿಸು -GenericName[ko]=화면 크기 조정 및 회전 -GenericName[ku]=Guhertina Mezinahî û Hêla Ekranê -GenericName[lt]=Ekrano dydžio keitimas ir pasukimas -GenericName[lv]=Ekrāna izmērs un rotācija -GenericName[mai]=स्क्रीन आकार बदलू आ घुमाबू -GenericName[mk]=Големина и ротација на екранот -GenericName[ml]=സ്ക്രീനിന്റെ വലിപ്പം മാറ്റി തിരിക്കുക -GenericName[mr]=स्क्रीन आकार बदला व फिरवा -GenericName[ms]=Saiz Semula Skrin & Putar -GenericName[nb]=Endre størrelsen på og rotere skjermbildet -GenericName[nds]=Schirmgrött un -utrichten ännern -GenericName[ne]=पर्दा रिसाइज र परिक्रमण -GenericName[nl]=Scherm roteren en grootte wijzigen -GenericName[nn]=Endra storleiken på og roter skjermbiletet -GenericName[or]=ପରଦା ଆକାରବଦଳ ଏବଂ ଘୁରିବା -GenericName[pa]=ਸਕਰੀਨ ਮੁੜ-ਸਾਇਜ਼ ਅਤੇ ਘੁੰਮਾਓ -GenericName[pl]=Obrót i zmiana rozmiaru ekranu -GenericName[pt]=Mudar o Tamanho e Rodar o Ecrã -GenericName[pt_BR]=Redimensionar tela e rotacionar -GenericName[ro]=Redimensionare și rotire ecran -GenericName[ru]=Изменение размера и ориентации экрана -GenericName[se]=Rievdat šearbmagova sturrodaga ja jorat dan -GenericName[si]=තිර ප්‍රතිප්‍රමාණය හා භ්‍රමණය -GenericName[sk]=Zmena veľkosti a otočenie obrazovky -GenericName[sl]=Sprememba velikosti in vrtenje zaslona -GenericName[sr]=Промена величине и ротација екрана -GenericName[sr@ijekavian]=Промјена величине и ротација екрана -GenericName[sr@ijekavianlatin]=Promjena veličine i rotacija ekrana -GenericName[sr@latin]=Promena veličine i rotacija ekrana -GenericName[sv]=Ändra skärmstorlek och rotera -GenericName[ta]=திரை அளவு மாற்று & சுழற்று -GenericName[te]=తెర పునఃపరిమాణం & భ్రమణం -GenericName[tg]=Андоза ва ҷойгиршавии экран -GenericName[th]=ปรับขนาดและหมุนหน้าจอ -GenericName[tr]=Ekran Boyutlandır ve Döndür -GenericName[ug]=ئېكران چوڭلۇقى ۋە ئايلاندۇر -GenericName[uk]=Зміна розмірів та обертання зображення -GenericName[uz]=Ekraning oʻlchamini oʻzgartirish va burish -GenericName[uz@cyrillic]=Экранинг ўлчамини ўзгартириш ва буриш -GenericName[vi]=Quay và thay đổi cỡ màn hình -GenericName[wa]=Candjî l' grandeu del waitroûle eyet l' tourner -GenericName[x-test]=xxScreen Resize & Rotatexx -GenericName[zh_CN]=屏幕缩放和旋转 -GenericName[zh_TW]=螢幕調整大小及旋轉 -Comment=A panel applet for resizing and reorientating X screens. -Comment[ar]=لوحة تحكم لتغيير حجم واتجاه شاشات X -Comment[ast]=Una miniaplicación del panel pa redimensionar y reorientar pantalles X. -Comment[be@latin]=Aplet dla paneli, jaki absłuhoŭvaje źmienu pamieraŭ i pavarot ekranaŭ systemy X. -Comment[bg]=Аплет за преоразмеряване и ориентация на X. -Comment[bs]=Panelski aplet za promjenu veličine i orijentacije iks ekrana -Comment[ca]=Una miniaplicació del plafó per a redimensionar i reorientar les pantalles d'X. -Comment[ca@valencia]=Una miniaplicació del plafó per a redimensionar i reorientar les pantalles d'X. -Comment[cs]=Applet pro změnu velikosti a orientace obrazovky -Comment[csb]=Panel apletu do zmianë miarë ë pòłóżenia ekranów X -Comment[da]=Et panelprogram til at ændre størrelse og orientering for X-skærme. -Comment[de]=Ein Werkzeug zum Ändern der Bildschirmgröße und -ausrichtung -Comment[el]=Μια μικροεφαρμογή αλλαγής μεγέθους και προσανατολισμού οθονών Χ. -Comment[en_GB]=A panel applet for resizing and reorientating X screens. -Comment[eo]=Panela aplikaĵeto por regrandigi kaj reorienti la X ekranojn. -Comment[es]=Una miniaplicación del panel para redimensionar y reorientar pantallas X. -Comment[et]=Paneeliaplett X'i ekraanide suuruse muutmiseks ja pööramiseks -Comment[eu]=X pantailak neurriz eta norabidez aldatzeko applet bat. -Comment[fa]=برنامک تابلویی برای تغییر اندازه و تغییر جهت پرده‌های X. -Comment[fi]=Panelisovelma X-ruutujen koon ja suunnan muuttamiseksi -Comment[fr]=Une applet de tableau de bord pour redimensionner et faire pivoter les écrans X. -Comment[fy]=In paniel applet foar de grutte feroarjen en pleatsbepaling fan X skermen. -Comment[ga]=Feidhmchláirín painéil lenar féidir scáileán X a rothlú agus a mhéid a athrú. -Comment[gl]=Unha applet do panel para mudar o tamaño e reorientar as pantallas das X. -Comment[gu]=X સ્ક્રિનોનું માપ બદલવા અને ફેરવવા માટેનું પેનલ એપ્લેટ -Comment[he]=יישומון לוח לשינוי גודל וכיוון המסך -Comment[hi]=एक्स स्क्रीन का आकार बदलने तथा फिर से दिशानिर्धारण के लिए एक फलक ऐपलेट -Comment[hne]=एक्स स्क्रीन के आकार बदले अउ फिर से दिसानिर्धारन बर एक पेनल ऐपलेट -Comment[hr]=Applet trake za promjenu veličine i orjentacije X zaslona. -Comment[hsb]=Pasowy applet za připrawjenje a wjerćenje X-wobrazowkow -Comment[hu]=Panel-kisalkalmazás X képernyők átméretezéséhez és elforgatásához -Comment[ia]=Un applet de pannello pro redimensionar e reorientar schermos X. -Comment[id]=Applet panel untuk mengubah ukuran dan mengubah orientasi layar X. -Comment[is]=Smáforrit á spjöld sem stjórnar stærð og snúningi X skjáa. -Comment[ja]=スクリーンのサイズや向きを変更するためのアプレット -Comment[kk]=X экрандарының өлшем мен бағдарын өзгерту апплет панелі. -Comment[km]=អាប់ភ្លេត​បន្ទះ​សម្រាប់​ផ្លាស់ប្ដូរ​ទំហំ និង​កំណត់​ទិស​របស់​អេក្រង់ X ។ -Comment[kn]=ಕ್ಸ ತೆರೆಗಳ ಗಾತ್ರ ಬದಲಾಯಿಸಲು ಮತ್ತು ನಿಲುವು (ಓರಿಯಂಟೇಶನ್) ಬದಲಾಯಿಸಲು ಒಂದು ಪುಟೀಪು (ಪಾನೆಲ್) ಅನ್ವಯಾಂಶ (ಆಪ್ಲೆಟ್) -Comment[ko]=X 화면의 크기를 조정하고 회전시키는 패널 애플릿. -Comment[ku]=Amûreke panelê ji bo guherandina mezinahî û hêla ekranên X. -Comment[lt]=Pulto įskiepis X ekranų dydžio ir orientacijos keitimui -Comment[lv]=Paneļa aplets ekrāna izmēra mainīšanai un rotēšanai. -Comment[mai]=एक्स स्क्रीन क' आकार बदलब आओर फिनु सँ दिशानिर्धारण क' लेल एकटा फलक ऐपलेट -Comment[mk]=Аплет за панелот што се користи за менување на големината и ориентацијата на X-екраните. -Comment[ml]=എക്സ് സ്ക്രീനുകളുടെ വലിപ്പം മാറ്റുന്നതിനുള്ള ഒരു പാളിയിലെ ലഘുപ്രയോഗം. -Comment[mr]=एक्स स्क्रीनचा आकार बदलविण्याकरिता व पुन्हा दिशानिर्धारण करिता एक पटल ऐपलेट. -Comment[nb]=Et panelprogram som skalerer og roterer X-skjermer. -Comment[nds]=En Paneel-Lüttprogramm för't Ännern vun Grött un Utrichten vun X-Schirmen -Comment[ne]=एक्स पर्दाहरू रिसाइज गर्न र पुन: अभिमुखिकरण गर्न प्यानल एप्लेट -Comment[nl]=Een paneelapplet voor het wijzigen van de grootte en oriëntatie van de schermweergave. -Comment[nn]=Eit panelprogram for endring av skjermoppløysing og skjermretning. -Comment[pa]=X ਸਕਰੀਨਾਂ ਨੂੰ ਮੁੜ-ਸਾਇਜ਼ ਕਰਨ ਅਤੇ ਮੁੜ-ਘੁੰਮਾਉਣ ਲਈ ਇੱਕ ਪੈਨਲ ਐਪਲਿਟ -Comment[pl]=Aplet panelu do zmiany rozmiarów i orientacji ekranów X. -Comment[pt]=Uma 'applet' do painel para mudar o tamanho e rodar os ecrãs no X. -Comment[pt_BR]=Um miniaplicativo do painel para redimensionar e reorientar as telas do X. -Comment[ro]=O miniaplicație de panou care redimensionează și reorientează ecranele X. -Comment[ru]=Виджет панели для изменения размера и ориентации экрана. -Comment[se]=Panelaprográmmaš mii sáhttá rievdadit šearpma čoakkisčuohkku ja jorahit dan. -Comment[si]=X තිර ප්‍රතිප්‍රමාණයට හා නැවත කේන්ද්‍රගත කිරීමට පැනල ඇප්ලටය -Comment[sk]=Aplet na zmenu veľkosti a orientácie obrazoviek. -Comment[sl]=Aplet pulta za spreminjanje velikosti in usmeritve zaslonov X. -Comment[sr]=Панелски аплет за промену величине и оријентације икс екрана -Comment[sr@ijekavian]=Панелски аплет за промјену величине и оријентације икс екрана -Comment[sr@ijekavianlatin]=Panelski aplet za promjenu veličine i orijentacije X ekrana -Comment[sr@latin]=Panelski aplet za promenu veličine i orijentacije X ekrana -Comment[sv]=Ett miniprogram för panelen som ändrar storlek och roterar X-skärmar. -Comment[ta]=X திரைகளை அளவுமாற்ற மற்ற, திசை மாற்றுதற்கான சிறுநிரல் பலகம் -Comment[te]=X తెరలను పునఃపరిమాణం మరియు పునఃసర్దుబాటు చేయుటకు ఒక ప్యానల్ ఆప్లెట్. -Comment[th]=แอพเพล็ตของแถบพาเนลสำหรับปรับขนาดหรือปรับทิศทางการวางแนวของหน้าจอ X -Comment[tr]=X ekranlarını yeniden boyutlandıran ve yönlerini değiştiren bir panel programcığı -Comment[ug]=X ئېكران چوڭلۇقى ۋە يۆنىلىشىنى تەڭشەيدىغان قوللانچاق -Comment[uk]=Аплет панелі для зміни розміру й орієнтації екранів X. -Comment[vi]=Tiểu ứng dụng trên bảng điều khiển, để thay đổi kích cỡ của màn hình X và thay đổi vị trí. -Comment[wa]=Ene aplikete po candjî l' grandeu eyet tourner li håynaedje so les waitroûles X11 -Comment[x-test]=xxA panel applet for resizing and reorientating X screens.xx -Comment[zh_CN]=调整 X 屏幕大小和方向的面板小程序 -Comment[zh_TW]=一個重新調整 X 螢幕的面板小程式。 -Exec=krandrtray --icon '%i' --caption '%c' -Icon=preferences-desktop-display-randr -Type=Application -OnlyShowIn=KDE; -Categories=Qt;KDE;System; diff --git a/kcontrol/randr/krandrtray.h b/kcontrol/randr/krandrtray.h deleted file mode 100644 index 6dfdf931..00000000 --- a/kcontrol/randr/krandrtray.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002 Hamish Rodda - * - * 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 KRANDRTRAY_H -#define KRANDRTRAY_H - -#include -#include -#include -#include - -#include - -#include "randrdisplay.h" - -class KCMultiDialog; -class KHelpMenu; -class KMenu; - -class KRandRSystemTray : public KStatusNotifierItem -{ - Q_OBJECT -public: - explicit KRandRSystemTray(RandRDisplay *dpy, QWidget* parent = 0); - ~KRandRSystemTray(); - - void activate(const QPoint &pos); - -protected Q_SLOTS: - void slotScreenActivated(); - void slotPrefs(); - - void slotPrepareMenu(); - void updateToolTip(); - -private: - void populateMenu(KMenu* menu); - - // helper functions - QActionGroup *populateRotations(KMenu *menu, int rotations, int rotation); - QActionGroup *populateSizes(KMenu *menu, const SizeList &sizes, const QSize &size); - QActionGroup *populateRates(KMenu *menu, const RateList &rates, float rate); - - KHelpMenu* m_help; - QList m_screenPopups; - KMenu* m_menu; - RandRDisplay *m_display; - QWeakPointer m_kcm; -}; - -#endif // KRANDRTRAY_H diff --git a/kcontrol/randr/main.cpp b/kcontrol/randr/main.cpp deleted file mode 100644 index cf69243c..00000000 --- a/kcontrol/randr/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2007 Gustavo Pichorim Boiko - * Copyright (c) 2002,2003 Hamish Rodda - * - * 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 -#include - -#include -#include -#include -#include - -#include "krandrapp.h" - -static const char krandrtrayVersion[] = "0.5"; - -int main(int argc, char **argv) -{ - KAboutData aboutData("display-randr", "krandr", ki18n("Resize and Rotate"), krandrtrayVersion, - ki18n("X Resize and Rotate System Tray App"), KAboutData::License_GPL, - ki18n("(c) 2007 Gustavo Pichorim Boiko, 2002-2003 Hamish Rodda")); - aboutData.addAuthor(ki18n("Gustavo Pichorim Boiko"),ki18n("Maintainer"), "gustavo.boiko@kdemail.net"); - aboutData.addAuthor(ki18n("Hamish Rodda"),ki18n("Original Author"), "rodda@kde.org"); - aboutData.addCredit(ki18n("Lubos Lunak"),ki18n("Many fixes"), "l.lunak@suse.cz"); - aboutData.addCredit(ki18n("Harry Bock"),ki18n("Many fixes, multi-head support"), "hbock@providence.edu"); - aboutData.setProgramIconName("preferences-desktop-display-randr"); - - KCmdLineArgs::init(argc,argv,&aboutData); - - KCmdLineOptions options; - options.add("login", ki18n("Application is being auto-started at KDE session start"), 0L); - KCmdLineArgs::addCmdLineOptions(options); - KCmdLineArgs::addStdCmdLineOptions(); - - KRandRApp app; - return app.exec(); -} diff --git a/keditbookmarks/keditbookmarks.desktop b/keditbookmarks/keditbookmarks.desktop index 15876128..b0594127 100755 --- a/keditbookmarks/keditbookmarks.desktop +++ b/keditbookmarks/keditbookmarks.desktop @@ -135,4 +135,3 @@ Comment[zh_CN]=书签组织和编辑器 Comment[zh_TW]=書籤組織編輯器 X-DocPath=konqueror/index.html#bookmarks Categories=Qt;KDE;Network;WebBrowser; -X-KDE-HasTrayOption=true diff --git a/kinfocenter/kinfocenter.desktop b/kinfocenter/kinfocenter.desktop index ea0b5318..2e3d1ec1 100755 --- a/kinfocenter/kinfocenter.desktop +++ b/kinfocenter/kinfocenter.desktop @@ -5,7 +5,6 @@ Type=Application X-DocPath=kinfocenter/index.html StartupNotify=true OnlyShowIn=KDE; -X-KDE-HasTrayOption=true Name=KInfoCenter Name[af]=Inligting Sentrum diff --git a/klipper/CMakeLists.txt b/klipper/CMakeLists.txt deleted file mode 100644 index b56574a0..00000000 --- a/klipper/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -set(libklipper_common_SRCS - klipper.cpp - urlgrabber.cpp - configdialog.cpp - history.cpp - historyitem.cpp - historystringitem.cpp - klipperpopup.cpp - popupproxy.cpp - historyimageitem.cpp - historyurlitem.cpp - actionstreewidget.cpp - editactiondialog.cpp - clipcommandprocess.cpp - generalconfig.ui - actionsconfig.ui - editactiondialog.ui -) - -kde4_add_kcfg_files(libklipper_common_SRCS klippersettings.kcfgc) - -set(klipper_SRCS ${libklipper_common_SRCS} main.cpp tray.cpp) - -add_executable(klipper ${klipper_SRCS}) - -target_link_libraries(klipper - KDE4::kdeui - KDE4::kfile - ${QT_QTNETWORK_LIBRARY} - ${X11_LIBRARIES} -) -if (X11_Xfixes_FOUND) - target_link_libraries(klipper ${X11_Xfixes_LIB}) -endif (X11_Xfixes_FOUND) - -install( - TARGETS klipper - DESTINATION ${KDE4_BIN_INSTALL_DIR} -) - -install( - PROGRAMS klipper.desktop - DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR} -) -install( - PROGRAMS klipper.desktop - DESTINATION ${KDE4_AUTOSTART_INSTALL_DIR} -) diff --git a/klipper/Messages.sh b/klipper/Messages.sh deleted file mode 100644 index ed8efef7..00000000 --- a/klipper/Messages.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -$EXTRACTRC *.ui *.kcfg >> rc.cpp -$XGETTEXT *.cpp -o $podir/klipper.pot -rm -f rc.cpp - diff --git a/klipper/actionsconfig.ui b/klipper/actionsconfig.ui deleted file mode 100644 index c18fa887..00000000 --- a/klipper/actionsconfig.ui +++ /dev/null @@ -1,117 +0,0 @@ - - - ActionsWidget - - - - 0 - 0 - 458 - 360 - - - - - - - Replay actions on an item selected from history - - - - - - - Remove whitespace when executing actions - - - - - - - Enable MIME-based actions - - - - - - - Action list: - - - - - - - Qt::CustomContextMenu - - - - Regular Expression - - - - - Description - - - - - - - - - - Add Action... - - - - - - - Edit Action... - - - - - - - Delete Action - - - - - - - Advanced... - - - - - - - - - Click on a highlighted item's column to change it. "%s" in a command will be replaced with the clipboard contents.<br>For more information about regular expressions, you could have a look at the <a href="http://en.wikipedia.org/wiki/Regular_expression">Wikipedia entry about this topic</a>. - - - Qt::RichText - - - true - - - true - - - - - - - - ActionsTreeWidget - QTreeWidget -
actionstreewidget.h
-
-
- -
diff --git a/klipper/actionstreewidget.cpp b/klipper/actionstreewidget.cpp deleted file mode 100644 index 201e32b8..00000000 --- a/klipper/actionstreewidget.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of the KDE project - Copyright (C) 2008 by Dmitry Suzdalev - - 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 "actionstreewidget.h" -#include - -ActionsTreeWidget::ActionsTreeWidget(QWidget* parent) - : QTreeWidget(parent), m_actionsChanged(-1), m_modified(false) -{ - // these signals indicate that something was changed in actions tree - - connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), SLOT(onItemChanged())); - QAbstractItemModel *treeModel = model(); - if (treeModel) - { - connect(treeModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(onItemChanged())); - connect(treeModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(onItemChanged())); - } -} - -void ActionsTreeWidget::onItemChanged() -{ - setActionsChanged(true); -} - -void ActionsTreeWidget::resetModifiedState() -{ - m_modified = false; - m_actionsChanged = -1; -} - -void ActionsTreeWidget::setActionsChanged(int isChanged) -{ - Q_UNUSED(isChanged) - - if (!m_modified) - { - m_actionsChanged = m_actionsChanged ? 1 : 0; - m_modified = true; - emit changed(); - } -} - -int ActionsTreeWidget::actionsChanged() const -{ - return m_actionsChanged; -} - diff --git a/klipper/actionstreewidget.h b/klipper/actionstreewidget.h deleted file mode 100644 index 256c43aa..00000000 --- a/klipper/actionstreewidget.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - This file is part of the KDE project - Copyright (C) 2008 by Dmitry Suzdalev - - 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. -*/ -#ifndef ACTIONSTREEWIDGET_H -#define ACTIONSTREEWIDGET_H - -#include - -/** - * Custom tree widget class to make KConfigDialog properly - * highlight Apply button when some action is changed. - * We achieve this by adding custom type handling to KConfigDialogManager - * and by adding a somewhat dummy config entry which gets changed whenever - * some action is changed in treewidget. - * KConfigDialog watches this entry for changes and highlights Apply when needed - * - * @see KConfigDialogManager - */ -class ActionsTreeWidget : public QTreeWidget -{ - Q_OBJECT - - // this property is int instead of (more logical) bool, because we need a custom handling of - // "default state" and because of our custom use of this property: - // - // We indicate that changes were made to this widget by changing this int value. - // We use it as "if this value is *CHANGED SOMEHOW*, this means that some changes were made to action list", - // If we'd make this property bool, KConfigDialog would highlight "Defaults" button whenever - // this property becomes false, but this is not the way we use this property. - // So we change it from 0 to 1 periodically when something changes. Both 0, 1 values indicate - // change. - // - // We set it to default only when resetModifiedState() is called, i.e. when Apply btn is being - // clicked - // - // Hope this explains it. - // Yeah, this class is a trick :) If there's a better way to properly - // update KConfigDialog buttons whenever "some change occurs to QTreeWidget", let me know (dimsuz) - Q_PROPERTY( int actionsChanged READ actionsChanged WRITE setActionsChanged USER true ) - -public: - ActionsTreeWidget(QWidget* parent = 0); - - void setActionsChanged(int); - int actionsChanged() const; - - void resetModifiedState(); - -signals: - void changed(); - -private slots: - void onItemChanged(); - -private: - int m_actionsChanged; - bool m_modified; -}; - -#endif diff --git a/klipper/clipcommandprocess.cpp b/klipper/clipcommandprocess.cpp deleted file mode 100644 index 06b30578..00000000 --- a/klipper/clipcommandprocess.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright 2009 Esben Mose Hansen - - 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 "clipcommandprocess.h" - -#include - -#include "history.h" -#include "historystringitem.h" -#include "urlgrabber.h" - -ClipCommandProcess::ClipCommandProcess(const ClipAction& action, const ClipCommand& command, const QString& clip, History* history, const HistoryItem* original_item) : - KProcess(), - m_history(history), - m_historyItem(original_item), - m_newhistoryItem() -{ - QHash map; - map.insert( 's', clip ); - - // support %u, %U (indicates url param(s)) and %f, %F (file param(s)) - map.insert( 'u', clip ); - map.insert( 'U', clip ); - map.insert( 'f', clip ); - map.insert( 'F', clip ); - - const QStringList matches = action.regExpMatches(); - // support only %0 and the first 9 matches... - const int numMatches = qMin(10, matches.count()); - for ( int i = 0; i < numMatches; ++i ) { - map.insert( QChar( '0' + i ), matches.at( i ) ); - } - - setReadChannel(QProcess::StandardOutput); - setShellCommand(KMacroExpander::expandMacrosShellQuote( command.command, map ).trimmed()); - - connect(this, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(slotFinished(int,QProcess::ExitStatus))); - if (command.output != ClipCommand::IGNORE) { - connect(this, SIGNAL(readyRead()), SLOT(slotStdOutputAvailable())); - } - if (command.output != ClipCommand::REPLACE) { - m_historyItem = 0L; // Don't replace - } - -} - -void ClipCommandProcess::slotFinished(int /*exitCode*/, QProcess::ExitStatus /*newState*/) -{ - if (m_history) { - // If an history item was provided, remove it so that the new item can replace it - if (m_historyItem) { - m_history->remove(m_historyItem); - } - if (!m_newhistoryItem.isEmpty()) { - m_history->insert(new HistoryStringItem(m_newhistoryItem)); - } - } - deleteLater(); -} - -void ClipCommandProcess::slotStdOutputAvailable() -{ - m_newhistoryItem.append(QString::fromLocal8Bit(this->readAllStandardOutput().data())); -} - - -#include "moc_clipcommandprocess.cpp" diff --git a/klipper/clipcommandprocess.h b/klipper/clipcommandprocess.h deleted file mode 100644 index fdeedf3d..00000000 --- a/klipper/clipcommandprocess.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright 2009 Esben Mose Hansen - - 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 CLIPCOMMANDPROCESS_H -#define CLIPCOMMANDPROCESS_H - -#include - -class ClipAction; -class History; -class ClipCommand; -class HistoryItem; - -class ClipCommandProcess : public KProcess -{ - Q_OBJECT -public: - ClipCommandProcess(const ClipAction& action, const ClipCommand& command, const QString& clip, History* history = 0L, const HistoryItem* original_item = 0L); -public slots: - void slotStdOutputAvailable(); - void slotFinished(int exitCode, QProcess::ExitStatus newState); -private: - History* m_history; - const HistoryItem* m_historyItem; - QString m_newhistoryItem; -}; - -#endif // CLIPCOMMANDPROCESS_H diff --git a/klipper/configdialog.cpp b/klipper/configdialog.cpp deleted file mode 100644 index 382b90c6..00000000 --- a/klipper/configdialog.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2000 by Carsten Pfeiffer - Copyright (C) 2008-2009 by Dmitry Suzdalev - - 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 "configdialog.h" - -#include -#include -#include -#include -#include - -#include "klipper.h" -#include "editactiondialog.h" - -GeneralWidget::GeneralWidget(QWidget* parent) - : QWidget(parent) -{ - m_ui.setupUi(this); - m_ui.kcfg_TimeoutForActionPopups->setSuffix(ki18np(" second", " seconds")); - m_ui.kcfg_MaxClipItems->setSuffix(ki18np(" entry", " entries")); - -} - -void GeneralWidget::updateWidgets() -{ - if (m_ui.kcfg_IgnoreSelection->isChecked()) { - m_ui.kcfg_SyncClipboards->setEnabled(false); - m_ui.kcfg_SelectionTextOnly->setEnabled(false); - } else if (m_ui.kcfg_SyncClipboards->isChecked()) { - m_ui.kcfg_IgnoreSelection->setEnabled(false); - } - -} - -ActionsWidget::ActionsWidget(QWidget* parent) - : QWidget(parent), m_editActDlg(0) -{ - m_ui.setupUi(this); - - m_ui.pbAddAction->setIcon(KIcon("list-add")); - m_ui.pbDelAction->setIcon(KIcon("list-remove")); - m_ui.pbEditAction->setIcon(KIcon("document-edit")); - m_ui.pbAdvanced->setIcon(KIcon("configure")); - - const KConfigGroup grp = KGlobal::config()->group("ActionsWidget"); - QByteArray hdrState = grp.readEntry("ColumnState", QByteArray()); - if (!hdrState.isEmpty()) - { - kDebug() << "Restoring column state"; - m_ui.kcfg_ActionList->header()->restoreState(QByteArray::fromBase64(hdrState)); - } - else - { - m_ui.kcfg_ActionList->header()->resizeSection(0, 250); - } - - connect(m_ui.kcfg_ActionList, SIGNAL(itemSelectionChanged()), SLOT(onSelectionChanged())); - connect(m_ui.kcfg_ActionList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), - SLOT(onEditAction())); - - connect(m_ui.pbAddAction, SIGNAL(clicked()), SLOT(onAddAction())); - connect(m_ui.pbEditAction, SIGNAL(clicked()), SLOT(onEditAction())); - connect(m_ui.pbDelAction, SIGNAL(clicked()), SLOT(onDeleteAction())); - connect(m_ui.pbAdvanced, SIGNAL(clicked()), SLOT(onAdvanced())); - - onSelectionChanged(); -} - -void ActionsWidget::setActionList(const ActionList& list) -{ - qDeleteAll( m_actionList ); - m_actionList.clear(); - - foreach (ClipAction* action, list) { - if (!action) { - kDebug() << "action is null!"; - continue; - } - - // make a copy for us to work with from now on - m_actionList.append( new ClipAction( *action ) ); - } - - updateActionListView(); -} - -void ActionsWidget::updateActionListView() -{ - m_ui.kcfg_ActionList->clear(); - - foreach (ClipAction* action, m_actionList) { - if (!action) { - kDebug() << "action is null!"; - continue; - } - - QTreeWidgetItem *item = new QTreeWidgetItem; - updateActionItem( item, action ); - - m_ui.kcfg_ActionList->addTopLevelItem( item ); - } - - // after all actions loaded, reset modified state of tree widget. - // Needed because tree widget reacts on item changed events to tell if it is changed - // this will ensure that apply button state will be correctly changed - m_ui.kcfg_ActionList->resetModifiedState(); -} - -void ActionsWidget::updateActionItem( QTreeWidgetItem* item, ClipAction* action ) -{ - if ( !item || !action ) { - kDebug() << "null pointer passed to function, nothing done"; - return; - } - - // clear children if any - item->takeChildren(); - item->setText( 0, action->regExp() ); - item->setText( 1, action->description() ); - - foreach (const ClipCommand& command, action->commands()) { - QStringList cmdProps; - cmdProps << command.command << command.description; - QTreeWidgetItem *child = new QTreeWidgetItem(item, cmdProps); - child->setIcon(0, KIcon(command.icon.isEmpty() ? "system-run" : command.icon)); - } -} - -void ActionsWidget::setExcludedWMClasses(const QStringList& excludedWMClasses) -{ - m_exclWMClasses = excludedWMClasses; -} - -QStringList ActionsWidget::excludedWMClasses() const -{ - return m_exclWMClasses; -} - -ActionList ActionsWidget::actionList() const -{ - // return a copy of our action list - ActionList list; - foreach( ClipAction* action, m_actionList ) { - if ( !action ) { - kDebug() << "action is null"; - continue; - } - list.append( new ClipAction( *action ) ); - } - - return list; -} - -void ActionsWidget::resetModifiedState() -{ - m_ui.kcfg_ActionList->resetModifiedState(); - - kDebug() << "Saving column state"; - KConfigGroup grp = KGlobal::config()->group("ActionsWidget"); - grp.writeEntry("ColumnState", - m_ui.kcfg_ActionList->header()->saveState().toBase64()); -} - -void ActionsWidget::onSelectionChanged() -{ - bool itemIsSelected = !m_ui.kcfg_ActionList->selectedItems().isEmpty(); - m_ui.pbEditAction->setEnabled(itemIsSelected); - m_ui.pbDelAction->setEnabled(itemIsSelected); -} - -void ActionsWidget::onAddAction() -{ - if (!m_editActDlg) { - m_editActDlg = new EditActionDialog(this); - } - - ClipAction* newAct = new ClipAction; - m_editActDlg->setAction(newAct); - if (m_editActDlg->exec() == QDialog::Accepted) { - m_actionList.append( newAct ); - - QTreeWidgetItem* item = new QTreeWidgetItem; - updateActionItem( item, newAct ); - m_ui.kcfg_ActionList->addTopLevelItem( item ); - } -} - -void ActionsWidget::onEditAction() -{ - if (!m_editActDlg) { - m_editActDlg = new EditActionDialog(this); - } - - QTreeWidgetItem *item = m_ui.kcfg_ActionList->currentItem(); - int commandIdx = -1; - if (item) { - if (item->parent()) { - commandIdx = item->parent()->indexOfChild( item ); - item = item->parent(); // interested in toplevel action - } - - int idx = m_ui.kcfg_ActionList->indexOfTopLevelItem( item ); - ClipAction* action = m_actionList.at( idx ); - - if ( !action ) { - kDebug() << "action is null"; - return; - } - - m_editActDlg->setAction(action, commandIdx); - // dialog will save values into action if user hits OK - m_editActDlg->exec(); - - updateActionItem(item, action); - } -} - - -void ActionsWidget::onDeleteAction() -{ - QTreeWidgetItem *item = m_ui.kcfg_ActionList->currentItem(); - if ( item && item->parent() ) - item = item->parent(); - - if ( item ) - { - int idx = m_ui.kcfg_ActionList->indexOfTopLevelItem( item ); - m_actionList.removeAt( idx ); - } - - delete item; -} - -void ActionsWidget::onAdvanced() -{ - KDialog dlg(this); - dlg.setModal(true); - dlg.setCaption( i18n("Advanced Settings") ); - dlg.setButtons( KDialog::Ok | KDialog::Cancel ); - - AdvancedWidget *widget = new AdvancedWidget(&dlg); - widget->setWMClasses( m_exclWMClasses ); - - dlg.setMainWidget(widget); - - if ( dlg.exec() == KDialog::Accepted ) { - m_exclWMClasses = widget->wmClasses(); - } -} - -ConfigDialog::ConfigDialog(QWidget* parent, KConfigSkeleton* skeleton, const Klipper* klipper, KActionCollection*collection, bool isApplet) - : KConfigDialog(parent, "preferences", skeleton), - m_generalPage(new GeneralWidget(this)), - m_actionsPage(new ActionsWidget(this)), - m_klipper(klipper) -{ - if ( isApplet ) { - setHelp( QString(), "klipper" ); - } - - addPage(m_generalPage, i18nc("General Config", "General"), "klipper", i18n("General Configuration")); - addPage(m_actionsPage, i18nc("Actions Config", "Actions"), "system-run", i18n("Actions Configuration")); - - QWidget* w = new QWidget(this); - m_shortcutsWidget = new KShortcutsEditor( collection, w, KShortcutsEditor::GlobalAction ); - addPage(m_shortcutsWidget, i18nc("Shortcuts Config", "Shortcuts"), "configure-shortcuts", i18n("Shortcuts Configuration")); - - const KConfigGroup grp = KGlobal::config()->group("ConfigDialog"); - restoreDialogSize(grp); -} - - -ConfigDialog::~ConfigDialog() -{ -} - - -void ConfigDialog::updateSettings() -{ - // user clicked Ok or Apply - - if (!m_klipper) { - kDebug() << "Klipper object is null"; - return; - } - - m_shortcutsWidget->save(); - - m_actionsPage->resetModifiedState(); - - m_klipper->urlGrabber()->setActionList(m_actionsPage->actionList()); - m_klipper->urlGrabber()->setExcludedWMClasses(m_actionsPage->excludedWMClasses()); - m_klipper->saveSettings(); - - KConfigGroup grp = KGlobal::config()->group("ConfigDialog"); - saveDialogSize(grp); -} - -void ConfigDialog::updateWidgets() -{ - // settings were updated, update widgets - - if (m_klipper && m_klipper->urlGrabber() ) { - m_actionsPage->setActionList(m_klipper->urlGrabber()->actionList()); - m_actionsPage->setExcludedWMClasses(m_klipper->urlGrabber()->excludedWMClasses()); - } else { - kDebug() << "Klipper or grabber object is null"; - return; - } - m_generalPage->updateWidgets(); -} - -void ConfigDialog::updateWidgetsDefault() -{ - // default widget values requested - - m_shortcutsWidget->allDefault(); -} - -AdvancedWidget::AdvancedWidget( QWidget *parent ) - : QWidget(parent) -{ - QVBoxLayout *mainLayout = new QVBoxLayout(this); - - QGroupBox *groupBox = new QGroupBox(i18n("D&isable Actions for Windows of Type WM_CLASS"), this); - groupBox->setLayout(new QVBoxLayout(groupBox)); - - editListBox = new KEditListWidget(groupBox); - - editListBox->setButtons(KEditListWidget::Add | KEditListWidget::Remove); - editListBox->setCheckAtEntering(true); - - editListBox->setWhatsThis(i18n("This lets you specify windows in which Klipper should " - "not invoke \"actions\". Use

" - "
xprop | grep WM_CLASS

" - "in a terminal to find out the WM_CLASS of a window. " - "Next, click on the window you want to examine. The " - "first string it outputs after the equal sign is the one " - "you need to enter here.
")); - groupBox->layout()->addWidget(editListBox); - - mainLayout->addWidget(groupBox); - - editListBox->setFocus(); -} - -AdvancedWidget::~AdvancedWidget() -{ -} - -void AdvancedWidget::setWMClasses( const QStringList& items ) -{ - editListBox->setItems(items); -} - -QStringList AdvancedWidget::wmClasses() const -{ - return editListBox->items(); -} - -#include "moc_configdialog.cpp" diff --git a/klipper/configdialog.h b/klipper/configdialog.h deleted file mode 100644 index 801d8822..00000000 --- a/klipper/configdialog.h +++ /dev/null @@ -1,124 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2000 by Carsten Pfeiffer - Copyright (C) 2008 by Dmitry Suzdalev - - 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. -*/ -#ifndef CONFIGDIALOG_H -#define CONFIGDIALOG_H - -#include - -#include "urlgrabber.h" - -#include "ui_generalconfig.h" -#include "ui_actionsconfig.h" - -class KConfigSkeleton; -class KShortcutsEditor; -class Klipper; -class KEditListWidget; -class KActionCollection; -class EditActionDialog; - -class GeneralWidget : public QWidget -{ - Q_OBJECT -public: - GeneralWidget(QWidget* parent); - void updateWidgets(); - -private: - Ui::GeneralWidget m_ui; -}; - -class ActionsWidget : public QWidget -{ - Q_OBJECT -public: - ActionsWidget(QWidget* parent); - - void setActionList(const ActionList&); - void setExcludedWMClasses(const QStringList&); - - ActionList actionList() const; - QStringList excludedWMClasses() const; - - void resetModifiedState(); - -private slots: - void onSelectionChanged(); - void onAddAction(); - void onEditAction(); - void onDeleteAction(); - void onAdvanced(); - -private: - void updateActionItem( QTreeWidgetItem* item, ClipAction* action ); - void updateActionListView(); - - Ui::ActionsWidget m_ui; - EditActionDialog* m_editActDlg; - - /** - * List of actions this page works with - */ - ActionList m_actionList; - - QStringList m_exclWMClasses; -}; - -// only for use inside ActionWidget -class AdvancedWidget : public QWidget -{ - Q_OBJECT - -public: - explicit AdvancedWidget( QWidget* parent = 0L ); - ~AdvancedWidget(); - - void setWMClasses( const QStringList& items ); - QStringList wmClasses() const; - -private: - KEditListWidget* editListBox; -}; - -class ConfigDialog : public KConfigDialog -{ - Q_OBJECT - -public: - ConfigDialog( QWidget* parent, KConfigSkeleton* config, const Klipper* klipper, KActionCollection* collection, bool isApplet ); - ~ConfigDialog(); - -private: - // reimp - void updateWidgets(); - // reimp - void updateSettings(); - // reimp - void updateWidgetsDefault(); - -private: - GeneralWidget* m_generalPage; - ActionsWidget* m_actionsPage; - KShortcutsEditor* m_shortcutsWidget; - - const Klipper* m_klipper; -}; - -#endif // CONFIGDIALOG_H diff --git a/klipper/editactiondialog.cpp b/klipper/editactiondialog.cpp deleted file mode 100644 index 1721b9de..00000000 --- a/klipper/editactiondialog.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - This file is part of the KDE project - Copyright (C) 2009 by Dmitry Suzdalev - - 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 "editactiondialog.h" - -#include -#include - -#include -#include - -#include "urlgrabber.h" -#include "ui_editactiondialog.h" - -namespace { - static QString output2text(ClipCommand::Output output) { - switch(output) { - case ClipCommand::IGNORE: - return QString(i18n("Ignore")); - case ClipCommand::REPLACE: - return QString(i18n("Replace Clipboard")); - case ClipCommand::ADD: - return QString(i18n("Add to Clipboard")); - } - return QString(); - } - -} - -/** - * Show dropdown of editing Output part of commands - */ -class ActionOutputDelegate : public QItemDelegate { - public: - ActionOutputDelegate(QObject* parent = 0) : QItemDelegate(parent){ - } - - virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const { - QComboBox* editor = new QComboBox(parent); - editor->setInsertPolicy(QComboBox::NoInsert); - editor->addItem(output2text(ClipCommand::IGNORE), QVariant::fromValue(ClipCommand::IGNORE)); - editor->addItem(output2text(ClipCommand::REPLACE), QVariant::fromValue(ClipCommand::REPLACE)); - editor->addItem(output2text(ClipCommand::ADD), QVariant::fromValue(ClipCommand::ADD)); - return editor; - - } - - virtual void setEditorData(QWidget* editor, const QModelIndex& index) const { - QComboBox* ed = static_cast(editor); - QVariant data(index.model()->data(index, Qt::EditRole)); - ed->setCurrentIndex(static_cast(data.value())); - } - - virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const { - QComboBox* ed = static_cast(editor); - model->setData(index, ed->itemData(ed->currentIndex())); - } - - virtual void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& /*index*/) const { - editor->setGeometry(option.rect); - } -}; - -class ActionDetailModel : public QAbstractTableModel { - public: - ActionDetailModel(ClipAction* action, QObject* parent = 0); - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); - virtual Qt::ItemFlags flags(const QModelIndex& index) const; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex& parent) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - const QList& commands() const { return m_commands; } - void addCommand(const ClipCommand& command); - void removeCommand(const QModelIndex& index); - - private: - enum column_t { - COMMAND_COL = 0, - OUTPUT_COL = 1, - DESCRIPTION_COL = 2 - }; - QList m_commands; - QVariant displayData(ClipCommand* command, column_t colunm) const; - QVariant editData(ClipCommand* command, column_t column) const; - QVariant decorationData(ClipCommand* command, column_t column) const; - void setIconForCommand(ClipCommand& cmd); -}; - -ActionDetailModel::ActionDetailModel(ClipAction* action, QObject* parent): - QAbstractTableModel(parent), - m_commands(action->commands()) -{ - -} - -Qt::ItemFlags ActionDetailModel::flags(const QModelIndex& /*index*/) const -{ - return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; -} - - -void ActionDetailModel::setIconForCommand(ClipCommand& cmd) -{ - // let's try to update icon of the item according to command - QString command = cmd.command; - if ( command.contains( ' ' ) ) { - // get first word - command = command.section( ' ', 0, 0 ); - } - - QPixmap iconPix = KIconLoader::global()->loadIcon( - command, KIconLoader::Small, 0, - KIconLoader::DefaultState, - QStringList(), 0, true /* canReturnNull */ ); - - if ( !iconPix.isNull() ) { - cmd.icon = command; - } else { - cmd.icon.clear(); - } - -} - -bool ActionDetailModel::setData(const QModelIndex& index, const QVariant& value, int role) -{ - if (role == Qt::EditRole) { - ClipCommand cmd = m_commands.at(index.row()); - switch (static_cast(index.column())) { - case COMMAND_COL: - cmd.command = value.value(); - setIconForCommand(cmd); - break; - case OUTPUT_COL: - cmd.output = value.value(); - break; - case DESCRIPTION_COL: - cmd.description = value.value(); - break; - } - m_commands.replace(index.row(), cmd); - emit dataChanged(index, index); - return true; - } - return false; -} - -int ActionDetailModel::columnCount(const QModelIndex& /*parent*/) const -{ - return 3; -} - -int ActionDetailModel::rowCount(const QModelIndex&) const -{ - return m_commands.count(); -} - -QVariant ActionDetailModel::displayData(ClipCommand* command, ActionDetailModel::column_t column) const -{ - switch (column) { - case COMMAND_COL: - return command->command; - case OUTPUT_COL: - return output2text(command->output); - case DESCRIPTION_COL: - return command->description; - } - return QVariant(); -} - -QVariant ActionDetailModel::decorationData(ClipCommand* command, ActionDetailModel::column_t column) const -{ - switch (column) { - case COMMAND_COL: - return command->icon.isEmpty() ? KIcon( "system-run" ) : KIcon( command->icon ); - case OUTPUT_COL: - case DESCRIPTION_COL: - break; - } - return QVariant(); - -} - -QVariant ActionDetailModel::editData(ClipCommand* command, ActionDetailModel::column_t column) const -{ - switch (column) { - case COMMAND_COL: - return command->command; - case OUTPUT_COL: - return QVariant::fromValue(command->output); - case DESCRIPTION_COL: - return command->description; - } - return QVariant(); - -} - -QVariant ActionDetailModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { - switch(static_cast(section)) { - case COMMAND_COL: - return i18n("Command"); - case OUTPUT_COL: - return i18n("Output Handling"); - case DESCRIPTION_COL: - return i18n("Description"); - } - } - return QAbstractTableModel::headerData(section, orientation, role); -} - - -QVariant ActionDetailModel::data(const QModelIndex& index, int role) const -{ - const int column = index.column(); - const int row = index.row(); - ClipCommand cmd = m_commands.at(row); - switch (role) { - case Qt::DisplayRole: - return displayData(&cmd, static_cast(column)); - case Qt::DecorationRole: - return decorationData(&cmd, static_cast(column)); - case Qt::EditRole: - return editData(&cmd, static_cast(column)); - } - return QVariant(); -} - -void ActionDetailModel::addCommand(const ClipCommand& command) { - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_commands << command; - endInsertRows(); -} - -void ActionDetailModel::removeCommand(const QModelIndex& index) { - int row = index.row(); - beginRemoveRows(QModelIndex(), row, row); - m_commands.removeAt(row); - endRemoveRows(); - -} - -EditActionDialog::EditActionDialog(QWidget* parent) - : KDialog(parent) -{ - setCaption(i18n("Action Properties")); - setButtons(KDialog::Ok | KDialog::Cancel); - - QWidget* dlgWidget = new QWidget(this); - m_ui = new Ui_EditActionDialog; - m_ui->setupUi(dlgWidget); - - m_ui->leRegExp->setClearButtonShown(true); - m_ui->leDescription->setClearButtonShown(true); - - m_ui->pbAddCommand->setIcon(KIcon("list-add")); - m_ui->pbRemoveCommand->setIcon(KIcon("list-remove")); - - // For some reason, the default row height is 30 pixel. Set it to the minimum sectionSize instead, - // which is the font height+struts. - m_ui->twCommandList->verticalHeader()->setDefaultSectionSize(m_ui->twCommandList->verticalHeader()->minimumSectionSize()); - m_ui->twCommandList->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); - setMainWidget(dlgWidget); - - connect(m_ui->pbAddCommand, SIGNAL(clicked()), SLOT(onAddCommand()) ); - connect(m_ui->pbRemoveCommand, SIGNAL(clicked()), SLOT(onRemoveCommand()) ); - - const KConfigGroup grp = KGlobal::config()->group("EditActionDialog"); - restoreDialogSize(grp); - QByteArray hdrState = grp.readEntry("ColumnState", QByteArray()); - if (!hdrState.isEmpty()) { - kDebug() << "Restoring column state"; - m_ui->twCommandList->horizontalHeader()->restoreState(QByteArray::fromBase64(hdrState)); - } - // do this after restoreState() - m_ui->twCommandList->horizontalHeader()->setHighlightSections(false); -} - -EditActionDialog::~EditActionDialog() -{ - delete m_ui; -} - -void EditActionDialog::setAction(ClipAction* act, int commandIdxToSelect) -{ - m_action = act; - m_model = new ActionDetailModel(act, this); - m_ui->twCommandList->setModel(m_model); - m_ui->twCommandList->setItemDelegateForColumn(1, new ActionOutputDelegate); - connect(m_ui->twCommandList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(onSelectionChanged())); - - updateWidgets( commandIdxToSelect ); -} - -void EditActionDialog::updateWidgets(int commandIdxToSelect) -{ - if (!m_action) { - kDebug() << "no action to edit was set"; - return; - } - - m_ui->leRegExp->setText(m_action->regExp()); - m_ui->automatic->setChecked(m_action->automatic()); - m_ui->leDescription->setText(m_action->description()); - - if (commandIdxToSelect != -1) { - m_ui->twCommandList->setCurrentIndex( m_model->index( commandIdxToSelect ,0 ) ); - } - - // update Remove button - onSelectionChanged(); -} - -void EditActionDialog::saveAction() -{ - if (!m_action) { - kDebug() << "no action to edit was set"; - return; - } - - m_action->setRegExp( m_ui->leRegExp->text() ); - m_action->setDescription( m_ui->leDescription->text() ); - m_action->setAutomatic( m_ui->automatic->isChecked() ); - - m_action->clearCommands(); - - foreach ( const ClipCommand& cmd, m_model->commands() ){ - m_action->addCommand( cmd ); - } -} - -void EditActionDialog::slotButtonClicked( int button ) -{ - if ( button == KDialog::Ok ) { - saveAction(); - - kDebug() << "Saving dialogue state"; - KConfigGroup grp = KGlobal::config()->group("EditActionDialog"); - saveDialogSize(grp); - grp.writeEntry("ColumnState", - m_ui->twCommandList->horizontalHeader()->saveState().toBase64()); - } - - KDialog::slotButtonClicked( button ); -} - -void EditActionDialog::onAddCommand() -{ - m_model->addCommand(ClipCommand(i18n( "new command" ), - i18n( "Command Description" ), - true, - "" )); - m_ui->twCommandList->edit( m_model->index( m_model->rowCount()-1, 0 )); -} - -void EditActionDialog::onRemoveCommand() -{ - m_model->removeCommand(m_ui->twCommandList->selectionModel()->currentIndex()); -} - -void EditActionDialog::onSelectionChanged() -{ - m_ui->pbRemoveCommand->setEnabled( m_ui->twCommandList->selectionModel() && m_ui->twCommandList->selectionModel()->hasSelection() ); -} - -#include "moc_editactiondialog.cpp" diff --git a/klipper/editactiondialog.h b/klipper/editactiondialog.h deleted file mode 100644 index 6fa2adea..00000000 --- a/klipper/editactiondialog.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - This file is part of the KDE project - Copyright (C) 2009 by Dmitry Suzdalev - - 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. -*/ - -#ifndef EDIT_ACTION_DIALOG_H -#define EDIT_ACTION_DIALOG_H - -#include - -QT_BEGIN_NAMESPACE -class Ui_EditActionDialog; -QT_END_NAMESPACE - -class ClipAction; -class ActionDetailModel; - -class EditActionDialog : public KDialog -{ - Q_OBJECT -public: - EditActionDialog(QWidget* parent); - ~EditActionDialog(); - - /** - * Sets the action this dialog will work with - */ - void setAction(ClipAction* act, int commandIdxToSelect = -1); - -private slots: - void onAddCommand(); - void onRemoveCommand(); - void onSelectionChanged(); -// void onItemChanged( QTreeWidgetItem*, int ); - -private: - /** - * Updates dialog's widgets according to values - * in m_action. - * If commandIdxToSelect != -1 this command will be preselected - */ - void updateWidgets(int commandIdxToSelect); - - /** - * Saves a values from widgets to action - */ - void saveAction(); - - virtual void slotButtonClicked( int button ); - -private: - Ui_EditActionDialog* m_ui; - - ClipAction* m_action; - ActionDetailModel* m_model; -}; -#endif diff --git a/klipper/editactiondialog.ui b/klipper/editactiondialog.ui deleted file mode 100644 index 15ab4d0e..00000000 --- a/klipper/editactiondialog.ui +++ /dev/null @@ -1,225 +0,0 @@ - - - EditActionDialog - - - - 0 - 0 - 362 - 329 - - - - - 0 - - - - - Action properties: - - - - - - - - - - 200 - 0 - - - - - - - - - - - Regular expression: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Description: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Automatic: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - automatic - - - - - - - Qt::LeftToRight - - - - - - - - - - - - List of commands for this action: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 15 - - - - - - - - - - Add Command - - - - - - - Remove Command - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 15 - - - - - - - - Double-click an item to edit - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - Qt::NoPen - - - false - - - true - - - false - - - false - - - - - - - twCommandList - leRegExp - automatic - leDescription - pbRemoveCommand - pbAddCommand - - - - KLineEdit - QLineEdit -
klineedit.h
-
-
- -
diff --git a/klipper/generalconfig.ui b/klipper/generalconfig.ui deleted file mode 100644 index 76cc5c59..00000000 --- a/klipper/generalconfig.ui +++ /dev/null @@ -1,165 +0,0 @@ - - - GeneralWidget - - - - 0 - 0 - 463 - 417 - - - - - - - Save clipboard contents on exit - - - - - - - Prevent empty clipboard - - - - - - - Ignore images - - - - - - - Selection and Clipboard - - - - - - Ignore selection - - - - - - - Text selection only - - - - - - - Synchronize contents of the clipboard and the selection - - - - - - - - - - Timeout for action popups: - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Clipboard history size: - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - KIntSpinBox - QSpinBox -
knuminput.h
-
-
- - - kcfg_IgnoreSelection - clicked(bool) - kcfg_SelectionTextOnly - setDisabled(bool) - - - 78 - 213 - - - 80 - 231 - - - - - kcfg_IgnoreSelection - clicked(bool) - kcfg_SyncClipboards - setDisabled(bool) - - - 209 - 214 - - - 207 - 265 - - - - - kcfg_SyncClipboards - clicked(bool) - kcfg_IgnoreSelection - setDisabled(bool) - - - 300 - 261 - - - 301 - 210 - - - - -
diff --git a/klipper/history.cpp b/klipper/history.cpp deleted file mode 100644 index 36d36c16..00000000 --- a/klipper/history.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - Copyright (C) by Andrew Stanley-Jones - Copyright (C) 2000 by Carsten Pfeiffer - - 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 "history.h" - -#include - -#include - -#include "historystringitem.h" -#include "klipperpopup.h" - -History::History( QObject* parent ) - : QObject( parent ), - m_top(0L), - m_popup( new KlipperPopup( this ) ), - m_topIsUserSelected( false ), - m_nextCycle(0L) -{ - connect( this, SIGNAL(changed()), m_popup, SLOT(slotHistoryChanged()) ); - -} - - -History::~History() { - qDeleteAll(m_items); -} - -void History::insert( HistoryItem* item ) { - if ( !item ) - return; - - m_topIsUserSelected = false; - const HistoryItem* existingItem = this->find(item->uuid()); - if ( existingItem ) { - if ( existingItem == m_top) { - return; - } - slotMoveToTop( existingItem->uuid() ); - } else { - forceInsert( item ); - } - - emit topChanged(); - -} - -void History::forceInsert( HistoryItem* item ) { - if ( !item ) - return; - if (m_items.find(item->uuid()) != m_items.end()) { - return; // Don't insert duplicates - } - m_nextCycle = m_top; - item->insertBetweeen(m_top ? m_items[m_top->previous_uuid()] : 0L, m_top); - m_items.insert( item->uuid(), item ); - m_top = item; - emit changed(); - trim(); -} - -void History::trim() { - int i = m_items.count() - maxSize(); - if ( i <= 0 || !m_top ) - return; - - items_t::iterator bottom = m_items.find(m_top->previous_uuid()); - while ( i-- ) { - items_t::iterator it = bottom; - bottom = m_items.find((*bottom)->previous_uuid()); - // FIXME: managing memory manually is tedious; use smart pointer instead - delete *it; - m_items.erase(it); - } - (*bottom)->chain(m_top); - if (m_items.size()<=1) { - m_nextCycle = 0L; - } - emit changed(); -} - -void History::remove( const HistoryItem* newItem ) { - if ( !newItem ) - return; - - items_t::iterator it = m_items.find(newItem->uuid()); - if (it == m_items.end()) { - return; - } - - if (*it == m_top) { - m_top = m_items[m_top->next_uuid()]; - } - m_items[(*it)->previous_uuid()]->chain(m_items[(*it)->next_uuid()]); - m_items.erase(it); -} - - -void History::slotClear() { - // FIXME: managing memory manually is tedious; use smart pointer instead - qDeleteAll(m_items); - m_items.clear(); - m_top = 0L; - emit changed(); -} - -void History::slotMoveToTop(QAction* action) { - QByteArray uuid = action->data().toByteArray(); - if (uuid.isNull()) // not an action from popupproxy - return; - - slotMoveToTop(uuid); -} - -void History::slotMoveToTop(const QByteArray& uuid) { - - items_t::iterator it = m_items.find(uuid); - if (it == m_items.end()) { - return; - } - if (*it == m_top) { - emit topChanged(); - return; - } - m_topIsUserSelected = true; - - m_nextCycle = m_top; - m_items[(*it)->previous_uuid()]->chain(m_items[(*it)->next_uuid()]); - (*it)->insertBetweeen(m_items[m_top->previous_uuid()], m_top); - m_top = *it; - emit changed(); - emit topChanged(); -} - -void History::setMaxSize( unsigned max_size ) { - m_maxSize = max_size; - trim(); -} - -KlipperPopup* History::popup() { - return m_popup; -} - -void History::cycleNext() { - if (m_top && m_nextCycle && m_nextCycle != m_top) { - HistoryItem* prev = m_items[m_nextCycle->previous_uuid()]; - HistoryItem* next = m_items[m_nextCycle->next_uuid()]; - //if we have only two items in clipboard - if (prev == next) { - m_top=m_nextCycle; - } - else { - HistoryItem* endofhist = m_items[m_top->previous_uuid()]; - HistoryItem* aftertop = m_items[m_top->next_uuid()]; - if (prev == m_top) { - prev = m_nextCycle; - aftertop = m_top; - } - else if (next == m_top) { - next = m_nextCycle; - endofhist = m_top; - } - m_top->insertBetweeen(prev, next); - m_nextCycle->insertBetweeen(endofhist, aftertop); - m_top = m_nextCycle; - m_nextCycle = next; - } - emit changed(); - emit topChanged(); - } -} - -void History::cyclePrev() { - if (m_top && m_nextCycle) { - HistoryItem* prev = m_items[m_nextCycle->previous_uuid()]; - if (prev == m_top) { - return; - } - HistoryItem* prevprev = m_items[prev->previous_uuid()]; - HistoryItem* aftertop = m_items[m_top->next_uuid()]; - //if we have only two items in clipboard - if (m_nextCycle == prevprev) { - m_top=aftertop; - } - else { - HistoryItem* endofhist = m_items[m_top->previous_uuid()]; - if (prevprev == m_top) { - prevprev = prev; - aftertop = m_top; - } - else if (m_nextCycle == m_top) { - m_nextCycle = aftertop; - endofhist = m_top; - } - m_top->insertBetweeen(prevprev,m_nextCycle); - prev->insertBetweeen(endofhist, aftertop); - m_nextCycle = m_top; - m_top = prev; - } - emit changed(); - emit topChanged(); - } -} - - -const HistoryItem* History::nextInCycle() const -{ - return m_nextCycle != m_top ? m_nextCycle : 0L; // pointing to top=no more items - -} - -const HistoryItem* History::prevInCycle() const -{ - if (m_nextCycle) { - const HistoryItem* prev = m_items[m_nextCycle->previous_uuid()]; - if (prev != m_top) { - return prev; - } - } - return 0L; - -} - -const HistoryItem* History::find(const QByteArray& uuid) const -{ - items_t::const_iterator it = m_items.find(uuid); - return (it == m_items.end()) ? 0L : *it; -} - -#include "moc_history.cpp" diff --git a/klipper/history.h b/klipper/history.h deleted file mode 100644 index 4b2004ce..00000000 --- a/klipper/history.h +++ /dev/null @@ -1,185 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - Copyright (C) Andrew Stanley-Jones - - 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. -*/ -#ifndef HISTORY_H -#define HISTORY_H - -#include -#include -#include - -#include "historyitem.h" - -#include -class KlipperPopup; - -class History : public QObject -{ - Q_OBJECT -public: - History( QObject* parent ); - ~History(); - - /** - * Return (toplevel) popup menu (or default view, of you like) - */ - KlipperPopup* popup(); - - /** - * Inserts item into clipboard history top - * if duplicate entry exist, the older duplicate is deleted. - * The duplicate concept is "deep", so that two text string - * are considerd duplicate if identical. - */ - void insert( HistoryItem* item ); - - /** - * Inserts item into clipboard without any checks - * Used when restoring a saved history and internally. - * Don't use this unless you're reasonable certain - * that no duplicates are introduced - */ - void forceInsert( HistoryItem* item ); - - /** - * Remove (first) history item equal to item from history - */ - void remove( const HistoryItem* item ); - - /** - * Traversal: Get first item - */ - const HistoryItem* first() const; - - /** - * Get item identified by uuid - */ - const HistoryItem* find(const QByteArray& uuid) const; - - /** - * @return next item in cycle, or null if at end - */ - const HistoryItem* nextInCycle() const; - - /** - * @return previous item in cycle, or null if at top - */ - const HistoryItem* prevInCycle() const; - - /** - * True if no history items - */ - bool empty() const { return m_items.isEmpty(); } - - /** - * Set maximum history size - */ - void setMaxSize( unsigned max_size ); - - /** - * Get the maximum history size - */ - unsigned maxSize() const { return m_maxSize; } - - /** - * returns true if the user has selected the top item - */ - bool topIsUserSelected() { - return m_topIsUserSelected; - } - - /** - * Cycle to next item - */ - void cycleNext(); - - /** - * Cycle to prev item - */ - void cyclePrev(); - -public Q_SLOTS: - /** - * move the history in position pos to top - */ - void slotMoveToTop(QAction* action); - - /** - * move the history in position pos to top - */ - void slotMoveToTop(const QByteArray& uuid); - - /** - * Clear history - */ - void slotClear(); - -Q_SIGNALS: - void changed(); - - /** - * Emitted when the first history item has changed. - */ - void topChanged(); - -private: - /** - * ensure that the number of items does not exceed max_size() - * Deletes items from the end as necessary. - */ - void trim(); - -private: - typedef QHash items_t; - /** - * The history - */ - items_t m_items; - - /** - * First item - */ - HistoryItem* m_top; - - /** - * "Default view" --- a popupmenu containing the clipboard history. - */ - KlipperPopup* m_popup; - - - /** - * The number of clipboard items stored. - */ - unsigned m_maxSize; - - /** - * True if the top is selected by the user - */ - bool m_topIsUserSelected; - - /** - * The "next" when cycling through the - * history. May be 0, if history is empty - */ - HistoryItem* m_nextCycle; -}; - -inline const HistoryItem* History::first() const { return m_top; } - -#endif diff --git a/klipper/historyimageitem.cpp b/klipper/historyimageitem.cpp deleted file mode 100644 index 7c9f3b04..00000000 --- a/klipper/historyimageitem.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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 "klipper.h" -#include "historyimageitem.h" - -#include -#include - -#include - -namespace { - QByteArray compute_uuid(const QPixmap& data) { - QByteArray buffer; - QDataStream out(&buffer, QIODevice::WriteOnly); - out << data; - return QCryptographicHash::hash(buffer, KlipperHashAlgorithm); - } - -} - -HistoryImageItem::HistoryImageItem( const QPixmap& data ) - : HistoryItem(compute_uuid(data)) - , m_data( data ) -{ -} - -QString HistoryImageItem::text() const { - if ( m_text.isNull() ) { - m_text = QString( "%1x%2x%3 %4" ) - .arg( m_data.width() ) - .arg( m_data.height() ) - .arg( m_data.depth() ); - } - return m_text; - -} - -/* virtual */ -void HistoryImageItem::write( QDataStream& stream ) const { - stream << QString( "image" ) << m_data; -} - -QMimeData* HistoryImageItem::mimeData() const -{ - QMimeData *data = new QMimeData(); - data->setImageData(m_data.toImage()); - return data; -} - diff --git a/klipper/historyimageitem.h b/klipper/historyimageitem.h deleted file mode 100644 index 40fabb82..00000000 --- a/klipper/historyimageitem.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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. -*/ - -#ifndef HISTORYIMAGEITEM_H -#define HISTORYIMAGEITEM_H - -#include "historyitem.h" - -/** - * A image entry in the clipboard history. - */ -class HistoryImageItem : public HistoryItem -{ -public: - HistoryImageItem( const QPixmap& data ); - virtual ~HistoryImageItem() {} - virtual QString text() const; - virtual bool operator==( const HistoryItem& rhs) const { - if ( const HistoryImageItem* casted_rhs = dynamic_cast( &rhs ) ) { - return &casted_rhs->m_data == &m_data; // Not perfect, but better than nothing. - } - return false; - } - virtual const QPixmap& image() const { return m_data; } - virtual QMimeData* mimeData() const; - - virtual void write( QDataStream& stream ) const; - -private: - /** - * - */ - const QPixmap m_data; - /** - * Cache for m_data's string representation - */ - mutable QString m_text; -}; - - - -#endif diff --git a/klipper/historyitem.cpp b/klipper/historyitem.cpp deleted file mode 100644 index 5852c212..00000000 --- a/klipper/historyitem.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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 "historyitem.h" - -#include -#include - -#include - -#include "historystringitem.h" -#include "historyimageitem.h" -#include "historyurlitem.h" - -HistoryItem::HistoryItem(const QByteArray &uuid) - : m_uuid(uuid) -{ -} - -HistoryItem::~HistoryItem() -{ -} - -HistoryItem* HistoryItem::create(const QMimeData *data) -{ -#if 0 - int i=0; - foreach ( QString format, data->formats() ) { - kDebug() << "format(" << i++ <<"): " << format; - } -#endif - if (KUrl::List::canDecode(data)) - { - KUrl::List urls = KUrl::List::fromMimeData(data); - QByteArray bytes = data->data("application/x-kde-cutselection"); - bool cut = !bytes.isEmpty() && (bytes.at(0) == '1'); // true if 1 - return new HistoryURLItem(urls, cut); - } - if (data->hasText()) - { - return new HistoryStringItem(data->text()); - } - if (data->hasImage()) - { - QImage image = qvariant_cast(data->imageData()); - return new HistoryImageItem(QPixmap::fromImage(image)); - } - - return 0; // Failed. -} - -HistoryItem* HistoryItem::create(QDataStream &dataStream) -{ - if ( dataStream.atEnd() ) { - return 0; - } - QString type; - dataStream >> type; - if ( type == "url" ) { - KUrl::List urls; - int cut = 0; - dataStream >> urls; - dataStream >> cut; - return new HistoryURLItem( urls, cut ); - } - if ( type == "string" ) { - QString text; - dataStream >> text; - return new HistoryStringItem( text ); - } - if ( type == "image" ) { - QPixmap image; - dataStream >> image; - return new HistoryImageItem( image ); - } - kWarning() << "Failed to restore history item: Unknown type \"" << type << "\"" ; - return 0; -} - - - -void HistoryItem::chain(HistoryItem* next) -{ - m_next_uuid = next->uuid(); - next->m_previous_uuid = uuid(); -} - -void HistoryItem::insertBetweeen(HistoryItem* prev, HistoryItem* next) -{ - if (prev && next) { - prev->chain(this); - chain(next); - } else { - Q_ASSERT(!prev && !next); - // First item in chain - m_next_uuid = m_uuid; - m_previous_uuid = m_uuid; - } -#if 0 // Extra checks, if anyone ever needs them - Q_ASSERT(prev->uuid() == m_previous_uuid); - Q_ASSERT(prev->next_uuid() == m_uuid); - Q_ASSERT(next->previous_uuid() == m_uuid); - Q_ASSERT(next->uuid() == m_next_uuid); - Q_ASSERT(prev->uuid() != uuid()); - Q_ASSERT(next->uuid() != uuid()); -#endif -} - diff --git a/klipper/historyitem.h b/klipper/historyitem.h deleted file mode 100644 index 27102802..00000000 --- a/klipper/historyitem.h +++ /dev/null @@ -1,130 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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. -*/ -#ifndef HISTORYITEM_H -#define HISTORYITEM_H - -#include - -#include -#include -#include - -/** - * An entry in the clipboard history. - */ -class HistoryItem -{ -public: - HistoryItem(const QByteArray& uuid); - virtual ~HistoryItem(); - - /** - * Return the current item as text - * An image would be returned as a descriptive - * text, such as 32x43 image. - */ - virtual QString text() const = 0; - - /** - * @return uuid of current item. - */ - const QByteArray& uuid() const { - return m_uuid; - } - - /** - * Return the current item as pixmap - * A text would be returned as a null pixmap, - * which is also the default implementation - */ - inline virtual const QPixmap& image() const; - - /** - * Returns a pointer to a QMimeData suitable for QClipboard::setMimeData(). - */ - virtual QMimeData* mimeData() const = 0; - - /** - * Write object on datastream - */ - virtual void write( QDataStream& stream ) const = 0; - - /** - * Equality. - */ - virtual bool operator==(const HistoryItem& rhs) const = 0; - - /** - * Create an HistoryItem from MimeSources (i.e., clipboard data) - * returns null if create fails (e.g, unsupported mimetype) - */ - static HistoryItem* create( const QMimeData* data ); - - /** - * Create an HistoryItem from data stream (i.e., disk file) - * returns null if creation fails. In this case, the datastream - * is left in an undefined state. - */ - static HistoryItem* create( QDataStream& dataStream ); - - /** - * Inserts this item between prev and next - */ - void insertBetweeen(HistoryItem* prev, HistoryItem* next); - - /** - * Chain this with next - */ - void chain(HistoryItem* next); - - /** - * previous item's uuid - */ - const QByteArray& previous_uuid() const { - return m_previous_uuid; - } - - /** - * next item's uuid - */ - const QByteArray& next_uuid() const { - return m_next_uuid; - } -private: - QByteArray m_previous_uuid; - QByteArray m_uuid; - QByteArray m_next_uuid; -}; - -inline -const QPixmap& HistoryItem::image() const { - static QPixmap nullPixmap; - return nullPixmap; -} - -inline -QDataStream& operator<<( QDataStream& lhs, HistoryItem const * const rhs ) { - if ( rhs ) { - rhs->write( lhs ); - } - return lhs; - -} - -#endif diff --git a/klipper/historystringitem.cpp b/klipper/historystringitem.cpp deleted file mode 100644 index ba6ae9d2..00000000 --- a/klipper/historystringitem.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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 "klipper.h" -#include "historystringitem.h" - -#include - -HistoryStringItem::HistoryStringItem( const QString& data ) - : HistoryItem(QCryptographicHash::hash(data.toUtf8(), KlipperHashAlgorithm)) - , m_data( data ) -{ - -} - -/* virtual */ -void HistoryStringItem::write( QDataStream& stream ) const { - stream << QString( "string" ) << m_data; -} - -QMimeData* HistoryStringItem::mimeData() const -{ - QMimeData *data = new QMimeData(); - data->setText(m_data); - return data; -} - diff --git a/klipper/historystringitem.h b/klipper/historystringitem.h deleted file mode 100644 index 49489152..00000000 --- a/klipper/historystringitem.h +++ /dev/null @@ -1,54 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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. -*/ -#ifndef HISTORYSTRINGITEM_H -#define HISTORYSTRINGITEM_H - -#include - -#include "historyitem.h" - -/** - * A string entry in the clipboard history. - */ -class HistoryStringItem : public HistoryItem -{ -public: - HistoryStringItem( const QString& data ); - virtual ~HistoryStringItem() {} - virtual QString text() const; - virtual bool operator==( const HistoryItem& rhs) const { - if ( const HistoryStringItem* casted_rhs = dynamic_cast( &rhs ) ) { - return casted_rhs->m_data == m_data; - } - return false; - } - virtual QMimeData* mimeData() const; - - /** - * Write object on datastream - */ - virtual void write( QDataStream& stream ) const; - -private: - QString m_data; -}; - -inline QString HistoryStringItem::text() const { return m_data; } - -#endif diff --git a/klipper/historyurlitem.cpp b/klipper/historyurlitem.cpp deleted file mode 100644 index 6001be5c..00000000 --- a/klipper/historyurlitem.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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 "klipper.h" -#include "historyurlitem.h" - -#include -#include - -namespace { - QByteArray compute_uuid(const KUrl::List& _urls, bool _cut ) { - QCryptographicHash hash(KlipperHashAlgorithm); - foreach(const KUrl& url, _urls) { - hash.addData(url.toEncoded()); - hash.addData("\0", 1); // Use binary zero as that is not a valid path character - } - return hash.result(); - } -} - -HistoryURLItem::HistoryURLItem( const KUrl::List& _urls, bool _cut ) - : HistoryItem(compute_uuid(_urls, _cut)) - , m_urls( _urls ) - , m_cut( _cut ) -{ -} - -/* virtual */ -void HistoryURLItem::write( QDataStream& stream ) const -{ - stream << QString( "url" ) << m_urls << (int)m_cut; -} - -QString HistoryURLItem::text() const { - return m_urls.toStringList().join( " " ); -} - -QMimeData* HistoryURLItem::mimeData() const { - QMimeData *data = new QMimeData(); - m_urls.populateMimeData(data); - data->setData("application/x-kde-cutselection", QByteArray(m_cut ? "1" : "0")); - return data; -} - -bool HistoryURLItem::operator==( const HistoryItem& rhs) const -{ - if ( const HistoryURLItem* casted_rhs = dynamic_cast( &rhs ) ) { - return casted_rhs->m_urls == m_urls && casted_rhs->m_cut == m_cut; - } - return false; -} diff --git a/klipper/historyurlitem.h b/klipper/historyurlitem.h deleted file mode 100644 index 657a53a9..00000000 --- a/klipper/historyurlitem.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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. -*/ -#ifndef HISTORYURLITEM_H -#define HISTORYURLITEM_H - -#include - -#include "historyitem.h" - -/** - * An URL entry in the clipboard history. - */ -class HistoryURLItem : public HistoryItem -{ -public: - HistoryURLItem( const KUrl::List& urls, bool cut ); - virtual QString text() const; - virtual bool operator==( const HistoryItem& rhs) const; - virtual QMimeData* mimeData() const; - - /** - * Write object on datastream - */ - virtual void write( QDataStream& stream ) const; -private: - KUrl::List m_urls; - bool m_cut; -}; - -#endif diff --git a/klipper/klipper.cpp b/klipper/klipper.cpp deleted file mode 100644 index dbdc54aa..00000000 --- a/klipper/klipper.cpp +++ /dev/null @@ -1,1107 +0,0 @@ -/* This file is part of the KDE project - - Copyright (C) by Andrew Stanley-Jones - Copyright (C) 2000 by Carsten Pfeiffer - Copyright (C) 2004 Esben Mose Hansen - Copyright (C) 2008 by Dmitry Suzdalev - - 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 "klipper.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "configdialog.h" -#include "klippersettings.h" -#include "urlgrabber.h" -#include "version.h" -#include "history.h" -#include "historyitem.h" -#include "historystringitem.h" -#include "klipperpopup.h" - -#ifdef Q_WS_X11 -#include -#include -#endif - -//#define NOISY_KLIPPER - -namespace { - /** - * Use this when manipulating the clipboard - * from within clipboard-related signals. - * - * This avoids issues such as mouse-selections that immediately - * disappear. - * pattern: Resource Acqusition is Initialisation (RAII) - * - * (This is not threadsafe, so don't try to use such in threaded - * applications). - */ - struct Ignore { - Ignore(int& locklevel) : locklevelref(locklevel) { - locklevelref++; - } - ~Ignore() { - locklevelref--; - } - private: - int& locklevelref; - }; -} - -/** - * Helper class to save history upon session exit. - */ -class KlipperSessionManager : public KSessionManager -{ -public: - KlipperSessionManager( Klipper* k ) - : klipper( k ) - {} - - virtual ~KlipperSessionManager() {} - - /** - * Save state upon session exit. - * - * Saving history on session save - */ - virtual bool commitData( QSessionManager& ) { - klipper->saveSession(); - return true; - } -private: - Klipper* klipper; -}; - -// config == KGlobal::config for process, otherwise applet -Klipper::Klipper(QObject* parent, const KSharedConfigPtr& config) - : QObject( parent ) - , m_overflowCounter( 0 ) - , m_locklevel( 0 ) - , m_config( config ) - , m_pendingContentsCheck( false ) - , m_sessionManager( new KlipperSessionManager( this )) -{ - setenv("KSNI_NO_DBUSMENU", "1", 1); - QDBusConnection::sessionBus().registerObject("/klipper", this, QDBusConnection::ExportScriptableSlots); - - updateTimestamp(); // read initial X user time - m_clip = kapp->clipboard(); - - connect( m_clip, SIGNAL(changed(QClipboard::Mode)), - this, SLOT(newClipData(QClipboard::Mode)) ); - - connect( &m_overflowClearTimer, SIGNAL(timeout()), SLOT(slotClearOverflow())); - - m_pendingCheckTimer.setSingleShot( true ); - connect( &m_pendingCheckTimer, SIGNAL(timeout()), SLOT(slotCheckPending())); - - - m_history = new History( this ); - - // we need that collection, otherwise KToggleAction is not happy :} - m_collection = new KActionCollection( this ); - - m_toggleURLGrabAction = new KToggleAction( this ); - m_collection->addAction( "clipboard_action", m_toggleURLGrabAction ); - m_toggleURLGrabAction->setText(i18n("Enable Clipboard Actions")); - m_toggleURLGrabAction->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_X)); - connect( m_toggleURLGrabAction, SIGNAL(toggled(bool)), - this, SLOT(setURLGrabberEnabled(bool))); - - /* - * Create URL grabber - */ - m_myURLGrabber = new URLGrabber(m_history); - connect( m_myURLGrabber, SIGNAL(sigPopup(QMenu*)), - SLOT(showPopupMenu(QMenu*)) ); - connect( m_myURLGrabber, SIGNAL(sigDisablePopup()), - SLOT(disableURLGrabber()) ); - - /* - * Load configuration settings - */ - loadSettings(); - - // load previous history if configured - if (m_bKeepContents) { - loadHistory(); - } - - m_qrencodeexe = KStandardDirs::findExe("qrencode"); - - m_clearHistoryAction = m_collection->addAction( "clear-history" ); - m_clearHistoryAction->setIcon( KIcon("edit-clear-history") ); - m_clearHistoryAction->setText( i18n("C&lear Clipboard History") ); - m_clearHistoryAction->setGlobalShortcut(KShortcut()); - connect(m_clearHistoryAction, SIGNAL(triggered()), SLOT(slotAskClearHistory())); - - m_configureAction = m_collection->addAction( "configure" ); - m_configureAction->setIcon( KIcon("configure") ); - m_configureAction->setText( i18n("&Configure Klipper...") ); - connect(m_configureAction, SIGNAL(triggered(bool)), SLOT(slotConfigure())); - - m_quitAction = m_collection->addAction( "quit" ); - m_quitAction->setIcon( KIcon("application-exit") ); - m_quitAction->setText( i18nc("@item:inmenu Quit Klipper", "&Quit") ); - connect(m_quitAction, SIGNAL(triggered(bool)), SLOT(slotQuit())); - - m_repeatAction = m_collection->addAction("repeat_action"); - m_repeatAction->setText(i18n("Manually Invoke Action on Current Clipboard")); - m_repeatAction->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_R)); - connect(m_repeatAction, SIGNAL(triggered()), SLOT(slotRepeatAction())); - - // add an edit-possibility - m_editAction = m_collection->addAction("edit_clipboard"); - m_editAction->setIcon(KIcon("document-properties")); - m_editAction->setText(i18n("&Edit Contents...")); - m_editAction->setGlobalShortcut(KShortcut()); - connect(m_editAction, SIGNAL(triggered()), SLOT(slotEditData())); - - if (!m_qrencodeexe.isEmpty()) { - // add barcode for mobile phones - m_showBarcodeAction = m_collection->addAction("show-barcode"); - m_showBarcodeAction->setText(i18n("&Show Barcode...")); - m_showBarcodeAction->setGlobalShortcut(KShortcut()); - connect(m_showBarcodeAction, SIGNAL(triggered()), SLOT(slotShowBarcode())); - } - - // Cycle through history - m_cycleNextAction = m_collection->addAction("cycleNextAction"); - m_cycleNextAction->setText(i18n("Next History Item")); - m_cycleNextAction->setGlobalShortcut(KShortcut()); - connect(m_cycleNextAction, SIGNAL(triggered(bool)), SLOT(slotCycleNext())); - m_cyclePrevAction = m_collection->addAction("cyclePrevAction"); - m_cyclePrevAction->setText(i18n("Previous History Item")); - m_cyclePrevAction->setGlobalShortcut(KShortcut()); - connect(m_cyclePrevAction, SIGNAL(triggered(bool)), SLOT(slotCyclePrev())); - - // Action to show Klipper popup on mouse position - m_showOnMousePos = m_collection->addAction("show-on-mouse-pos"); - m_showOnMousePos->setText(i18n("Open Klipper at Mouse Position")); - m_showOnMousePos->setGlobalShortcut(KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_V)); - connect(m_showOnMousePos, SIGNAL(triggered(bool)), this, SLOT(slotPopupMenu())); - - KlipperPopup* popup = history()->popup(); - connect ( history(), SIGNAL(topChanged()), SLOT(slotHistoryTopChanged()) ); - connect( popup, SIGNAL(aboutToShow()), SLOT(slotStartShowTimer()) ); - - popup->plugAction( m_toggleURLGrabAction ); - popup->plugAction( m_clearHistoryAction ); - popup->plugAction( m_configureAction ); - popup->plugAction( m_repeatAction ); - popup->plugAction( m_editAction ); - if (!m_qrencodeexe.isEmpty()) { - popup->plugAction( m_showBarcodeAction ); - } - if ( !isApplet() ) { - popup->plugAction( m_quitAction ); - } -} - -Klipper::~Klipper() -{ - delete m_sessionManager; - delete m_myURLGrabber; -} - -// DBUS -QString Klipper::getClipboardContents() -{ - return getClipboardHistoryItem(0); -} - -void Klipper::showKlipperPopupMenu() { - slotPopupMenu(); -} -void Klipper::showKlipperManuallyInvokeActionMenu() { - slotRepeatAction(); -} - - -// DBUS - don't call from Klipper itself -void Klipper::setClipboardContents(QString s) -{ - if (s.isEmpty()) - return; - Ignore lock( m_locklevel ); - updateTimestamp(); - HistoryStringItem* item = new HistoryStringItem( s ); - setClipboard( *item, Clipboard | Selection); - history()->insert( item ); -} - -// DBUS - don't call from Klipper itself -void Klipper::clearClipboardContents() -{ - updateTimestamp(); - slotClearClipboard(); -} - -// DBUS - don't call from Klipper itself -void Klipper::clearClipboardHistory() -{ - updateTimestamp(); - slotClearClipboard(); - history()->slotClear(); - saveSession(); -} - -// DBUS - don't call from Klipper itself -void Klipper::saveClipboardHistory() -{ - if ( m_bKeepContents ) { // save the clipboard eventually - saveHistory(); - } -} - -void Klipper::slotStartShowTimer() -{ - m_showTimer.start(); -} - -void Klipper::loadSettings() -{ - // Security bug 142882: If user has save clipboard turned off, old data should be deleted from disk - static bool firstrun = true; - if (!firstrun && m_bKeepContents && !KlipperSettings::keepClipboardContents()) { - saveHistory(true); - } - firstrun=false; - - m_bKeepContents = KlipperSettings::keepClipboardContents(); - m_bReplayActionInHistory = KlipperSettings::replayActionInHistory(); - m_bNoNullClipboard = KlipperSettings::preventEmptyClipboard(); - // 0 is the id of "Ignore selection" radiobutton - m_bIgnoreSelection = KlipperSettings::ignoreSelection(); - m_bIgnoreImages = KlipperSettings::ignoreImages(); - m_bSynchronize = KlipperSettings::syncClipboards(); - m_bSelectionTextOnly = KlipperSettings::selectionTextOnly(); - - m_bURLGrabber = KlipperSettings::uRLGrabberEnabled(); - // this will cause it to loadSettings too - setURLGrabberEnabled(m_bURLGrabber); - history()->setMaxSize( KlipperSettings::maxClipItems() ); -} - -void Klipper::saveSettings() const -{ - m_myURLGrabber->saveSettings(); - KlipperSettings::self()->setVersion(klipper_version); - KlipperSettings::self()->writeConfig(); - - // other settings should be saved automatically by KConfigDialog -} - -void Klipper::showPopupMenu( QMenu* menu ) -{ - Q_ASSERT( menu != 0L ); - - QSize size = menu->sizeHint(); // geometry is not valid until it's shown - QPoint pos = QCursor::pos(); - // ### We can't know where the systray icon is (since it can be hidden or shown - // in several places), so the cursor position is the only option. - - if ( size.height() < pos.y() ) - pos.ry() -= size.height(); - - menu->popup(pos); -} - -bool Klipper::loadHistory() { - static const char* const failed_load_warning = - "Failed to load history resource. Clipboard history cannot be read."; - // don't use "appdata", klipper is also a kicker applet - QString history_file_name = KStandardDirs::locateLocal( "data", "klipper/history4.lst" ); - QFile history_file( history_file_name ); - if ( !history_file.exists() ) { - kWarning() << failed_load_warning << ": " << "History file does not exist" ; - return false; - } - if ( !history_file.open( QIODevice::ReadOnly ) ) { - kWarning() << failed_load_warning << ": " << history_file.errorString() ; - return false; - } - QDataStream file_stream( &history_file ); - if( file_stream.atEnd()) { - kWarning() << failed_load_warning << ": " << "Error in reading data" ; - return false; - } - QByteArray data; - QByteArray hash; - file_stream >> hash >> data; - if( QCryptographicHash::hash( data, KlipperHashAlgorithm ).toHex() != hash ) { - kWarning() << failed_load_warning << ": " << "Hash does not match" ; - return false; - } - QDataStream history_stream( &data, QIODevice::ReadOnly ); - - qint8 version; - history_stream >> version; - - // The list needs to be reversed, as it is saved - // youngest-first to keep the most important clipboard - // items at the top, but the history is created oldest - // first. - QList reverseList; - for ( HistoryItem* item = HistoryItem::create( history_stream ); - item; - item = HistoryItem::create( history_stream ) ) - { - reverseList.prepend( item ); - } - - history()->slotClear(); - - for ( QList::const_iterator it = reverseList.constBegin(); - it != reverseList.constEnd(); - ++it ) - { - history()->forceInsert( *it ); - } - - if ( !history()->empty() ) { - setClipboard( *history()->first(), Clipboard | Selection ); - } - - return true; -} - -void Klipper::saveHistory(bool empty) { - static const char* const failed_save_warning = - "Failed to save history. Clipboard history cannot be saved."; - // don't use "appdata", klipper is also a kicker applet - QString history_file_name( KStandardDirs::locateLocal( "data", "klipper/history4.lst" ) ); - if ( history_file_name.isNull() || history_file_name.isEmpty() ) { - kWarning() << failed_save_warning ; - return; - } - KSaveFile history_file( history_file_name ); - if ( !history_file.open() ) { - kWarning() << failed_save_warning ; - return; - } - QByteArray data; - QDataStream history_stream( &data, QIODevice::WriteOnly ); - history_stream << klipper_version_int; - - if (!empty) { - const HistoryItem *item = history()->first(); - if (item) { - do { - history_stream << item; - item = history()->find(item->next_uuid()); - } while (item != history()->first()); - } - } - - QByteArray hash = QCryptographicHash::hash( data, KlipperHashAlgorithm ).toHex(); - QDataStream ds ( &history_file ); - ds << hash << data; -} - -// save session on shutdown. Don't simply use the c'tor, as that may not be called. -void Klipper::saveSession() -{ - if ( m_bKeepContents ) { // save the clipboard eventually - saveHistory(); - } - saveSettings(); -} - -void Klipper::disableURLGrabber() -{ - KMessageBox::information( 0L, - i18n( "You can enable URL actions later by left-clicking on the " - "Klipper icon and selecting 'Enable Clipboard Actions'" ) ); - - setURLGrabberEnabled( false ); -} - -void Klipper::slotConfigure() -{ - if (KConfigDialog::showDialog("preferences")) { - return; - } - - ConfigDialog *dlg = new ConfigDialog( 0, KlipperSettings::self(), this, m_collection, isApplet() ); - connect(dlg, SIGNAL(settingsChanged(QString)), SLOT(loadSettings())); - - dlg->show(); -} - -void Klipper::slotQuit() -{ - // If the menu was just opened, likely the user - // selected quit by accident while attempting to - // click the Klipper icon. - if ( m_showTimer.elapsed() < 300 ) { - return; - } - - saveSession(); - int autoStart = KMessageBox::questionYesNoCancel(0, i18n("Should Klipper start automatically when you login?"), - i18n("Automatically Start Klipper?"), KGuiItem(i18n("Start")), - KGuiItem(i18n("Do Not Start")), KStandardGuiItem::cancel(), "StartAutomatically"); - - KConfigGroup config( KGlobal::config(), "General"); - if ( autoStart == KMessageBox::Yes ) { - config.writeEntry("AutoStart", true); - } else if ( autoStart == KMessageBox::No) { - config.writeEntry("AutoStart", false); - } else // cancel chosen don't quit - return; - config.sync(); - - kapp->quit(); - -} - -void Klipper::slotPopupMenu() { - KlipperPopup* popup = history()->popup(); - popup->ensureClean(); - popup->slotSetTopActive(); - showPopupMenu( popup ); -} - - -void Klipper::slotRepeatAction() -{ - const HistoryStringItem* top = dynamic_cast( history()->first() ); - if ( top ) { - m_myURLGrabber->invokeAction( top ); - } -} - -void Klipper::setURLGrabberEnabled( bool enable ) -{ - if (enable != m_bURLGrabber) { - m_bURLGrabber = enable; - m_lastURLGrabberTextSelection.clear(); - m_lastURLGrabberTextClipboard.clear(); - KlipperSettings::setURLGrabberEnabled(enable); - } - - m_toggleURLGrabAction->setChecked( enable ); - - // make it update its settings - m_myURLGrabber->loadSettings(); -} - -void Klipper::slotHistoryTopChanged() { - if ( m_locklevel ) { - return; - } - - const HistoryItem* topitem = history()->first(); - if ( topitem ) { - setClipboard( *topitem, Clipboard | Selection ); - } - if ( m_bReplayActionInHistory && m_bURLGrabber ) { - slotRepeatAction(); - } -} - -void Klipper::slotClearClipboard() -{ - Ignore lock( m_locklevel ); - - m_clip->clear(QClipboard::Selection); - m_clip->clear(QClipboard::Clipboard); -} - -HistoryItem* Klipper::applyClipChanges( const QMimeData* clipData ) -{ - if ( m_locklevel ) { - return 0L; - } - Ignore lock( m_locklevel ); - HistoryItem* item = HistoryItem::create( clipData ); - history()->insert( item ); - return item; - -} - -void Klipper::newClipData( QClipboard::Mode mode ) -{ - if ( m_locklevel ) { - return; - } - - if( mode == QClipboard::Selection && blockFetchingNewData()) - return; - - checkClipData( mode == QClipboard::Selection ? true : false ); - -} - -// Protection against too many clipboard data changes. Lyx responds to clipboard data -// requests with setting new clipboard data, so if Lyx takes over clipboard, -// Klipper notices, requests this data, this triggers "new" clipboard contents -// from Lyx, so Klipper notices again, requests this data, ... you get the idea. -const int MAX_CLIPBOARD_CHANGES = 10; // max changes per second - -bool Klipper::blockFetchingNewData() -{ -#ifdef Q_WS_X11 -// Hacks for #85198 and #80302. -// #85198 - block fetching new clipboard contents if Shift is pressed and mouse is not, -// this may mean the user is doing selection using the keyboard, in which case -// it's possible the app sets new clipboard contents after every change - Klipper's -// history would list them all. -// #80302 - OOo (v1.1.3 at least) has a bug that if Klipper requests its clipboard contents -// while the user is doing a selection using the mouse, OOo stops updating the clipboard -// contents, so in practice it's like the user has selected only the part which was -// selected when Klipper asked first. -// Use XQueryPointer rather than QApplication::mouseButtons()/keyboardModifiers(), because -// Klipper needs the very current state. - Window root, child; - int root_x, root_y, win_x, win_y; - uint state; - XQueryPointer( QX11Info::display(), QX11Info::appRootWindow(), &root, &child, - &root_x, &root_y, &win_x, &win_y, &state ); - if( ( state & ( ShiftMask | Button1Mask )) == ShiftMask // #85198 - || ( state & Button1Mask ) == Button1Mask ) { // #80302 - m_pendingContentsCheck = true; - m_pendingCheckTimer.start( 100 ); - return true; - } - m_pendingContentsCheck = false; - if ( m_overflowCounter == 0 ) - m_overflowClearTimer.start( 1000 ); - if( ++m_overflowCounter > MAX_CLIPBOARD_CHANGES ) - return true; -#endif - return false; -} - -void Klipper::slotCheckPending() -{ - if( !m_pendingContentsCheck ) - return; - m_pendingContentsCheck = false; // blockFetchingNewData() will be called again - updateTimestamp(); - newClipData( QClipboard::Selection ); // always selection -} - -void Klipper::slotSaveBarcode() -{ - const QString path = KFileDialog::getSaveFileName( - KUrl("kfiledialog:///qrcode"), - KImageIO::pattern(KImageIO::Writing), - nullptr, - QString(), - KFileDialog::ConfirmOverwrite - ); - if (!path.isEmpty()) { - if (!m_qrpixmap.save(path)) { - KMessageBox::error(nullptr, i18n("Could not save QR Code image")); - }; - } -} - -void Klipper::checkClipData( bool selectionMode ) -{ - if ( ignoreClipboardChanges() ) // internal to klipper, ignoring QSpinBox selections - { - // keep our old clipboard, thanks - // This won't quite work, but it's close enough for now. - // The trouble is that the top selection =! top clipboard - // but we don't track that yet. We will.... - const HistoryItem* top = history()->first(); - if ( top ) { - setClipboard( *top, selectionMode ? Selection : Clipboard); - } - return; - } - -// debug code -#ifdef NOISY_KLIPPER - kDebug() << "Checking clip data"; - - kDebug() << "====== c h e c k C l i p D a t a ============================" - << kBacktrace() - << "====== c h e c k C l i p D a t a ============================"; - - - if ( sender() ) { - kDebug() << "sender=" << sender()->objectName(); - } else { - kDebug() << "no sender"; - } - - kDebug() << "\nselectionMode=" << selectionMode - << "\nowning (sel,cli)=(" << m_clip->ownsSelection() << "," << m_clip->ownsClipboard() << ")" - << "\ntext=" << m_clip->text( selectionMode ? QClipboard::Selection : QClipboard::Clipboard); -#endif - - const QMimeData* data = m_clip->mimeData( selectionMode ? QClipboard::Selection : QClipboard::Clipboard ); - if ( !data ) { - kWarning() << "No data in clipboard. This not not supposed to happen."; - return; - } - - bool changed = true; // ### FIXME (only relevant under polling, might be better to simply remove polling and rely on XFixes) - bool clipEmpty = data->formats().isEmpty(); - if (clipEmpty) { - // Might be a timeout. Try again - clipEmpty = data->formats().isEmpty(); -#ifdef NOISY_KLIPPER - kDebug() << "was empty. Retried, now " << (clipEmpty?" still empty":" no longer empty"); -#endif - } - - if ( changed && clipEmpty && m_bNoNullClipboard ) { - const HistoryItem* top = history()->first(); - if ( top ) { - // keep old clipboard after someone set it to null -#ifdef NOISY_KLIPPER - kDebug() << "Resetting clipboard (Prevent empty clipboard)"; -#endif - setClipboard( *top, selectionMode ? Selection : Clipboard ); - } - return; - } - - // this must be below the "bNoNullClipboard" handling code! - // XXX: I want a better handling of selection/clipboard in general. - // XXX: Order sensitive code. Must die. - if ( selectionMode && m_bIgnoreSelection ) - return; - - if( selectionMode && m_bSelectionTextOnly && !data->hasText()) - return; - - if( KUrl::List::canDecode( data ) ) - ; // ok - else if( data->hasText() ) - ; // ok - else if( data->hasImage() ) - { - if( m_bIgnoreImages ) - return; - } - else // unknown, ignore - return; - - HistoryItem* item = applyClipChanges( data ); - if (changed) { -#ifdef NOISY_KLIPPER - kDebug() << "Synchronize?" << m_bSynchronize; -#endif - if ( m_bSynchronize && item ) { - setClipboard( *item, selectionMode ? Clipboard : Selection ); - } - } - QString& lastURLGrabberText = selectionMode - ? m_lastURLGrabberTextSelection : m_lastURLGrabberTextClipboard; - if( m_bURLGrabber && item && data->hasText()) - { - m_myURLGrabber->checkNewData( item ); - - // Make sure URLGrabber doesn't repeat all the time if klipper reads the same - // text all the time (e.g. because XFixes is not available and the application - // has broken TIMESTAMP target). Using most recent history item may not always - // work. - if ( item->text() != lastURLGrabberText ) - { - lastURLGrabberText = item->text(); - } - } else { - lastURLGrabberText.clear(); - } -} - -void Klipper::setClipboard( const HistoryItem& item, int mode ) -{ - Ignore lock( m_locklevel ); - - Q_ASSERT( ( mode & 1 ) == 0 ); // Warn if trying to pass a boolean as a mode. - - if ( mode & Selection ) { -#ifdef NOISY_KLIPPER - kDebug() << "Setting selection to <" << item.text() << ">"; -#endif - m_clip->setMimeData( item.mimeData(), QClipboard::Selection ); - } - if ( mode & Clipboard ) { -#ifdef NOISY_KLIPPER - kDebug() << "Setting clipboard to <" << item.text() << ">"; -#endif - m_clip->setMimeData( item.mimeData(), QClipboard::Clipboard ); - } - -} - -void Klipper::slotClearOverflow() -{ - m_overflowClearTimer.stop(); - - if( m_overflowCounter > MAX_CLIPBOARD_CHANGES ) { - kDebug() << "App owning the clipboard/selection is lame"; - // update to the latest data - this unfortunately may trigger the problem again - newClipData( QClipboard::Selection ); // Always the selection. - } - m_overflowCounter = 0; -} - -QStringList Klipper::getClipboardHistoryMenu() -{ - QStringList menu; - const HistoryItem* item = history()->first(); - if (item) { - do { - menu << item->text(); - item = history()->find(item->next_uuid()); - } while (item != history()->first()); - } - - return menu; -} - -QString Klipper::getClipboardHistoryItem(int i) -{ - const HistoryItem* item = history()->first(); - if (item) { - do { - if (i-- == 0) { - return item->text(); - } - item = history()->find(item->next_uuid()); - } while (item != history()->first()); - } - return QString(); - -} - -// -// changing a spinbox in klipper's config-dialog causes the lineedit-contents -// of the spinbox to be selected and hence the clipboard changes. But we don't -// want all those items in klipper's history. See #41917 -// -bool Klipper::ignoreClipboardChanges() const -{ - QWidget *focusWidget = qApp->focusWidget(); - if ( focusWidget && focusWidget->inherits( "QSpinBox" ) ) { - return true; - } - - return false; -} - -#ifdef Q_WS_X11 -// QClipboard uses qt_x_time as the timestamp for selection operations. -// It is updated mainly from user actions, but Klipper polls the clipboard -// without any user action triggering it, so qt_x_time may be old, -// which could possibly lead to QClipboard reporting empty clipboard. -// Therefore, qt_x_time needs to be updated to current X server timestamp. - -// Call KApplication::updateUserTime() only from functions that are -// called from outside (DBUS), or from QTimer timeout ! - -static Time next_x_time; -static Bool update_x_time_predicate( Display*, XEvent* event, XPointer ) -{ - if( next_x_time != CurrentTime ) - return False; - // from qapplication_x11.cpp - switch ( event->type ) { - case ButtonPress: - // fallthrough intended - case ButtonRelease: - next_x_time = event->xbutton.time; - break; - case MotionNotify: - next_x_time = event->xmotion.time; - break; - case KeyPress: - // fallthrough intended - case KeyRelease: - next_x_time = event->xkey.time; - break; - case PropertyNotify: - next_x_time = event->xproperty.time; - break; - case EnterNotify: - case LeaveNotify: - next_x_time = event->xcrossing.time; - break; - case SelectionClear: - next_x_time = event->xselectionclear.time; - break; - default: - break; - } - return False; -} -#endif - -void Klipper::updateTimestamp() -{ -#ifdef Q_WS_X11 - static QWidget* w = 0; - if ( !w ) - w = new QWidget; - unsigned char data[ 1 ]; - XChangeProperty( QX11Info::display(), w->winId(), XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 ); - next_x_time = CurrentTime; - XEvent dummy; - XCheckIfEvent( QX11Info::display(), &dummy, update_x_time_predicate, NULL ); - if( next_x_time == CurrentTime ) - { - XSync( QX11Info::display(), False ); - XCheckIfEvent( QX11Info::display(), &dummy, update_x_time_predicate, NULL ); - } - Q_ASSERT( next_x_time != CurrentTime ); - QX11Info::setAppTime( next_x_time ); - XEvent ev; // remove the PropertyNotify event from the events queue - XWindowEvent( QX11Info::display(), w->winId(), PropertyChangeMask, &ev ); -#endif -} - -static const char * const description = - I18N_NOOP("KDE cut & paste history utility"); - -void Klipper::createAboutData() -{ - m_about_data = new KAboutData("klipper", 0, ki18n("Klipper"), - klipper_version, ki18n(description), KAboutData::License_GPL, - ki18n("(c) 1998, Andrew Stanley-Jones\n" - "1998-2002, Carsten Pfeiffer\n" - "2001, Patrick Dubroy")); - - m_about_data->addAuthor(ki18n("Carsten Pfeiffer"), - ki18n("Author"), - "pfeiffer@kde.org"); - - m_about_data->addAuthor(ki18n("Andrew Stanley-Jones"), - ki18n( "Original Author" ), - "asj@cban.com"); - - m_about_data->addAuthor(ki18n("Patrick Dubroy"), - ki18n("Contributor"), - "patrickdu@corel.com"); - - m_about_data->addAuthor( ki18n("Luboš Luňák"), - ki18n("Bugfixes and optimizations"), - "l.lunak@kde.org"); - - m_about_data->addAuthor( ki18n("Esben Mose Hansen"), - ki18n("Maintainer"), - "kde@mosehansen.dk"); -} - -void Klipper::destroyAboutData() -{ - delete m_about_data; - m_about_data = NULL; -} - -KAboutData* Klipper::m_about_data; - -KAboutData* Klipper::aboutData() -{ - return m_about_data; -} - -void Klipper::slotEditData() -{ - const HistoryStringItem* item = dynamic_cast(m_history->first()); - - KDialog dlg; - dlg.setModal( true ); - dlg.setCaption( i18n("Edit Contents") ); - dlg.setButtons( KDialog::Ok | KDialog::Cancel ); - - KTextEdit *edit = new KTextEdit( &dlg ); - if (item) { - edit->setText( item->text() ); - } - edit->setFocus(); - edit->setMinimumSize( 300, 40 ); - dlg.setMainWidget( edit ); - dlg.adjustSize(); - - if ( dlg.exec() == KDialog::Accepted ) { - QString text = edit->toPlainText(); - if (item) { - m_history->remove( item ); - } - m_history->insert( new HistoryStringItem(text) ); - if (m_myURLGrabber) { - m_myURLGrabber->checkNewData( m_history->first() ); - } - } - -} - -void Klipper::slotShowBarcode() -{ - const HistoryStringItem* item = dynamic_cast(m_history->first()); - - m_qrpixmap = QPixmap(); - - KDialog dlg; - dlg.setModal( true ); - dlg.setCaption( i18n("Mobile Barcode") ); - dlg.setButtons( KDialog::User1 | KDialog::Ok ); - dlg.setButtonText( KDialog::User1, i18nc("@action:button", "Save as")); - dlg.setButtonIcon( KDialog::User1, KIcon("document-save")); - connect(&dlg, SIGNAL(user1Clicked()), this, SLOT(slotSaveBarcode())); - - QWidget* mw = new QWidget(&dlg); - QHBoxLayout* layout = new QHBoxLayout(mw); - - QLabel* qrcode = new QLabel(mw); - - if (item) { - QString qrpath; - { - KTemporaryFile ktempfile; - ktempfile.open(); - qrpath = ktempfile.fileName(); - } - QString qrtext = item->text(); - - QProcess qrproc(this); - qrproc.start(m_qrencodeexe, QStringList() << "-o" << qrpath << "-t" << "PNG"); - if (qrproc.waitForStarted()) { - qrproc.write(qrtext.toLocal8Bit()); - qrproc.closeWriteChannel(); - } - qrproc.waitForFinished(); - if (qrproc.exitCode() == 0) { - m_qrpixmap = QPixmap(qrpath); - } else { - qrtext = qrproc.readAllStandardError(); - } - - qrcode->setText( qrtext ); - if (!m_qrpixmap.isNull()) { - qrcode->setPixmap( m_qrpixmap ); - } - - if (!qrpath.isEmpty()) { - QFile::remove(qrpath); - } - } - - layout->addWidget(qrcode, 0, Qt::AlignHCenter | Qt::AlignVCenter); - - mw->setFocus(); - dlg.setMainWidget( mw ); - dlg.adjustSize(); - - dlg.exec(); -} - -void Klipper::slotAskClearHistory() -{ - int clearHist = KMessageBox::questionYesNo(0, - i18n("Really delete entire clipboard history?"), - i18n("Delete clipboard history?"), - KStandardGuiItem::yes(), - KStandardGuiItem::no(), - QString::fromUtf8("really_clear_history"), - KMessageBox::Dangerous); - if (clearHist == KMessageBox::Yes) { - history()->slotClear(); - slotClearClipboard(); - saveHistory(); - } - -} - -void Klipper::slotCycleNext() -{ - //do cycle and show popup only if we have something in clipboard - if (m_history->first()) { - m_history->cycleNext(); - emit passivePopup(i18n("Clipboard history"), cycleText()); - } -} - -void Klipper::slotCyclePrev() -{ - //do cycle and show popup only if we have something in clipboard - if (m_history->first()) { - m_history->cyclePrev(); - emit passivePopup(i18n("Clipboard history"), cycleText()); - } -} - -QString Klipper::cycleText() const -{ - const int WIDTH_IN_PIXEL = 400; - - const HistoryItem* itemprev = m_history->prevInCycle(); - const HistoryItem* item = m_history->first(); - const HistoryItem* itemnext = m_history->nextInCycle(); - - QFontMetrics font_metrics(m_history->popup()->fontMetrics()); - QString result(""); - - if (itemprev) { - result += ""; - } - - result += ""; - - if (itemnext) { - result += ""; - } - - result += "
"; - result += i18n("up"); - result += ""; - result += font_metrics.elidedText(Qt::escape(itemprev->text().simplified()), Qt::ElideMiddle, WIDTH_IN_PIXEL); - result += "
"; - result += i18n("current"); - result += ""; - result += font_metrics.elidedText(Qt::escape(item->text().simplified()), Qt::ElideMiddle, WIDTH_IN_PIXEL); - result += "
"; - result += i18n("down"); - result += ""; - result += font_metrics.elidedText(Qt::escape(itemnext->text().simplified()), Qt::ElideMiddle, WIDTH_IN_PIXEL); - result += "
"; - return result; -} - -#include "moc_klipper.cpp" diff --git a/klipper/klipper.desktop b/klipper/klipper.desktop deleted file mode 100755 index 23cb4b82..00000000 --- a/klipper/klipper.desktop +++ /dev/null @@ -1,269 +0,0 @@ -[Desktop Entry] -Name=Klipper -Name[af]=Klipper -Name[ar]=Klipper -Name[ast]=Klipper -Name[be]=Klipper -Name[be@latin]=Klipper -Name[bg]=Klipper -Name[bn]=ক্লিপার -Name[bn_IN]=Klipper -Name[br]=Klipper -Name[bs]=Kliper -Name[ca]=Klipper -Name[ca@valencia]=Klipper -Name[cs]=Klipper -Name[csb]=Klipper -Name[cy]=Klipper -Name[da]=Klipper -Name[de]=Klipper -Name[el]=Klipper -Name[en_GB]=Klipper -Name[eo]=Poŝilo -Name[es]=Klipper -Name[et]=Klipper -Name[eu]=Klipper -Name[fa]=Klipper -Name[fi]=Klipper -Name[fr]=Klipper -Name[fy]=Klipper -Name[ga]=Klipper -Name[gl]=Klipper -Name[gu]=ક્લિપર -Name[he]=Klipper -Name[hi]=क्लिपर -Name[hne]=क्लिपर -Name[hr]=Klipper -Name[hsb]=Klipper -Name[hu]=Klipper -Name[ia]=Klipper -Name[id]=Klipper -Name[is]=Klipper -Name[it]=Klipper -Name[ja]=Klipper -Name[ka]=Klipper -Name[kk]=Алмасу буфері -Name[km]=Klipper -Name[kn]=ಕ್ಲಿಪ್ಪರ್ -Name[ko]=Klipper -Name[ku]=Klipper -Name[lt]=Klipper -Name[lv]=Klipper -Name[mai]=क्लिपर -Name[mk]=Клипер -Name[ml]=ക്ലിപ്പര്‍ -Name[mr]=क्लिपर -Name[ms]=Klipper -Name[nb]=Klipper -Name[nds]=Klipper -Name[ne]=क्लिपर -Name[nl]=Klipper -Name[nn]=Klipper -Name[pa]=ਕੇਲਿਪਰ -Name[pl]=Klipper -Name[pt]=Klipper -Name[pt_BR]=Klipper -Name[ro]=Klipper -Name[ru]=Klipper -Name[se]=Klipper -Name[si]=Klipper -Name[sk]=Klipper -Name[sl]=Klipper -Name[sr]=Клипер -Name[sr@ijekavian]=Клипер -Name[sr@ijekavianlatin]=Klipper -Name[sr@latin]=Klipper -Name[sv]=Klipper -Name[ta]=க்ளிப்பர் -Name[te]=క్లిప్పర్ -Name[tg]=Клиппер -Name[th]=คลิปเปอร์ -Name[tr]=Klipper -Name[ug]=Klipper -Name[uk]=Klipper -Name[uz]=Klipper -Name[uz@cyrillic]=Klipper -Name[vi]=Klipper -Name[wa]=Klipper -Name[xh]=Klipper -Name[x-test]=xxKlipperxx -Name[zh_CN]=Klipper -Name[zh_TW]=剪貼薄(Klipper) -GenericName=Clipboard Tool -GenericName[af]=Klipbord Program -GenericName[ar]=أداة الحافظة -GenericName[ast]=Cartafueyu -GenericName[be]=Буфер абмену -GenericName[be@latin]=Pryłada, jakaja absłuhoŭvaje abmienny bufer -GenericName[bg]=Системен буфер -GenericName[bn]=ক্লিপবোর্ড টুল -GenericName[br]=Ostilh ar golver -GenericName[bs]=Alatka za klipbord -GenericName[ca]=Eina de porta-retalls -GenericName[ca@valencia]=Eina de porta-retalls -GenericName[cs]=Program pro práci se schránkou -GenericName[csb]=Nôrzãdze tacnika -GenericName[cy]=Offeryn Gludfwrdd -GenericName[da]=Udklipsholderværktøj -GenericName[de]=Verwaltung der Zwischenablage -GenericName[el]=Εργαλείο πρόχειρου -GenericName[en_GB]=Clipboard Tool -GenericName[eo]=Ilo por la poŝo -GenericName[es]=Portapapeles -GenericName[et]=Lõikepuhvri haldamine -GenericName[eu]=Arbeleko tresna -GenericName[fa]=ابزار تخته‌یادداشت -GenericName[fi]=Leikepöytätyökalu -GenericName[fr]=Presse-papier -GenericName[fy]=Klamboerdbehear -GenericName[ga]=Uirlis Ghearrthaisce -GenericName[gl]=Utilidade de portarretallos -GenericName[gu]=ક્લિપ બોર્ડ સાધન -GenericName[he]=כלי לוח גזירה -GenericName[hi]=क्लिपबोर्ड औज़ार -GenericName[hne]=क्लिपबोर्ड औजार -GenericName[hr]=Alat međuspremnika -GenericName[hsb]=Zapisnik -GenericName[hu]=Vágólapkezelő -GenericName[ia]=Instrumento de Area de transferentia -GenericName[id]=Alat Papan Klip -GenericName[is]=Klippispjaldstól -GenericName[it]=Strumento per gli appunti -GenericName[ja]=クリップボードツール -GenericName[ka]=გაცვლის ბუფერის უტილიტა -GenericName[kk]=Алмасу буфер құралы -GenericName[km]=ឧបករណ៍​ក្ដារ​តម្បៀត​ខ្ទាស់ -GenericName[kn]=ಹಿಡಿಕೆ ಕಟ್ಟು (ಕ್ಲಿಪ್ ಬೋರ್ಡ್) ಸಲಕರಣೆ -GenericName[ko]=클립보드 도구 -GenericName[lt]=Laikinos talpyklės priemonė -GenericName[lv]=Starpliktuves rīks -GenericName[mai]=क्लिपबोर्ड अओजार -GenericName[mk]=Алатка за табла со исечоци -GenericName[ml]=ക്ലിപ്ബോര്‍ഡ് ഉപകരണം -GenericName[mr]=क्लिपबोर्ड साधन -GenericName[ms]=Alat Klipbod -GenericName[nb]=Utklippstavle -GenericName[nds]=Twischenaflaag-Warktüüch -GenericName[ne]=क्लिपबोर्ड उपकरण -GenericName[nl]=Klembordbeheer -GenericName[nn]=Utklippstavle -GenericName[pa]=ਕਲਿੱਪਬੋਰਡ ਟੂਲ -GenericName[pl]=Narzędzie schowka -GenericName[pt]=Ferramenta da Área de Transferência -GenericName[pt_BR]=Ferramenta da área de transferência -GenericName[ro]=Utilitar de clipboard -GenericName[ru]=Монитор буфера обмена -GenericName[se]=Čuohpusgirjereaidu -GenericName[si]=ක්ලිප් පුවරු මෙවලම -GenericName[sk]=Nástroj pre schránku -GenericName[sl]=Orodje za odložišče -GenericName[sr]=Алатка за клипборд -GenericName[sr@ijekavian]=Алатка за клипборд -GenericName[sr@ijekavianlatin]=Alatka za klipbord -GenericName[sr@latin]=Alatka za klipbord -GenericName[sv]=Klippbordsverktyg -GenericName[ta]=தற்காலிக கருவி -GenericName[te]=క్లిప్ బోర్డ్ పనిముట్టు -GenericName[tg]=Утилита для буфера обмена -GenericName[th]=เครื่องมือคลิปบอร์ด -GenericName[tr]=Pano Aracı -GenericName[ug]=چاپلاش تاختىسى قورالى -GenericName[uk]=Утиліта буфера даних -GenericName[uz]=Klipbord vositasi -GenericName[uz@cyrillic]=Клипборд воситаси -GenericName[vi]=Công cụ bảng nhớ tạm -GenericName[wa]=Usteye presse-papî -GenericName[xh]=Isixhobo Sebhodi eqhoboshayo -GenericName[x-test]=xxClipboard Toolxx -GenericName[zh_CN]=剪贴板工具 -GenericName[zh_TW]=剪貼簿工具 -Exec=klipper --icon '%i' --caption '%c' -Icon=klipper -Type=Application -X-DocPath=klipper/index.html -Terminal=false -StartupNotify=false -X-KDE-autostart-condition=klipperrc:General:AutoStart:true -OnlyShowIn=KDE; -Categories=Qt;KDE;Utility;X-KDE-Utilities-Desktop; -Comment=A cut & paste history utility -Comment[af]='n Knip & plak geskiedenis program -Comment[ar]=أداة تاريخ القص واللصق -Comment[ast]=Una utilidá de cortar y apegar historial -Comment[be]=Службовая праграма працы з гісторыяй выразання/устаўкі -Comment[be@latin]=Pryłada dla prahladu historyi aperacyjaŭ vycinańnia dy ŭklejvańnia -Comment[bg]=Инструмент за управление на операциите по копиране и поставяне -Comment[bs]=Alatka za istorijat isecanja i naljepljivanja -Comment[ca]=Una utilitat de la història de tallar i enganxar -Comment[ca@valencia]=Una utilitat de la història de tallar i apegar -Comment[cs]=Nástroj pro historii práce se schránkou -Comment[csb]=Nôrzãdze trzëmôjące historëjã tacnika -Comment[da]=Et værktøj med historik til at klippe ud og indsætte -Comment[de]=Programm zur Verwaltung der Zwischenablage -Comment[el]=Ένα εργαλείο ιστορικού αποκοπής & επικόλλησης -Comment[en_GB]=A cut & paste history utility -Comment[eo]=Ilo por la eltonda kaj alglua historio -Comment[es]=Una utilidad de cortar y pegar historial -Comment[et]=Lõikamiste ja asetamiste ajaloo rakendus -Comment[eu]=Ebaki/Itsatsi historiaren tresna bat -Comment[fa]=برنامه سودمند تاریخچه برش و چسباندن -Comment[fi]=Työkalu leikkaamiseen ja liittämiseen -Comment[fr]=Un outil d'historique de copier / coller -Comment[fy]=Klamboerdhistoarje -Comment[ga]=Uirlis staire gearrtha agus greamaithe -Comment[gl]=Un historial de cortar e apegar -Comment[gu]=ઇતિહાસ કાપવા અને મૂકવાનું સાધન -Comment[he]=כלי המשמש לשמירת היסטוריה אודות גזירה והדבקה -Comment[hi]=काटें एवं चिपकाएं इतिहास यूटिलिटी -Comment[hne]=काटव अउ चिपकाव इतिहास यूटिलिटी -Comment[hr]=Alat za izrezivanje i preljepljivanje iz povijesti -Comment[hsb]=Nastroj za wutřihanje a zasunjenje z prjedawšich přikazow -Comment[hu]=Kezelőprogram a vágólaphoz (naplózással) -Comment[ia]=Un utilitate per historia de talia & colla -Comment[id]=Sebuah utilitas riwayat potong & tempel -Comment[is]=Klipp & lím sögutól -Comment[it]=Un programma per la cronologia del copia e incolla -Comment[ja]=カット&ペースト履歴ユーティリティ -Comment[kk]=Қиып алу және орналастыру журналы -Comment[km]=កាត់ និង​បិទភ្ជាប់​ឧបករណ៍​ប្រើប្រាស់​ប្រវត្តិ -Comment[kn]=ಕತ್ತರಿಸು ಮತ್ತು ಅಂಟಿಸು ಚರಿತ್ರೆ ಸೌಲಭ್ಯ -Comment[ko]=자르고 붙인 기록 도구 -Comment[lt]=„Iškirpti ir padėti“ istorijos pagalbinė programa -Comment[lv]=Izgriešanas un ielīmēšanas vēstures rīks -Comment[mai]=काटू आओर साटू इतिहास यूटिलिटी -Comment[mk]=Алатка за историјат на сечење и вметнување -Comment[ml]=മുറിക്കല്‍-പകര്‍ത്തല്‍ നാള്‍വഴിസൂക്ഷിപ്പുസഹായി. -Comment[mr]=कापा व चिकटवा इतिहास उपकार्यक्रम -Comment[nb]=Et verktøy som viser tidligere utklipp -Comment[nds]=Vörgeschicht vun't Knippen un Infögen -Comment[ne]=काट्ने र टाँस्ने इतिहास उपयोगिता -Comment[nl]=Klembordgeschiedenis -Comment[nn]=Eit verktøy som viser eldre utklipp -Comment[pa]=ਇੱਕ ਕੱਟਣ ਅਤੇ ਚੇਪਣ ਅਤੀਤ ਸਹੂਲਤ -Comment[pl]=Narzędzie przechowujące historię schowka -Comment[pt]=Um utilitário de histórico de cópias e colagens -Comment[pt_BR]=Um utilitário com o histórico de recortar e colar -Comment[ro]=Utilitar cu istoria de tăiere și adăugare -Comment[ru]=История буфера обмена -Comment[se]=Reaidu mii čájeha boares čuohppusiid -Comment[si]=කැපීම් හා ඇලවීම් ඉතිහාස මෙවලම -Comment[sk]=Nástroj pre históriu akcií "Vystrihnúť a vložiť" -Comment[sl]=Pripomoček z zgodovino za izreži in prilepi -Comment[sr]=Алатка за историјат исецања и налепљивања -Comment[sr@ijekavian]=Алатка за историјат исецања и налепљивања -Comment[sr@ijekavianlatin]=Alatka za istorijat isecanja i nalepljivanja -Comment[sr@latin]=Alatka za istorijat isecanja i nalepljivanja -Comment[sv]=Ett verktyg med historik för klipp ut och klistra in -Comment[ta]=A cut & paste history utility -Comment[te]=కత్తిరించు & అతికించు చరిత్ర సౌలభ్యం -Comment[tg]=История буфера обмена -Comment[th]=เครื่องมือดูประวัติการตัดและวาง -Comment[tr]=Bir kes & yapıştır geçmişi aracı -Comment[ug]=كەس ۋە چاپلا تارىخىنى باشقۇرۇش قورالى -Comment[uk]=Утиліта журналу буфера даних -Comment[vi]=Công cụ chứa lịch sử các cắt dán -Comment[wa]=Ene ahesse d' istwere di coper/aclacper -Comment[x-test]=xxA cut & paste history utilityxx -Comment[zh_CN]=管理剪切和粘贴历史的工具 -Comment[zh_TW]=剪貼紀錄公用程式 - diff --git a/klipper/klipper.h b/klipper/klipper.h deleted file mode 100644 index 9a9b67a2..00000000 --- a/klipper/klipper.h +++ /dev/null @@ -1,209 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) by Andrew Stanley-Jones - Copyright (C) 2004 Esben Mose Hansen - Copyright (C) 2008 by Dmitry Suzdalev - - 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. -*/ -#ifndef KLIPPER_H -#define KLIPPER_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "urlgrabber.h" - -static const QCryptographicHash::Algorithm KlipperHashAlgorithm = QCryptographicHash::KAT; - -class KAction; -class KToggleAction; -class KAboutData; -class KActionCollection; -class URLGrabber; -class History; -class HistoryItem; -class KlipperSessionManager; - -class Klipper : public QObject -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.klipper.klipper") - -public Q_SLOTS: - Q_SCRIPTABLE QString getClipboardContents(); - Q_SCRIPTABLE void setClipboardContents(QString s); - Q_SCRIPTABLE void clearClipboardContents(); - Q_SCRIPTABLE void clearClipboardHistory(); - Q_SCRIPTABLE void saveClipboardHistory(); - Q_SCRIPTABLE QStringList getClipboardHistoryMenu(); - Q_SCRIPTABLE QString getClipboardHistoryItem(int i); - Q_SCRIPTABLE void showKlipperPopupMenu(); - Q_SCRIPTABLE void showKlipperManuallyInvokeActionMenu(); - -public: - Klipper(QObject* parent, const KSharedConfigPtr& config); - ~Klipper(); - - /** - * Get clipboard history (the "document") - */ - History* history() { return m_history; } - - URLGrabber* urlGrabber() const { return m_myURLGrabber; } - - static void createAboutData(); - static void destroyAboutData(); - static KAboutData* aboutData(); - - void saveSettings() const; - -public Q_SLOTS: - void saveSession(); - void slotHistoryTopChanged(); - void slotConfigure(); - void slotEditData(); - void slotShowBarcode(); - void slotCycleNext(); - void slotCyclePrev(); - -protected: - /** - * The selection modes - * - * Don't use 1, as I use that as a guard against passing - * a boolean true as a mode. - */ - enum SelectionMode { Clipboard = 2, Selection = 4 }; - - /** - * Loads history from disk. - */ - bool loadHistory(); - - /** - * Save history to disk - * @empty save empty history instead of actual history - */ - void saveHistory(bool empty = false); - - /** - * Check data in clipboard, and if it passes these checks, - * store the data in the clipboard history. - */ - void checkClipData( bool selectionMode ); - - /** - * Enter clipboard data in the history. - */ - HistoryItem* applyClipChanges( const QMimeData* data ); - - void setClipboard( const HistoryItem& item, int mode ); - bool ignoreClipboardChanges() const; - - KSharedConfigPtr config() const { return m_config; } - bool isApplet() const { return m_config != KGlobal::config(); } - -Q_SIGNALS: - void passivePopup(const QString& caption, const QString& text); - -public Q_SLOTS: - void slotPopupMenu(); - void slotAskClearHistory(); -protected Q_SLOTS: - void showPopupMenu( QMenu * ); - void slotRepeatAction(); - void setURLGrabberEnabled( bool ); - void disableURLGrabber(); - -private Q_SLOTS: - void newClipData( QClipboard::Mode ); - void slotClearClipboard(); - - void slotQuit(); - void slotStartShowTimer(); - - void slotClearOverflow(); - void slotCheckPending(); - - void slotSaveBarcode(); - - void loadSettings(); - -private: - - static void updateTimestamp(); - - QClipboard* m_clip; - - QElapsedTimer m_showTimer; - - History* m_history; - int m_overflowCounter; - - KToggleAction* m_toggleURLGrabAction; - KAction* m_clearHistoryAction; - KAction* m_repeatAction; - KAction* m_editAction; - KAction* m_showBarcodeAction; - KAction* m_configureAction; - KAction* m_quitAction; - KAction* m_cycleNextAction; - KAction* m_cyclePrevAction; - KAction* m_showOnMousePos; - - bool m_bKeepContents :1; - bool m_bURLGrabber :1; - bool m_bReplayActionInHistory :1; - bool m_bNoNullClipboard :1; - bool m_bIgnoreSelection :1; - bool m_bSynchronize :1; - bool m_bSelectionTextOnly :1; - bool m_bIgnoreImages :1; - - /** - * Avoid reacting to our own changes, using this - * lock. - * Don't manupulate this object directly... use the Ignore struct - * instead - */ - int m_locklevel; - - URLGrabber* m_myURLGrabber; - QString m_lastURLGrabberTextSelection; - QString m_lastURLGrabberTextClipboard; - KSharedConfigPtr m_config; - QTimer m_overflowClearTimer; - QTimer m_pendingCheckTimer; - bool m_pendingContentsCheck; - QString m_qrencodeexe; - QPixmap m_qrpixmap; - static KAboutData* m_about_data; - - bool blockFetchingNewData(); - QString cycleText() const; - KlipperSessionManager* m_sessionManager; - KActionCollection* m_collection; -}; - -#endif diff --git a/klipper/klipper.kcfg b/klipper/klipper.kcfg deleted file mode 100644 index cf2572ff..00000000 --- a/klipper/klipper.kcfg +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - true - - - - true - Selecting this option has the effect, that the clipboard can never be emptied. E.g. when an application exits, the clipboard would usually be emptied. - - - - true - - - - false - When an area of the screen is selected with mouse or keyboard, this is called "the selection".<br/>If this option is set, the selection is not entered into the clipboard history, though it is still available for pasting using the middle mouse button. - - - - false - When an area of the screen is selected with mouse or keyboard, this is called "the selection".<br/>If this option is selected, the selection and the clipboard is kept the same, so that anything in the selection is immediately available for pasting elsewhere using any method, including the traditional middle mouse button. Otherwise, the selection is recorded in the clipboard history, but the selection can only be pasted using the middle mouse button. Also see the 'Ignore Selection' option. - - - - true - When an area of the screen is selected with mouse or keyboard, this is called "the selection".<br/>If this option is selected, only text selections are stored in the history, while images and other selections are not. - - - - false - - - Navigator,navigator:browser,konqueror,keditbookmarks,mozilla-bin,Mozilla,Opera main window,opera,gnumeric,Gnumeric,Galeon,kcontrol,ksirc,MozillaFirebird-bin,firefox-bin,Firefox-bin,klipper,Gecko,gecko - - - - - 8 - 0 - 200 - A value of 0 disables the timeout - - - - 7 - 1 - 2048 - - - - - - true - Sometimes, the selected text has some whitespace at the end, which, if loaded as URL in a browser would cause an error. Enabling this option removes any whitespace at the beginning or end of the selected string (the original clipboard contents will not be modified). - - - - false - - - - true - - - diff --git a/klipper/klipperpopup.cpp b/klipper/klipperpopup.cpp deleted file mode 100644 index 59e41104..00000000 --- a/klipper/klipperpopup.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - Copyright (C) by Andrew Stanley-Jones - Copyright (C) 2000 by Carsten Pfeiffer - - 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 "klipperpopup.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "history.h" -#include "klipper.h" -#include "popupproxy.h" - -namespace { - static const int TOP_HISTORY_ITEM_INDEX = 2; -} - -// #define DEBUG_EVENTS__ - -#ifdef DEBUG_EVENTS__ -QDebug& operator<<( QDebug& stream, const QKeyEvent& e ) { - stream << "(QKeyEvent(text=" << e.text() << ",key=" << e.key() << ( e.isAccepted()?",accepted":",ignored)" ) << ",count=" << e.count(); - if ( e.modifiers() & Qt::AltModifier ) { - stream << ",ALT"; - } - if ( e.modifiers() & Qt::ControlModifier ) { - stream << ",CTRL"; - } - if ( e.modifiers() & Qt::MetaModifier ) { - stream << ",META"; - } - if ( e.modifiers() & Qt::ShiftModifier ) { - stream << ",SHIFT"; - } - if ( e.isAutoRepeat() ) { - stream << ",AUTOREPEAT"; - } - stream << ")"; - - return stream; -} -#endif - -/** - * Exactly the same as KLineEdit, except that ALL key events are swallowed. - * - * We need this to avoid infinite loop when sending events to the search widget - */ -class KLineEditBlackKey : public KLineEdit { -public: - KLineEditBlackKey( QWidget* parent ) - : KLineEdit( parent ) - {} - - ~KLineEditBlackKey() { - } -protected: - virtual void keyPressEvent( QKeyEvent* e ) { - KLineEdit::keyPressEvent( e ); - e->accept(); - - } - -}; - -KlipperPopup::KlipperPopup( History* history ) - : m_dirty( true ), - m_textForEmptyHistory( i18n( "" ) ), - m_textForNoMatch( i18n( "" ) ), - m_history( history ), - m_helpMenu( new KHelpMenu( this, Klipper::aboutData(), false ) ), - m_popupProxy( 0 ), - m_filterWidget( 0 ), - m_filterWidgetAction( 0 ), - m_nHistoryItems( 0 ) -{ - KWindowInfo windowInfo = KWindowSystem::windowInfo( winId(), NET::WMGeometry ); - QRect geometry = windowInfo.geometry(); - QRect screen = QApplication::desktop()->screenGeometry(geometry.center()); - int menuHeight = ( screen.height() ) * 3/4; - int menuWidth = ( screen.width() ) * 1/3; - - m_popupProxy = new PopupProxy( this, menuHeight, menuWidth ); - - connect( this, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()) ); -} - -KlipperPopup::~KlipperPopup() { - -} - -void KlipperPopup::slotAboutToShow() { - if ( m_filterWidget ) { - if ( !m_filterWidget->text().isEmpty() ) { - m_dirty = true; - m_filterWidget->clear(); - m_filterWidget->setVisible(false); - m_filterWidgetAction->setVisible(false); - } - } - ensureClean(); - -} - -void KlipperPopup::ensureClean() { - // If the history is unchanged since last menu build, the is no reason - // to rebuild it, - if ( m_dirty ) { - rebuild(); - } - -} - -void KlipperPopup::buildFromScratch() { - addTitle(KIcon("klipper"), i18n("Klipper - Clipboard Tool")); - - m_filterWidget = new KLineEditBlackKey(this); - m_filterWidget->setFocusPolicy( Qt::NoFocus ); - m_filterWidgetAction = new QWidgetAction(this); - m_filterWidgetAction->setDefaultWidget(m_filterWidget); - m_filterWidgetAction->setVisible(false); - addAction(m_filterWidgetAction); - - addSeparator(); - for (int i = 0; i < m_actions.count(); i++) { - - if (i + 1 == m_actions.count()) { - addMenu(m_helpMenu->menu())->setIcon(KIcon("help-contents")); - addSeparator(); - } - - addAction(m_actions.at(i)); - } - - if ( KGlobalSettings::insertTearOffHandle() ) { - setTearOffEnabled(true); - } - -} - -void KlipperPopup::rebuild( const QString& filter ) { - if (actions().isEmpty()) { - buildFromScratch(); - } else { - for ( int i=0; ipalette(); - if ( filterexp.isValid() ) { - palette.setColor( m_filterWidget->foregroundRole(), palette.color(foregroundRole()) ); - } else { - palette.setColor( m_filterWidget->foregroundRole(), Qt::red ); - } - m_nHistoryItems = m_popupProxy->buildParent( TOP_HISTORY_ITEM_INDEX, filterexp ); - if ( m_nHistoryItems == 0 ) { - if ( m_history->empty() ) { - insertAction(actions().at(TOP_HISTORY_ITEM_INDEX), new QAction(m_textForEmptyHistory, this)); - } else { - palette.setColor( m_filterWidget->foregroundRole(), Qt::red ); - insertAction(actions().at(TOP_HISTORY_ITEM_INDEX), new QAction(m_textForNoMatch, this)); - } - m_nHistoryItems++; - } else { - if ( history()->topIsUserSelected() ) { - actions().at(TOP_HISTORY_ITEM_INDEX)->setCheckable(true); - actions().at(TOP_HISTORY_ITEM_INDEX)->setChecked(true); - } - } - m_filterWidget->setPalette( palette ); - m_dirty = false; -} - -void KlipperPopup::plugAction( QAction* action ) { - m_actions.append(action); -} - - -/* virtual */ -void KlipperPopup::keyPressEvent( QKeyEvent* e ) { - // If alt-something is pressed, select a shortcut - // from the menu. Do this by sending a keyPress - // without the alt-modifier to the superobject. - if ( e->modifiers() & Qt::AltModifier ) { - QKeyEvent ke( QEvent::KeyPress, - e->key(), - e->modifiers() ^ Qt::AltModifier, - e->text(), - e->isAutoRepeat(), - e->count() ); - KMenu::keyPressEvent( &ke ); -#ifdef DEBUG_EVENTS__ - kDebug() << "Passing this event to ancestor (KMenu): " << e << "->" << ke; -#endif - if (ke.isAccepted()) { - e->accept(); - return; - } else { - e->ignore(); - } - } - - // Otherwise, send most events to the search - // widget, except a few used for navigation: - // These go to the superobject. - switch( e->key() ) { - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Right: - case Qt::Key_Left: - case Qt::Key_Tab: - case Qt::Key_Backtab: - case Qt::Key_Escape: - { -#ifdef DEBUG_EVENTS__ - kDebug() << "Passing this event to ancestor (KMenu): " << e; -#endif - KMenu::keyPressEvent(e); - - break; - } - case Qt::Key_Return: - case Qt::Key_Enter: - { - KMenu::keyPressEvent(e); - this->hide(); - - if (activeAction() == m_filterWidgetAction) - setActiveAction(actions().at(TOP_HISTORY_ITEM_INDEX)); - - break; - } - default: - { -#ifdef DEBUG_EVENTS__ - kDebug() << "Passing this event down to child (KLineEdit): " << e; -#endif - setActiveAction(actions().at(actions().indexOf(m_filterWidgetAction))); - QString lastString = m_filterWidget->text(); - QApplication::sendEvent(m_filterWidget, e); - - if (m_filterWidget->text().isEmpty()) { - if (m_filterWidgetAction->isVisible()) { - m_filterWidget->setVisible(false); - m_filterWidgetAction->setVisible(false); - } - } - else if (!m_filterWidgetAction->isVisible() ) - m_filterWidgetAction->setVisible(true); - - if (m_filterWidget->text() != lastString) { - m_dirty = true; - rebuild(m_filterWidget->text()); - } - - break; - } //default: - } //case -} - - -void KlipperPopup::slotSetTopActive() -{ - if (actions().size() > TOP_HISTORY_ITEM_INDEX) { - setActiveAction(actions().at(TOP_HISTORY_ITEM_INDEX)); - } -} - -#include "moc_klipperpopup.cpp" diff --git a/klipper/klipperpopup.h b/klipper/klipperpopup.h deleted file mode 100644 index cf44585a..00000000 --- a/klipper/klipperpopup.h +++ /dev/null @@ -1,124 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - Copytight (C) by Andrew Stanley-Jones - 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. -*/ -#ifndef KLIPPERPOPUP_H -#define KLIPPERPOPUP_H - -#include - -#include - -#include -#include -#include - -class KHelpMenu; -class KLineEdit; - -class PopupProxy; -class History; - -/** - * Default view of clipboard history. - * - */ -class KlipperPopup : public KMenu -{ - Q_OBJECT - -public: - explicit KlipperPopup( History* history ); - ~KlipperPopup(); - void plugAction( QAction* action ); - - /** - * Normally, the popupmenu is only rebuilt just before showing. - * If you need the pixel-size or similar of the this menu, call - * this beforehand. - */ - void ensureClean(); - - History* history() { return m_history; } - const History* history() const { return m_history; } -public Q_SLOTS: - void slotHistoryChanged() { m_dirty = true; } - void slotAboutToShow(); - /** - * set the top history item active, to easy kb navigation - */ - void slotSetTopActive(); - -private: - void rebuild( const QString& filter = QString() ); - void buildFromScratch(); - -protected: - virtual void keyPressEvent( QKeyEvent* e ); - -private: - bool m_dirty : 1; // true if menu contents needs to be rebuild. - - /** - * Contains the string shown if the menu is empty. - */ - QString m_textForEmptyHistory; - - /** - * Contains the string shown if the search string has no - * matches and the menu is not empty. - */ - QString m_textForNoMatch; - - /** - * The "document" (clipboard history) - */ - History* m_history; - - /** - * The help menu - */ - KHelpMenu* m_helpMenu; - - /** - * (unowned) actions to plug into the primary popup menu - */ - QList m_actions; - - /** - * Proxy helper object used to track history items - */ - PopupProxy* m_popupProxy; - - /** - * search filter widget - */ - KLineEdit* m_filterWidget; - - /** - * Action of search widget - */ - QWidgetAction* m_filterWidgetAction; - - /** - * The current number of history items in the clipboard - */ - int m_nHistoryItems; - -}; - -#endif diff --git a/klipper/klipperrc.desktop b/klipper/klipperrc.desktop deleted file mode 100644 index d528258a..00000000 --- a/klipper/klipperrc.desktop +++ /dev/null @@ -1,2431 +0,0 @@ -# This file is no longer installed by default, -# but left here for historical reasons :) -# (it used to be renamed to klipperrc and put in $INSTALL_DIR/share/config) -# Just in case anyone will want to take a look. -# At the moment klipper automatically determines actions depending on mimetype, -# so there's actually no need to supply some defaults. - -# Maybe this file should be removed later -# - dimsuz 31.03.2009 -[General] -Number of Actions=7 - -[Action_0] -Description=Jpeg-Image -Description[af]=Jpeg Beeld -Description[ar]=Jpeg صورة -Description[ast]=Imaxe Jpeg -Description[be]=Відарыс JPEG -Description[be@latin]=Vyjava „JPEG” -Description[bg]=Изображение JPEG -Description[bn]=জেপেগ চিত্র -Description[bn_IN]=Jpeg-ছবি -Description[br]=Skeudenn Jpeg -Description[bs]=JPEG slika -Description[ca]=Imatge JPEG -Description[ca@valencia]=Imatge JPEG -Description[cs]=Obrázek JPEG -Description[csb]=Òbrôz Jpeg -Description[cy]=Delwedd Jpeg -Description[da]=JPEG-billede -Description[de]=JPEG-Image -Description[el]=Εικόνα-Jpeg -Description[en_GB]=Jpeg-Image -Description[eo]=JPEG-grafiko -Description[es]=Imagen Jpeg -Description[et]=Jpeg pildifail -Description[eu]=JPEG irudia -Description[fa]=تصویر Jpeg -Description[fi]=Jpeg-kuva -Description[fr]=Image JPEG -Description[fy]=Jpeg-ôfbylding -Description[ga]=Íomhá JPEG -Description[gl]=Imaxe jpeg -Description[gu]=Jpeg-ચિત્ર -Description[he]=תמונת JPEG -Description[hi]=जेपीईजी-छवि -Description[hne]=जेपीईजी-फोटू -Description[hr]=Jpeg slika -Description[hsb]=jpeg-wobraz -Description[hu]=JPEG kép -Description[ia]=Jpeg-Image -Description[id]=Gambar-Jpeg -Description[is]=Jpeg mynd -Description[it]=Immagine JPEG -Description[ja]=JPEG 画像 -Description[ka]=jpeg გამოსახულება -Description[kk]=Jpeg-кескіні -Description[km]=រូបភាព Jpeg -Description[kn]=ಜೆಪೆಗ್-ಚಿತ್ರ -Description[ko]=Jpeg-그림 -Description[ku]=Wêneyê Jpeg -Description[lt]=Jpeg paveikslėlis -Description[lv]=Jpeg attēls -Description[mai]=जेपीईजी-छवि -Description[mk]=Jpeg-слика -Description[ml]=ജെപെഗ്-ഇമേജ് -Description[mr]=जेपीईजी-प्रतिमा -Description[ms]=Imej Jpeg -Description[nb]=Jpeg-bilde -Description[nds]=JPEG-Bild -Description[ne]=Jpeg-छवि -Description[nl]=Jpeg-afbeelding -Description[nn]=Jpeg-bilete -Description[oc]=Imatge Jpeg -Description[pa]=Jpeg-ਚਿੱਤਰ -Description[pl]=Obraz Jpeg -Description[pt]=Imagem-JPEG -Description[pt_BR]=Imagem JPEG -Description[ro]=Imagine JPEG -Description[ru]=Рисунок JPEG -Description[se]=Jpeg-govva -Description[si]=Jpeg-පින්තූරය -Description[sk]=Obrázok Jpeg -Description[sl]=Slika JPEG -Description[sr]=ЈПЕГ слика -Description[sr@ijekavian]=ЈПЕГ слика -Description[sr@ijekavianlatin]=JPEG slika -Description[sr@latin]=JPEG slika -Description[sv]=Jpeg-bild -Description[ta]=Jpeg-பிம்பம் -Description[te]=జెపిఈజి చిత్రం -Description[tg]=Тасвири Jpeg -Description[th]=แฟ้มภาพ Jpeg -Description[tr]=Jpeg Resmi -Description[ug]=Jpeg سۈرەت -Description[uk]=Зображення Jpeg -Description[uz]=Jpeg-rasm -Description[uz@cyrillic]=Jpeg-расм -Description[vi]=Ảnh JPEG -Description[wa]=Imådje JPEG -Description[xh]=Jpeg-Umfanekiso -Description[x-test]=xxJpeg-Imagexx -Description[zh_CN]=JPEG 图像 -Description[zh_TW]=JPEG 影像 -Number of commands=1 -Regexp=^\\/.+\\.jpg$ - -[Action_0/Command_0] -Commandline=gwenview %s -Description=Launch &Gwenview -Description[af]=Lanseer &Gwenview -Description[ar]=شغل &Gwenview -Description[ast]=Entamar &Gwenview -Description[be@latin]=Uklučy prahramu „&Gwenview” -Description[bg]=Зареждане на &Gwenview -Description[bn]=গোয়েনভি&উ চালাও -Description[bn_IN]=Gwenview আরম্ভ করুন (&G) -Description[bs]=Pokreni &Gvenvju -Description[ca]=Engega el &Gwenview -Description[ca@valencia]=Engega el &Gwenview -Description[cs]=Spustit &Gwenview -Description[csb]=Zrëszë &Przezérnik òbrôzów -Description[da]=Start &Gwenview -Description[de]=&Gwenview starten -Description[el]=Εκτέλεση &Gwenview -Description[en_GB]=Launch &Gwenview -Description[eo]=Lanĉi &Gwenview-rigardilon -Description[es]=Iniciar &Gwenview -Description[et]=&Gwenview käivitamine -Description[eu]=Abiarazi &Gwenview -Description[fi]=Käynnistä &Gwenview -Description[fr]=Démarrer &Gwenview -Description[fy]=&Gwenview útfiere -Description[ga]=Tosaigh &Gwenview -Description[gl]=Iniciar &Gwenview -Description[gu]=Gwenview ચલાવો (&G) -Description[he]=הפעל&ת Gwenview -Description[hi]=ग्वेनव्यू चालू करें (&G) -Description[hne]=ग्वेन-व्यू चलाव (&G) -Description[hr]=Pokreni &Gwenview -Description[hsb]=&Gwenview startować -Description[hu]=A &Gwenview indítása -Description[ia]=Il lancea &Gwenview -Description[id]=Jalankan &Gwenview -Description[is]=Ræsa &Gwenview -Description[it]=Avvia &Gwenview -Description[ja]=Gwenview を起動(&G) -Description[kk]=&Gwenview-ді жегу -Description[km]=បើក​ដំណើរការ Gwenview -Description[kn]=ಗ್ವೆನ್ ವ್ಯೂ &ವನ್ನು ಪ್ರಕ್ಷೇಪಿಸು -Description[ko]=Gwenview 실행(&V) -Description[ku]=Dest bi &Gwenview bike -Description[lt]=Paleisti &Gwenview -Description[lv]=Palaist &Gwenview -Description[mk]=Стартувај &Gwenview -Description[ml]=&ഗ്വെന്‍വ്യൂ ലഭ്യമാക്കുക -Description[mr]=ग्वेनव्यु चालू करा (&G) -Description[nb]=Start &Gwenview -Description[nds]=&Gwenview opropen -Description[nl]=&Gwenview opstarten -Description[nn]=Start &Gwenview -Description[pa]=ਜੀਵਿਨਵਿਊ ਚਲਾਓ(&G) -Description[pl]=Uruchom &Gwenview -Description[pt]=Lançar o &Gwenview -Description[pt_BR]=Abrir o &Gwenview -Description[ro]=Lansează &Gwenview -Description[ru]=Открыть в &Gwenview -Description[si]=&Gwenview අරඹන්න -Description[sk]=Spustiť &Gwenview -Description[sl]=Zaženi &Gwenview -Description[sr]=Покрени &Гвенвју -Description[sr@ijekavian]=Покрени &Гвенвју -Description[sr@ijekavianlatin]=Pokreni &GwenView -Description[sr@latin]=Pokreni &GwenView -Description[sv]=Starta &Gwenview -Description[ta]=&ஜிவென்யூ ஏவுக -Description[te]=&Gwenview ను దించుము -Description[tg]=Кушодани &Gwenview -Description[th]=เรียกใช้งาน '&Gwenview' -Description[tr]=&Gwenview Uygulamasını Çalıştır -Description[ug]=&Gwenview نى قوزغات -Description[uk]=Запустити &Gwenview -Description[uz]=Gwenview'ni ishga &tushirish -Description[uz@cyrillic]=Gwenview'ни ишга &тушириш -Description[vi]=Khởi chạy K&View -Description[wa]=Enonder &Gwenview -Description[x-test]=xxLaunch &Gwenviewxx -Description[zh_CN]=启动 &Gwenview -Description[zh_TW]=啟動 Gwenview (&G) -Enabled=true - -[Action_1] -Description=Web-URL -Description[af]=Web-URL -Description[ar]=رابط وِب -Description[ast]=URL Web -Description[be]=Web-URL -Description[be@latin]=Adras u siecivie -Description[bg]=Уеб адрес -Description[bn]=ওয়েব ইউ-আর-এল -Description[bn_IN]=ওয়েব-URL -Description[br]=URL-gwiad -Description[bs]=Veb‑URL -Description[ca]=URL de web -Description[ca@valencia]=URL de web -Description[cs]=Webové URL -Description[csb]=Sécowé URL -Description[cy]=URL Gw? -Description[da]=Net-URL -Description[de]=Web-URL -Description[el]=URL-Ιστού -Description[en_GB]=Web-URL -Description[eo]=TTT-URL -Description[es]=URL Web -Description[et]=Veebi-URL -Description[eu]=Webgunearen URLa -Description[fa]=نشانی وب وب -Description[fi]=Verkko-osoite -Description[fr]=URL Web -Description[fy]=Web-URL-adres -Description[ga]=URL Gréasáin -Description[gl]=URL de web -Description[gu]=વેબ-URL -Description[he]=כתובת אינטרנט -Description[hi]=वेब-यूआरएल -Description[hne]=वेब-यूआरएल -Description[hr]=Web-URL -Description[hsb]=Web-URL -Description[hu]=Webes URL -Description[ia]=Web-URL -Description[id]=URL-Web -Description[is]=Vefslóð -Description[it]=URL Web -Description[ja]=ウェブ URL -Description[ka]=ვებ ბმული -Description[kk]=URL сілтемесі -Description[km]=បណ្តាញ URL -Description[kn]=ಜಾಲ-URL -Description[ko]=웹-URL -Description[ku]=URL ya torê -Description[lt]=Žiniatinklio-URL -Description[lv]=Tīmekļa-URL -Description[mai]=वेब-यूआरएल -Description[mk]=Веб-URL -Description[ml]=വെബ്-യുആര്‍എല്‍ -Description[mr]=वेब-URL -Description[ms]=URL Laman -Description[nb]=Internettadresse -Description[nds]=Internetadress -Description[ne]=वेब-यूआरएल -Description[nl]=Web-URL-adres -Description[nn]=Internettadresse -Description[pa]=ਵੈੱਬ-URL -Description[pl]=Sieciowy adres URL -Description[pt]=URL da Web -Description[pt_BR]=URL da Internet -Description[ro]=URL web -Description[ru]=Ссылка на веб-страницу -Description[se]=Fierpmádatčujuhus -Description[si]=Web-URL -Description[sk]=Web-URL -Description[sl]=Spletni URL -Description[sr]=Веб‑УРЛ -Description[sr@ijekavian]=Веб‑УРЛ -Description[sr@ijekavianlatin]=Veb-URL -Description[sr@latin]=Veb-URL -Description[sv]=Webbadress -Description[ta]=வலை-வலைப்பின்னல் -Description[te]=వెబ్ యూ ఆర్ ఎల్ -Description[tg]=Суроғаи Интернет -Description[th]=ที่อยู่ URL ของเว็บ -Description[tr]=Web-URL -Description[ug]=Web-URL -Description[uk]=Інтернет-адреса -Description[uz]=Veb-URL -Description[uz@cyrillic]=Веб-URL -Description[vi]=URL Mạng -Description[wa]=Hårdêye waibe -Description[xh]=Web-URL -Description[x-test]=xxWeb-URLxx -Description[zh_CN]=Web URL -Description[zh_TW]=網頁 URL -Number of commands=6 -Regexp=^https?://. - -[Action_1/Command_0] -Commandline=kioclient exec %s -Description=Open with &default Browser -Description[af]=Open met verstekblaaier -Description[ar]=افتح بواسطة &المتصفح المبدئي -Description[ast]=Abrir col restola&dor predetermináu -Description[be@latin]=Adčyni ŭ &zmoŭčanym hartačy -Description[bg]=&Отваряне с подразбиращия се браузър -Description[bn]=ডি&ফল্ট ব্রাউজার দিয়ে খোলো -Description[bn_IN]=ডিফল্ট ব্রাউজার সহযোগে প্রদর্শিত হবে (&d) -Description[bs]=Otvori &podrazumijevanim pregledačem -Description[ca]=Obre amb el navega&dor per omissió -Description[ca@valencia]=Obri amb el navega&dor per omissió -Description[cs]=Otevřít pomocí vý&chozího prohlížeče -Description[csb]=Òtemkni w &domëslnym przezérnikù -Description[da]=Åbn med stan&dard browser -Description[de]=Mit &Standardbrowser öffnen -Description[el]=Άνοιγμα με τον &προκαθορισμένο περιηγητή -Description[en_GB]=Open with &default Browser -Description[eo]=Malfermi per &defaŭlta retumilo -Description[es]=Abrir con el navega&dor predeterminado -Description[et]=Avamine vaikimisi &brauseriga -Description[eu]=Ireki arakatzaile &lehenetsiarekin -Description[fi]=Avaa &oletusselaimella -Description[fr]=Ouvrir dans le navigateur par &défaut -Description[fy]=Iepenje mei &standert blêder -Description[ga]=Oscail leis an mBrabhsálaí &réamhshocraithe -Description[gl]=Abrir co &navegador predeterminado -Description[gu]=મૂળભૂત બ્રાઉઝર સાથે ખોલો (&d) -Description[he]=פתיחה באמצעות דפדפן &ברירת המחדל -Description[hi]=डिफ़ॉल्ट ब्राउज़र खोलें (&d) -Description[hne]=डिफाल्ट ब्राउजर एखर साथ खोलव (&d) -Description[hr]=Otvori pomoću &zadanog preglednika -Description[hsb]=Ze &standardnym browserom wočinić -Description[hu]=Megnyitás az &alapértelmezett böngészővel -Description[ia]=Aperi con navigator pre&definite -Description[id]=Buka &dengan Peramban standar -Description[is]=Opna með sjálf&gefnum vefskoðara -Description[it]=Apri con browser pre&definito -Description[ja]=デフォルトのブラウザで開く(&D) -Description[kk]=Ә&детті шолғышында ашу -Description[km]=បើក​ជាមួយ​កម្មវិធី​រុករក​លំនាំដើម -Description[kn]=ಪೂರ್ವನಿಯೋಜಿ&ತ ವೀಕ್ಷಕದೊಂದಿಗೆ ತೆರೆ -Description[ko]=기본 브라우저로 열기(&D) -Description[ku]=Bi geroka &standard veke -Description[lt]=Atverti su &numatyta naršykle -Description[lv]=Atvērt ar &noklusēto pārlūku -Description[mk]=Отвори со стан&дарден прелистувач -Description[ml]=&സഹജമായ ബ്രൌസറില്‍ തുറക്കുക -Description[mr]=मूलभूत ब्राऊजरमध्ये उघडा (&D) -Description[nb]=Åpne med &standardnettleser -Description[nds]=Mit Stan&dard-Nettkieker opmaken -Description[nl]=Openen met stan&daardbrowser -Description[nn]=Opna med &standard nettlesar -Description[pa]=ਡਿਫਾਲਟ ਬਰਾਊਜ਼ਰ ਨਾਲ ਖੋਲ੍ਹੋ(&d) -Description[pl]=Otwórz w &domyślnej przeglądarce -Description[pt]=Abrir com o Navegador Pre&definido -Description[pt_BR]=Abrir com o navegador pa&drão -Description[ro]=&Deschide cu navigatorul implicit -Description[ru]=Открыть в &браузере по умолчанию -Description[si]=පෙරනිමි ගවේශකය සමඟ විවෘත කරන්න (&d) -Description[sk]=Otvoriť štan&dardným prehliadačom -Description[sl]=Odpri v privzetem &brskalniku -Description[sr]=Отвори &подразумеваним прегледачем -Description[sr@ijekavian]=Отвори &подразумијеваним прегледачем -Description[sr@ijekavianlatin]=Otvori &podrazumijevanim pregledačem -Description[sr@latin]=Otvori &podrazumevanim pregledačem -Description[sv]=Öppna med &förvald webbläsare -Description[ta]=&இயல்பிருப்பு உலாவியுடன் திறக்க -Description[te]=అప్రమేయ అన్వేషణితో తెరువుము (&d) -Description[tg]=Кушодан бо намоишгари Интернети &стандартӣ -Description[th]=เปิดด้วยเบราเซอร์&ปริยาย -Description[tr]=&Öntanımlı tarayıcı ile aç -Description[ug]=كۆڭۈلدىكى تور كۆرگۈدە ئاچ(&D) -Description[uk]=Відкрити в &типовому навігаторі -Description[uz]=Andoza &brauzer bilan ochish -Description[uz@cyrillic]=Андоза &браузер билан очиш -Description[wa]=Drovi avou l' &prémetou betchteu -Description[x-test]=xxOpen with &default Browserxx -Description[zh_CN]=用默认浏览器打开(&D) -Description[zh_TW]=使用預設瀏覽器開啟(&D) -Enabled=true - -[Action_1/Command_1] -Commandline=konqueror %s -Description=Open with &Konqueror -Description[af]=Maak oop met Konqueror -Description[ar]=افتح بواسطة &كونكيورر -Description[ast]=Abrir con &Konqueror -Description[be]=Адкрыць у &Konqueror -Description[be@latin]=Adčyni ŭ hartačy „&Konqueror” -Description[bg]=&Отваряне с Konqueror -Description[bn]=কনকরার দিয়ে খোলো (&ক) -Description[bn_IN]=Konqueror সহযোগে প্রদর্শিত হবে (&K) -Description[br]=Digeriñ gant &Konqueror -Description[bs]=Otvori &Konquerorem -Description[ca]=Obre amb el &Konqueror -Description[ca@valencia]=Obri amb el &Konqueror -Description[cs]=Otevřít pomocí &Konqueroru -Description[csb]=Òtemkni w &Konquerorze -Description[cy]=Agor gyda &Konqueror -Description[da]=Åbn med &Konqueror -Description[de]=Mit &Konqueror öffnen -Description[el]=Άνοιγμα με τον &Konqueror -Description[en_GB]=Open with &Konqueror -Description[eo]=Malfermi per &Konkeranto -Description[es]=Abrir con &Konqueror -Description[et]=&Konqueroris avamine -Description[eu]=Ireki &Konqueror-ekin -Description[fa]=باز کردن با&Konqueror‌ -Description[fi]=Avaa &Konquerorissa -Description[fr]=Ouvrir dans &Konqueror -Description[fy]=Iepenje mei &Konqueror -Description[ga]=Oscail le &Konqueror -Description[gl]=Abrir con &Konqueror -Description[gu]=કોન્કરરની સાથે ખોલો (&K) -Description[he]=&פתיחה באמצעות Konqueror -Description[hi]=कॉन्करर के साथ खोलें (&K) -Description[hne]=कान्करर एखर साथ खोलव (&K) -Description[hr]=Otvori pomoću &Konquerora -Description[hsb]=Z &konquerororm wočinić -Description[hu]=Megnyitás a &Konquerorral -Description[ia]=Aperi con &Konqueror -Description[id]=Buka dengan &Konqueror -Description[is]=Opna með &Konqueror -Description[it]=Apri con &Konqueror -Description[ja]=Konqueror で開く(&K) -Description[ka]=&Konqueror-ში გახსნა -Description[kk]=&Konqueror-де ашу -Description[km]=បើក​ជាមួយ Konqueror -Description[kn]=ಕಾಂ&ಕರರ್ ನೊಂದಿಗೆ ತೆರೆ -Description[ko]=Konqueror로 열기(&K) -Description[ku]=Bi &Konqueror veke -Description[lt]=Atverti su &Konqueror -Description[lv]=Atvērt ar &Konqueror -Description[mai]=कान्करर केर सँग खोलू (&K) -Description[mk]=Отвори со &Konqueror -Description[ml]=&കോണ്‍ക്വററില്‍ തുറക്കുക -Description[mr]=कॉन्करर मध्ये उघडा (&K) -Description[ms]=Buka dengan &Konqueror -Description[nb]=Åpne med &Konqueror -Description[nds]=Mit &Konqueror opmaken -Description[ne]=कन्क्वेररसँग खोल्नुहोस् -Description[nl]=Openen met &Konqueror -Description[nn]=Opna med &Konqueror -Description[pa]=ਕੋਨਕਿਉਰੋਰ ਨਾਲ ਖੋਲ੍ਹੋ(&K) -Description[pl]=Otwórz w &Konquerorze -Description[pt]=Abrir com o &Konqueror -Description[pt_BR]=Abrir com o &Konqueror -Description[ro]=Deschide cu &Konqueror -Description[ru]=Открыть в &Konqueror -Description[se]=Raba &Konquerorain -Description[si]=&Konqueror සමඟ විවෘත කරන්න -Description[sk]=Otvoriť pomocou &Konquerora -Description[sl]=Odpri s &Konquerorjem -Description[sr]=Отвори &К‑освајачем -Description[sr@ijekavian]=Отвори &К‑освајачем -Description[sr@ijekavianlatin]=Otvori &K‑osvajačem -Description[sr@latin]=Otvori &K‑osvajačem -Description[sv]=Öppna med &Konqueror -Description[ta]=கான்கொரர் உடன் திற -Description[te]=(&K) కాంకెరర్ తొ తెరువు -Description[tg]=Кушодан бо &Konqueror -Description[th]=เปิดด้วย '&คอนเควอร์เรอร์' -Description[tr]=&Konqueror ile Aç -Description[ug]=&Konqueror دا ئاچ -Description[uk]=Відкрити у &Konqueror -Description[uz]=Konqueror &bilan ochish -Description[uz@cyrillic]=Konqueror &билан очиш -Description[vi]=Mở bằng &Konqueror -Description[wa]=Drovi avou &Konqueror -Description[xh]=Vula nge &Konqueror -Description[x-test]=xxOpen with &Konquerorxx -Description[zh_CN]=用 &Konqueror 打开 -Description[zh_TW]=使用 &Konqueror 開啟 -Enabled=true - -[Action_1/Command_2] -Commandline=ps x |grep -q '[m]ozilla' && "mozilla -remote openURL(%s, new-window)" || mozilla %s -Icon=mozilla -Description=Open with &Mozilla -Description[af]=Maak oop met Mozilla -Description[ar]=افتح بواسطة &موزيلا -Description[ast]=Abrir con &Mozilla -Description[be]=Адкрыць у &Mozilla -Description[be@latin]=Adčyni ŭ hartačy „&Mozilla” -Description[bg]=От&варяне с Mozilla -Description[bn]=মোজিলা দিয়ে খোলো (&ম) -Description[bn_IN]=Mozilla সহযোগে প্রদর্শিত হবে (&M) -Description[br]=Digeriñ gant &Mozilla -Description[bs]=Otvori &Mozilom -Description[ca]=Obre amb el &Mozilla -Description[ca@valencia]=Obri amb el &Mozilla -Description[cs]=Otevřít pomocí &Mozilla -Description[csb]=Òtemkni w &Mozillë -Description[cy]=Agor gyda &Mozilla -Description[da]=Åbn med &Mozilla -Description[de]=Mit &Mozilla öffnen -Description[el]=Άνοιγμα με το &Mozilla -Description[en_GB]=Open with &Mozilla -Description[eo]=Malfermi per &Mozilo -Description[es]=Abrir con &Mozilla -Description[et]=&Mozillas avamine -Description[eu]=Ireki &Mozillarekin -Description[fa]=باز کردن با &موزیلا‌ -Description[fi]=Avaa &Mozillalla -Description[fr]=Ouvrir dans &Mozilla -Description[fy]=Iepenje mei &Mozilla -Description[ga]=Oscail le &Mozilla -Description[gl]=Abrir con &Mozilla -Description[gu]=મોઝિલાની સાથે ખોલો (&M) -Description[he]=פ&תיחה באמצעות Mozilla -Description[hi]=मोज़िला के साथ खोलें (&M) -Description[hne]=मोजिला एखर साथ खोलव (&M) -Description[hr]=Otvori pomoću &Mozille -Description[hsb]=Z &Mozilla wočinić -Description[hu]=Megnyitás a &Mozillával -Description[ia]=Aperi con &Mozilla -Description[id]=Buka dengan &Mozilla -Description[is]=Opna með &Mozilla -Description[it]=Apri con &Mozilla -Description[ja]=Mozilla で開く(&M) -Description[ka]=&Mozilla-ში გასნა -Description[kk]=&Mozilla-да ашу -Description[km]=បើក​ជាមួយ Mozilla -Description[kn]=(&M)ಮೋಜಿಲ್ಲಾದೊಡನೆ ತೆರೆ -Description[ko]=Mozilla로 열기(&M) -Description[ku]=Bi &Mozilla veke -Description[lt]=Atverti su &Mozilla -Description[lv]=Atvērt ar &Mozilla -Description[mai]=मोजिला केर सँग खोलू (&M) -Description[mk]=Отвори со &Mozilla -Description[ml]=&മോസില്ലാ ഉപയോഗിച്ചു് തുറക്കുക -Description[mr]=मोजिला मध्ये उघडा (&M) -Description[ms]=Buka dengan &Mozilla -Description[nb]=Åpne med &Mozilla -Description[nds]=Mit &Mozilla opmaken -Description[ne]=मोजिलासँग खोल्नुहोस् -Description[nl]=Openen met &Mozilla -Description[nn]=Opna med &Mozilla -Description[pa]=ਮੋਜ਼ੀਲਾ ਨਾਲ ਖੋਲ੍ਹੋ(&M) -Description[pl]=Otwórz w &Mozilli -Description[pt]=Abrir com o &Mozilla -Description[pt_BR]=Abrir com o &Mozilla -Description[ro]=Deschide cu &Mozilla -Description[ru]=Открыть в &Mozilla -Description[se]=Raba &Mozillain -Description[si]=&Mozilla සමඟ විවෘත කරන්න -Description[sk]=Otvoriť pomocou &Mozilly -Description[sl]=Odpri z &Mozillo -Description[sr]=Отвори &Мозилом -Description[sr@ijekavian]=Отвори &Мозилом -Description[sr@ijekavianlatin]=Otvori &Mozillom -Description[sr@latin]=Otvori &Mozillom -Description[sv]=Öppna med &Mozilla -Description[ta]=மொசில்லாவுடன் திற -Description[te]=(&M) మొజిల్లా తొ తెరువు -Description[tg]=Кушодан бо &Mozilla -Description[th]=เปิดด้วย '&มอซซิลลา' -Description[tr]=&Mozilla ile Aç -Description[ug]=&Mozilla دا ئاچ -Description[uk]=Відкрити у &Mozilla -Description[uz]=Mozilla bilan &ochish -Description[uz@cyrillic]=Mozilla билан &очиш -Description[vi]=Mở bằng &Mozilla -Description[wa]=Drovi avou &Mozilla -Description[xh]=Vula nge &Mozilla -Description[x-test]=xxOpen with &Mozillaxx -Description[zh_CN]=用 &Mozilla 打开 -Description[zh_TW]=使用 &Mozilla 開啟 -Enabled=true - -[Action_1/Command_3] -Commandline=kmail --body %s -Description=Send &URL -Description[af]=Stuur URL -Description[ar]=ارسل &رابطاً -Description[ast]=Unviar &URL -Description[be]=Даслаць &URL -Description[be@latin]=Vyšli &adras -Description[bg]=&Изпращане на адрес -Description[bn]=ই&উ-আর-এল পাঠাও -Description[bn_IN]=URL প্রেরণ করুন (&U) -Description[br]=Kas an &URL -Description[bs]=Pošalji &URL -Description[ca]=Envia l'&URL -Description[ca@valencia]=Envia l'&URL -Description[cs]=Poslat &URL -Description[csb]=Wëslë adresã (&URL) -Description[cy]=Anfon &URL -Description[da]=Send &URL -Description[de]=&URL senden -Description[el]=Αποστολή &URL -Description[en_GB]=Send &URL -Description[eo]=Sendi &retadreson -Description[es]=Enviar &URL -Description[et]=&URL-i saatmine -Description[eu]=Bidali &URLa -Description[fa]=ارسال &نشانی ‌وب‌ -Description[fi]=Lähetä &verkko-osoite -Description[fr]=Envoyer l'&URL -Description[fy]=&URL-adres stjoere -Description[ga]=Seol &URL -Description[gl]=Enviar o &URL -Description[gu]=&URL મોકલો -Description[he]=שליחת &כתובת -Description[hi]=यूआरएल भेजें (&U) -Description[hne]=यूआरएल भेजव (&U) -Description[hr]=Pošalji &URL -Description[hsb]=URL &pósłać -Description[hu]=Az &URL elküldése -Description[ia]=Invia &URL -Description[id]=Kirim &URL -Description[is]=Senda &slóð -Description[it]=Invia l'&URL -Description[ja]=URL を送信(&U) -Description[ka]=&URL-ს გაგზავნა -Description[kk]=&URL-ді жіберу -Description[km]=ផ្ញើ URL -Description[kn]=&URL ಅನ್ನು ಕಳುಹಿಸು -Description[ko]=URL 보내기(&U) -Description[ku]=&URL Bişîne -Description[lt]=Siųsti &URL -Description[lv]=Sūtīt &URL -Description[mai]=यूआरएल भेजू (&U) -Description[mk]=Испрати &URL -Description[ml]=&യുആര്‍എല്‍ അയയ്ക്കുക -Description[mr]=URL पाठवा (&U) -Description[ms]=Hantar &URL -Description[nb]=Send &Nettadressen -Description[nds]=&URL schicken -Description[ne]=यूआरएल पठाउनुहोस् -Description[nl]=&URL-adres verzenden -Description[nn]=Send &URL -Description[oc]=Enviar l'&URL -Description[pa]=&URL ਭੇਜੋ -Description[pl]=Wyślij adres &URL -Description[pt]=Enviar o &URL -Description[pt_BR]=Enviar &URL -Description[ro]=Trimite &URL-ul -Description[ru]=&Отправить ссылку -Description[se]=Sádde &URL:a -Description[si]=&URL යනවන්න -Description[sk]=Poslať &URL -Description[sl]=Pošlji &URL -Description[sr]=Пошаљи &УРЛ -Description[sr@ijekavian]=Пошаљи &УРЛ -Description[sr@ijekavianlatin]=Pošalji &URL -Description[sr@latin]=Pošalji &URL -Description[sv]=Skicka &webbadress -Description[ta]=வலைப்பின்னலை அனுப்பு -Description[te]=(&U) యూ ఆర్ ఎల్ పంపించు -Description[tg]=Ирсоли &URL -Description[th]=ส่งที่อยู่ &URL -Description[tr]=&URL Gönder -Description[ug]=URL ئەۋەت(&U) -Description[uk]=Надіслати &URL -Description[uz]=URL'ni &joʻnatish -Description[uz@cyrillic]=URL'ни &жўнатиш -Description[vi]=Gửi &URL -Description[wa]=Evoyî &hårdêye -Description[xh]=Thumela i &URL -Description[x-test]=xxSend &URLxx -Description[zh_CN]=发送 &URL -Description[zh_TW]=送出 &URL -Enabled=true - -[Action_1/Command_4] -Commandline=ps x |grep -q '[f]irefox' && "firefox -remote openURL(%s, new-window)" || firefox "%s" -Icon=firefox -Description=Open with &Firefox -Description[af]=Maak oop met Firefox -Description[ar]=افتح بِواسطة &فايرفوكس -Description[ast]=Abrir con &Firefox -Description[be]=Адкрыць у &Firefox -Description[be@latin]=Adčyni ŭ hartačy „&Firefox” -Description[bg]=Отв&аряне с Firefox -Description[bn]=ফায়ার&ফক্স দিয়ে খোলো -Description[bn_IN]=Firefox সহযোগে প্রদর্শিত হবে (&F) -Description[br]=Digeriñ gant &Firefox -Description[bs]=Otvori &Fajerfoksom -Description[ca]=Obre amb el &Firefox -Description[ca@valencia]=Obri amb el &Firefox -Description[cs]=Otevřít pomocí &Firefox -Description[csb]=Òtemkni w &Firefokse -Description[da]=Åbn med &Firefox -Description[de]=Mit &Firefox öffnen -Description[el]=Άνοιγμα με το &Firefox -Description[en_GB]=Open with &Firefox -Description[eo]=Malfermi per &Fajrovulpo -Description[es]=Abrir con &Firefox -Description[et]=&Firefoxis avamine -Description[eu]=Ireki &Firefox-ekin -Description[fa]=باز کردن با &فایرفاکس‌ -Description[fi]=Avaa &Firefoxissa -Description[fr]=Ouvrir dans &Firefox -Description[fy]=Iepenje mei &Firefox -Description[ga]=Oscail le &Firefox -Description[gl]=Abrir con &Firefox -Description[gu]=ફાયરફોક્સની સાથે ખોલો (&F) -Description[he]=פתיחה &באמצעות Firefox -Description[hi]=फ़ॉयरफ़ॉक्स के साथ खोलें (&F) -Description[hne]=फायरफाक्स एखर साथ खोलव (&F) -Description[hr]=Otvori pomoću &Firefoxa -Description[hsb]=Z &Firefoxom wočinić -Description[hu]=Megnyitás a &Firefoxszal -Description[ia]=Aperi con &Firefox -Description[id]=Buka dengan &Firefox -Description[is]=Opna með &Firefox -Description[it]=Apri con &Firefox -Description[ja]=Firefox で開く(&F) -Description[ka]=გახსნა &Firefox-ით -Description[kk]=&Firefox шолғышта ашу -Description[km]=បើក​ជាមួយ Firefox -Description[kn]=(&F)ಫೈರ್ ಫಾಕ್ಸ್ ನೊಂದಿಗೆ ತೆರೆ -Description[ko]=Firefox로 열기(&F) -Description[ku]=Bi &Firefoxê Veke -Description[lt]=Atverti su &Firefox -Description[lv]=Atvērt ar &Firefox -Description[mai]=फायरफाक्स केर सँग खोलू (&F) -Description[mk]=Отвори со &Firefox -Description[ml]=&ഫയര്‍ഫോക്സില്‍ തുറക്കുക -Description[mr]=फायरफॉक्स मध्ये उघडा (&F) -Description[nb]=Åpne med &Firefox -Description[nds]=Mit &Firefox opmaken -Description[ne]=फायरफक्ससँग खोल्नुहोस् -Description[nl]=Openen met &Firefox -Description[nn]=Opna med &Firefox -Description[pa]=ਫਾਇਰਫਾਕਸ ਨਾਲ ਖੋਲ੍ਹੋ(&F) -Description[pl]=Otwórz w &Firefoksie -Description[pt]=Abrir com o &Firefox -Description[pt_BR]=Abrir com o &Firefox -Description[ro]=Deschide cu &Firefox -Description[ru]=Открыть в &Firefox -Description[se]=Raba &Firefox:ain -Description[si]=&Firefox සමඟ විවෘත කරන්න -Description[sk]=Otvoriť pomocou &Firefoxu -Description[sl]=Odpri s &Firefox -Description[sr]=Отвори &Фајерфоксом -Description[sr@ijekavian]=Отвори &Фајерфоксом -Description[sr@ijekavianlatin]=Otvori &Firefoxom -Description[sr@latin]=Otvori &Firefoxom -Description[sv]=Öppna med &Firefox -Description[ta]=&பயர்பாசுடன் திற -Description[te]=(&F) మొజిల్లా తొ తెరువు -Description[tg]=Кушодан бо &Firefox -Description[th]=เปิดด้วย 'ไ&ฟร์ฟอกซ์' -Description[tr]=&Firefox ile Aç -Description[ug]=ئوتۈلكىدە ئاچ(&F) -Description[uk]=Відкрити у &Firefox -Description[uz]=Firefox b&ilan ochish -Description[uz@cyrillic]=Firefox б&илан очиш -Description[vi]=Mở bằng &Firefox -Description[wa]=Drovi avou &Firefox -Description[x-test]=xxOpen with &Firefoxxx -Description[zh_CN]=用 &Firefox 打开 -Description[zh_TW]=使用 &Firefox 開啟 -Enabled=true - -[Action_1/Command_5] -Commandline=kmail --attach %s -Description=Send &Page -Description[af]=Stuur Bladsy -Description[ar]=ارسل ال&صفحة -Description[ast]=Unviar &páxina -Description[be]=Даслаць &старонку -Description[be@latin]=Vyšli &staronku -Description[bg]=И&зпращане на страница -Description[bn]=পৃষ্ঠা পাঠা&ও -Description[bn_IN]=পেজ প্রেরণ করুন (&P) -Description[br]=Kas ar &pajenn -Description[bs]=Pošalji &stranicu -Description[ca]=Envia la &pàgina -Description[ca@valencia]=Envia la &pàgina -Description[cs]=&Poslat stránku -Description[csb]=Sélôj &starnã -Description[cy]=Anfon &Tudalen -Description[da]=Send &side -Description[de]=&Seite senden -Description[el]=Αποστολή &σελίδας -Description[en_GB]=Send &Page -Description[eo]=Sendi &paĝon -Description[es]=Enviar &página -Description[et]=Lehek&ülje saatmine -Description[eu]=Bidali orria -Description[fa]=ارسال &صفحه‌ -Description[fi]=Lähetä &Sivu -Description[fr]=Envoyer la &page -Description[fy]=&Side stjoere -Description[ga]=Seol &Leathanach -Description[gl]=Enviar a &páxina -Description[gu]=પાનું મોકલો (&P) -Description[he]=&שליחת עמוד -Description[hi]=पृष्ठ भेजें (&P) -Description[hne]=पेज भेजव (&P) -Description[hr]=Pošalji &stranicu -Description[hsb]=&Stronu pósłać -Description[hu]=A &weboldal elküldése -Description[ia]=Invia &pagina -Description[id]=Kirim &Halaman -Description[is]=Senda &síðu -Description[it]=Invia &pagina -Description[ja]=ページを送信(&P) -Description[ka]=&გვერდის გაგზავნა -Description[kk]=&Парақты жіберу -Description[km]=ផ្ញើ​ទំព័រ -Description[kn]=ಪು&ಟವನ್ನು ಕಳುಹಿಸು -Description[ko]=페이지 보내기(&P) -Description[ku]=&Rûpelê Bişîne -Description[lt]=Siųsti &puslapį -Description[lv]=Sūtīt La&pu -Description[mai]=पृष्ठ भेजू (&P) -Description[mk]=Испрати &страница -Description[ml]=&താള്‍ അയയ്ക്കുക -Description[mr]=पान पाठवा (&P) -Description[ms]=Hantar &Halaman -Description[nb]=Send &side -Description[nds]=Sie&t schicken -Description[ne]=पृष्ठ पठाउनुहोस् -Description[nl]=&Pagina verzenden -Description[nn]=Send &side -Description[oc]=Enviar la &pagina -Description[pa]=ਪੇਜ਼ ਭੇਜੋ(&P) -Description[pl]=Wyślij &stronę -Description[pt]=Enviar a &Página -Description[pt_BR]=Enviar &página -Description[ro]=Trimite &pagina -Description[ru]=Отправить &страницу -Description[se]=Sádde &siiddu -Description[si]=පිටුව යනවන්න (&P) -Description[sk]=Poslať &stránku -Description[sl]=Pošlji &stran -Description[sr]=Пошаљи &страницу -Description[sr@ijekavian]=Пошаљи &страницу -Description[sr@ijekavianlatin]=Pošalji &stranicu -Description[sr@latin]=Pošalji &stranicu -Description[sv]=Ski&cka sida -Description[ta]=பக்கத்தை அனுப்பு -Description[te]=(&P) పుట ను పంపించు -Description[tg]=Ирсоли &саҳифа -Description[th]=ส่งหน้าเ&ว็บ -Description[tr]=&Sayfayı Gönder -Description[ug]=بەت ئەۋەت(&P) -Description[uk]=Надіслати &сторінку -Description[uz]=&Betni joʻnatish -Description[uz@cyrillic]=&Бетни жўнатиш -Description[vi]=Gửi &Trang -Description[wa]=Evoyî &pådje -Description[xh]=Thumela &Iphepha -Description[x-test]=xxSend &Pagexx -Description[zh_CN]=发送页面(&P) -Description[zh_TW]=送出 &Page -Enabled=true - -[Action_2] -Description=Mail-URL -Description[af]=Mail-URL -Description[ar]=رابط بريد -Description[ast]=URL de corréu -Description[be]=Mail-URL -Description[be@latin]=Paštovy adras -Description[bg]=Пощенски адрес -Description[bn]=মেইল ইউ-আর-এল -Description[bn_IN]=মেইল-URL -Description[br]=URL postel -Description[bs]=URL poštom -Description[ca]=URL de correu -Description[ca@valencia]=URL de correu -Description[cs]=Poštovní URL -Description[csb]=Mailowé URL -Description[cy]=URL Ebost -Description[da]=E-mail-URL -Description[de]=Mail-Adresse (URL) -Description[el]=Mail-URL -Description[en_GB]=Mail-URL -Description[eo]=Retpoŝto-URL -Description[es]=URL de correo -Description[et]=E-posti aadressi URL -Description[eu]=Postaren URLa -Description[fa]=نشانی ‌وب نامه -Description[fi]=Postita-verkko-osoite -Description[fr]=URL de courrier électronique -Description[fy]=E-post URL-adres -Description[ga]=URL Ríomhphoist -Description[gl]=Enviar o URL por correo -Description[gu]=મેઇલ-URL -Description[he]=כתובת דואר -Description[hi]=मेल-यूआरएल -Description[hne]=मेल-यूआरएल -Description[hr]=URL pošalji e-poštom -Description[hsb]=URL za mejlku -Description[hu]=Az URL elküldése levélben -Description[ia]=Mail-URL -Description[id]=URL-Surat -Description[is]=Póstsenda slóð -Description[it]=URL di posta -Description[ja]=Mail-URL -Description[ka]=Mail-URL -Description[kk]=Mail-URL -Description[km]=URL សំបុត្រ -Description[kn]=ಅಂಚೆ-URL -Description[ko]=메일-URL -Description[ku]=Mail-URL -Description[lt]=Siųsti URL paštu -Description[lv]=Sūtīt URL uz epastu -Description[mai]=मेल-यूआरएल -Description[mk]=Испрати URL по е-пошта -Description[ml]=മെയില്‍-യുആര്‍എല്‍ -Description[mr]=मेल-URL -Description[ms]=URL Mel -Description[nb]=E-postadresse -Description[nds]=Nettpostadress -Description[ne]=मेल-यूआरएल -Description[nl]=URL-adres e-mailen -Description[nn]=E-postadresse -Description[pa]=ਮੇਲ-URL -Description[pl]=Wyślij pocztą adres URL -Description[pt]=URL de E-mail -Description[pt_BR]=Enviar URL por e-mail -Description[ro]=URL email -Description[ru]=Отправить -Description[se]=E-boastačujuhus -Description[si]=තැපැල්-URL -Description[sk]=Mail-URL -Description[sl]=Pošlji URL po e-pošti -Description[sr]=УРЛ поштом -Description[sr@ijekavian]=УРЛ поштом -Description[sr@ijekavianlatin]=URL poštom -Description[sr@latin]=URL poštom -Description[sv]=Webbadress för e-post -Description[ta]=அஞ்சல்-வலைப்பின்னல் -Description[te]=యూ ఆర్ ఎల్ ను మెయిల్ చెయ్యి -Description[tg]=Суроғаи почта -Description[th]=ที่อยู่ URL ของจดหมาย -Description[tr]=Adres-Postala -Description[ug]=خەت URL -Description[uk]=Поштова адреса -Description[uz]=Xat-URL -Description[uz@cyrillic]=Хат-URL -Description[wa]=Hårdêye emile -Description[xh]=Iposi-URL -Description[x-test]=xxMail-URLxx -Description[zh_CN]=发送 URL -Description[zh_TW]=郵寄 URL -Number of commands=2 -Regexp=^mailto:. - -[Action_2/Command_0] -Commandline=kmail --composer `echo %s | sed 's/mailto://g'` -Description=Launch &Kmail -Description[af]=Lanseer Kpos -Description[ar]=نفّذ &Kmail -Description[ast]=Entamar &Kmail -Description[be]=Запусціць &KMail -Description[be@latin]=Uklučy prahramu „&Kmail” -Description[bg]=За&реждане на Kmail -Description[bn]=কে-মেই&ল চালাও -Description[bn_IN]=Kmail আরম্ভ করা হবে (&K) -Description[br]=Lañsañ &Kmail -Description[bs]=Pokreni &K‑poštu -Description[ca]=Engega el &Kmail -Description[ca@valencia]=Engega el &Kmail -Description[cs]=Spustit &Kmail -Description[csb]=Zrëszë &KMail -Description[cy]=Cychwyn &KMail -Description[da]=Start &KMail -Description[de]=&KMail starten -Description[el]=Εκκίνηση &Kmail -Description[en_GB]=Launch &KMail -Description[eo]=Lanĉi &Poŝtilon -Description[es]=Iniciar &Kmail -Description[et]=&Kmaili käivitamine -Description[eu]=Abiarazi &Kmail -Description[fa]=راه‌اندازی&Kmail‌ -Description[fi]=Käynistä &Kmail -Description[fr]=Démarrer &KMail -Description[fy]=&Kmail útfiere -Description[ga]=Tosaigh &Kmail -Description[gl]=Executar &Kmail -Description[gu]=કેમેલ ચલાવો (&K) -Description[he]=הפע&לת KMail -Description[hi]=के-मेल चालू करें (&K) -Description[hne]=के-मेल चालू करव (&K) -Description[hr]=Pokreni &Kmail poštu -Description[hsb]=&Kmail startować -Description[hu]=A &KMail elindítása -Description[ia]=Lancea &Kmail -Description[id]=Jalankan &Kmail -Description[is]=Ræsa &Kmail -Description[it]=Avvia &KMail -Description[ja]=KMail を起動(&K) -Description[ka]=&Kmail-ის გაშვება -Description[kk]=&Kmail-ды жегу -Description[km]=ចាប់ផ្ដើម Kmail -Description[kn]=(&K)ಕೆಮೈಲ್ ಅನ್ನು ಪ್ರಕ್ಷೇಪಿಸು -Description[ko]=KMail 실행(&K) -Description[ku]=Dest bi &Kmail bike -Description[lt]=Paleisti &Kmail -Description[lv]=Palaist &Kmail -Description[mai]=के-मेल चालू करू (&K) -Description[mk]=Стартувај &Kmail -Description[ml]=&കെമെയില്‍ ലഭ്യമാക്കുക -Description[mr]=केमेल चालू करा (&K) -Description[ms]=Lancar &Kmail -Description[nb]=Start &Kmail -Description[nds]=&KMail starten -Description[ne]=केडीई मेल सुरुआत गर्नुहोस् -Description[nl]=&Kmail opstarten -Description[nn]=Start &KMail -Description[pa]=ਕੇ-ਮੇਲ ਚਲਾਓ(&K) -Description[pl]=Uruchom KM&ail -Description[pt]=Lançar o &Kmail -Description[pt_BR]=Abrir o &Kmail -Description[ro]=Execută &Kmail -Description[ru]=Запустить &KMail -Description[se]=Álggat K&Mail -Description[si]=&Kmail අරඹන්න -Description[sk]=Spustiť &Kmail -Description[sl]=Zaženi &Kmail -Description[sr]=Покрени &К‑пошту -Description[sr@ijekavian]=Покрени &К‑пошту -Description[sr@ijekavianlatin]=Pokreni &K‑poštu -Description[sr@latin]=Pokreni &K‑poštu -Description[sv]=Starta &Kmail -Description[ta]=Kஅஞ்சலை இறக்கு -Description[te]=&Kmail దించుము -Description[tg]=Кушодани &Kmail -Description[th]=เรียกใช้งาน 'รับ/ส่งจดหมาย-&K' -Description[tr]=KMail Uygulamasını Ç&alıştır -Description[ug]=&Kmail قوزغات -Description[uk]=Запустити &Kmail -Description[uz]=&Kmail'ni ishga tushirish -Description[uz@cyrillic]=&Kmail'ни ишга тушириш -Description[vi]=Khởi chạy &Kmail -Description[wa]=Enonder &Kmail -Description[xh]=Launch &Kmail -Description[x-test]=xxLaunch &Kmailxx -Description[zh_CN]=启动 &Kmail -Description[zh_TW]=啟動 &Kmail -Enabled=true - -[Action_2/Command_1] -Commandline=konsole -e mutt `echo %s | sed 's/mailto://g'` -Description=Launch &mutt -Description[af]=Lanseer mutt -Description[ar]=نفّذ &Mutt -Description[ast]=Entamar &mutt -Description[be]=Запусціць &mutt -Description[be@latin]=Uklučy prahramu „&mutt” -Description[bg]=Заре&ждане на mutt -Description[bn]=&mutt চালাও -Description[bn_IN]=Mutt আরম্ভ করা হবে (&m) -Description[br]=Lañsañ &mutt -Description[bs]=Pokreni &Mat -Description[ca]=Engega el &mutt -Description[ca@valencia]=Engega el &mutt -Description[cs]=Spustit &mutt -Description[csb]=Zrëszë &mutt -Description[cy]=Cychwyn &mutt -Description[da]=Start &mutt -Description[de]=&Mutt starten -Description[el]=Εκκίνηση &mutt -Description[en_GB]=Launch &Mutt -Description[eo]=Lanĉi poŝtilon "&Mutt" -Description[es]=Iniciar &mutt -Description[et]=&Mutti käivitamine -Description[eu]=Abiarazi &Mutt -Description[fa]=راه‌اندازی &mutt‌ -Description[fi]=Käynistä &Mutt -Description[fr]=Démarrer &Mutt -Description[fy]=&Mutt útfiere -Description[ga]=Tosaigh &mutt -Description[gl]=Executar &mutt -Description[gu]=મટ્ટ ચલાવો (&m) -Description[he]=&הפעלת mutt -Description[hi]=मट चालू करें (&m) -Description[hne]=मट चालू करव (&m) -Description[hr]=Pokreni &mutt -Description[hsb]=&mutt startować -Description[hu]=A &Mutt elindítása -Description[ia]=Lancea &mutt -Description[id]=Jalankan &mutt -Description[is]=Ræsa &mutt -Description[it]=Avvia &mutt -Description[ja]=mutt を起動(&M) -Description[ka]=&mutt-ის გაშვება -Description[kk]=&mutt-ті жегу -Description[km]=ចាប់ផ្ដើម mutt -Description[kn]=(&M)ಮಟ್ ಅನ್ನು ಪ್ರಕ್ಷೇಪಿಸು -Description[ko]=mutt 실행(&M) -Description[ku]=Dest bi &mutt bike -Description[lt]=Paleisti &mutt -Description[lv]=Palaist &mutt -Description[mai]=मट चालू करू (&m) -Description[mk]=Стартувај &mutt -Description[ml]=&മട്ട് ലഭ്യമാക്കുക -Description[mr]=मट चालू करा (&m) -Description[ms]=Lancarkan &mutt -Description[nb]=Start &mutt -Description[nds]=&mutt starten -Description[ne]=मट सुरुआत गर्नुहोस् -Description[nl]=&Mutt opstarten -Description[nn]=Start &mutt -Description[pa]=ਮੱਟ ਚਲਾਓ(&m) -Description[pl]=Uruchom &mutt -Description[pt]=Lançar o &mutt -Description[pt_BR]=Abrir o &mutt -Description[ro]=Execută &mutt -Description[ru]=Запустить &mutt -Description[se]=Álggat &mutt -Description[si]=&mutt අරඹන්න -Description[sk]=Spustiť &mutt -Description[sl]=Zaženi &mutt -Description[sr]=Покрени &Мат -Description[sr@ijekavian]=Покрени &Мат -Description[sr@ijekavianlatin]=Pokreni &Mutt -Description[sr@latin]=Pokreni &Mutt -Description[sv]=Starta &Mutt -Description[ta]=muttஐ இறக்கு -Description[te]=&mutt దించుము -Description[tg]=Кушодани &mutt -Description[th]=เรียกใช้งาน '&mutt' -Description[tr]=&Mutt Uygulamasını Çalıştır -Description[ug]=&mutt قوزغات -Description[uk]=Запустити &mutt -Description[uz]= &Mutt'ni ishga tushirish -Description[uz@cyrillic]= &Mutt'ни ишга тушириш -Description[vi]=Khởi chạy &mutt -Description[wa]=Enonder &mutt -Description[xh]=Launch &mutt -Description[x-test]=xxLaunch &muttxx -Description[zh_CN]=启动 &mutt -Description[zh_TW]=啟動 &mutt -Enabled=true - -[Action_3] -Description=Text File -Description[af]=Teks Lêer -Description[ar]=ملف نصي -Description[ast]=Ficheru de testu -Description[be]=Тэкставыя файлы -Description[be@latin]=Tekstavy fajł -Description[bg]=Текстов файл -Description[bn]=টেক্সট ফাইল -Description[bn_IN]=টেক্সট ফাইল -Description[br]=Restr testenn -Description[bs]=Tekstualna datoteka -Description[ca]=Fitxer de text -Description[ca@valencia]=Fitxer de text -Description[cs]=Textový soubor -Description[csb]=Tekstowé lopczi -Description[cy]=Ffeil Testun -Description[da]=Tekstfil -Description[de]=Textdatei -Description[el]=Αρχείο κειμένου -Description[en_GB]=Text File -Description[eo]=Tekstdosiero -Description[es]=Archivo de texto -Description[et]=Tekstifail -Description[eu]=Testu-fitxategia -Description[fa]=پرونده‌ متنی -Description[fi]=Tekstitiedosto -Description[fr]=Fichier texte -Description[fy]=Teksttriem -Description[ga]=Téacschomhad -Description[gl]=Ficheiro de texto -Description[gu]=લખાણ ફાઇલ -Description[he]=קובץ טקסט -Description[hi]=पाठ फ़ाइल -Description[hne]=पाठ फाइल -Description[hr]=Tekstualna datoteka -Description[hsb]=Tekstowa dataja -Description[hu]=Szöveges fájl -Description[ia]=File de texto -Description[id]=Berkas Teks -Description[is]=Textaskrá -Description[it]=File di testo -Description[ja]=テキストファイル -Description[ka]=ტექსტური ფაილი -Description[kk]=Мәтін файлы -Description[km]=ឯកសារ​អត្ថបទ -Description[kn]=ಪಠ್ಯ ಕಡತ -Description[ko]=텍스트 파일 -Description[ku]=Pelê Nivîsê -Description[lt]=Teksto failas -Description[lv]=Teksta fails -Description[mai]=पाठ फाइल: -Description[mk]=Текстуална датотека -Description[ml]=പദാവലി ഫയല്‍ -Description[mr]=पाठ्य फाईल -Description[ms]=Fail Teks -Description[nb]=Tekstfil -Description[nds]=Textdatei -Description[ne]=पाठ फाइल -Description[nl]=Tekstbestand -Description[nn]=Tekstfil -Description[oc]=Fichièr tèxt -Description[pa]=ਟੈਕਸਟ ਫਾਇਲ -Description[pl]=Plik tekstowy -Description[pt]=Ficheiros de Texto -Description[pt_BR]=Arquivo de texto -Description[ro]=Fișier Text -Description[ru]=Текстовый файл -Description[se]=Teakstafiila -Description[si]=පෙළ ගොනුව -Description[sk]=Textový súbor -Description[sl]=Besedilna datoteka -Description[sr]=Текстуални фајл -Description[sr@ijekavian]=Текстуални фајл -Description[sr@ijekavianlatin]=Tekstualni fajl -Description[sr@latin]=Tekstualni fajl -Description[sv]=Textfil -Description[ta]=உரை கோப்பு -Description[te]=వచన దస్త్రం -Description[tg]=Файли матнӣ -Description[th]=แฟ้มข้อความ -Description[tr]=Metin Dosyası -Description[ug]=تېكىست ھۆججەت -Description[uk]=Текстовий файл -Description[uz]=Matn fayli -Description[uz@cyrillic]=Матн файли -Description[vi]=Tập tin Văn bản -Description[wa]=Fitchî tecse -Description[xh]=Ifayile Yombhalo -Description[x-test]=xxText Filexx -Description[zh_CN]=文本文件 -Description[zh_TW]=文字檔案 -Number of commands=1 -Regexp=^\\/.+\\.txt$ - -[Action_3/Command_0] -Commandline=kwrite %s -Description=Launch K&Write -Description[af]=Lanseer Kskryf -Description[ar]=نفّذ K&Write -Description[ast]=Llanzar K&Write -Description[be]=Запусціць K&Write -Description[be@latin]=Uklučy prahramu „K&Write” -Description[bg]=&Зареждане на KWrite -Description[bn]=কে-রাই&ট চালাও -Description[bn_IN]=KWrite আরম্ভ করা হবে (&W) -Description[br]=Lañsañ K&Write -Description[bs]=Pokreni &K‑pisanje -Description[ca]=Engega el K&Write -Description[ca@valencia]=Engega el K&Write -Description[cs]=Spustit K&Write -Description[csb]=Zrëszë editorã K&Write -Description[cy]=Cychwyn K&Write -Description[da]=Start K&Write -Description[de]=K&Write starten -Description[el]=Εκκίνηση K&Write -Description[en_GB]=Launch K&Write -Description[eo]=Lanĉas &simplan kodredaktilon -Description[es]=Iniciar K&Write -Description[et]=K&Write'i käivitamine -Description[eu]=Abiarazi K&Write -Description[fa]=راه‌اندازی K&Write‌ -Description[fi]=Käynistä K&Write -Description[fr]=Démarrer K&Write -Description[fy]=K&Write útfiere -Description[ga]=Tosaigh K&Write -Description[gl]=Executar K&Write -Description[gu]=કેરાઇટ ચલાવો (&W) -Description[he]=הפעל&ת KWrite -Description[hi]=के-राइट चालू करें (&W) -Description[hne]=के-राइट चालू करव (&W) -Description[hr]=Pokreni K&Write uređivač -Description[hsb]=K&Write startować -Description[hu]=A K&Write elindítása -Description[ia]=Lancea K&Write -Description[id]=Jalankan K&Write -Description[is]=Ræsa K&Write -Description[it]=Avvia K&Write -Description[ja]=KWrite を起動(&W) -Description[ka]=K&Write-ის გაშვება -Description[kk]=K&Write-ты жегу -Description[km]=ចាប់ផ្ដើម KWrite -Description[kn]=(&W)ಕೆರೈಟ್ ಅನ್ನು ಪ್ರಕ್ಷೇಪಿಸು -Description[ko]=KWrite 실행(&W) -Description[ku]=Dest bi K&Write bike -Description[lt]=Paleisti K&Write -Description[lv]=Palaist K&Write -Description[mai]=के-राइट चालू करू (&W) -Description[mk]=Стартувај K&Write -Description[ml]=കെ&റൈറ്റ് ലഭ്യമാക്കുക -Description[mr]=केराइट चालू करा (&W) -Description[ms]=Lancar K&Write -Description[nb]=Start K&Write -Description[nds]=K&Write starten -Description[ne]=केडीई राइट सुरुआत गर्नुहोस् -Description[nl]=K&Write opstarten -Description[nn]=Start K&Write -Description[pa]=ਕੇ-ਰਾਇਟਰ ਚਲਾਓ(&W) -Description[pl]=Uruchom K&Write -Description[pt]=Lançar o K&Write -Description[pt_BR]=Abrir KW&rite -Description[ro]=Execută K&Write -Description[ru]=Запустить K&Write -Description[se]=Álggat &KWrite -Description[si]=K&Write අරඹන්න -Description[sk]=Spustiť K&Write -Description[sl]=Zaženi K&Write -Description[sr]=Покрени &К‑писање -Description[sr@ijekavian]=Покрени &К‑писање -Description[sr@ijekavianlatin]=Pokreni &K‑pisanje -Description[sr@latin]=Pokreni &K‑pisanje -Description[sv]=Starta K&write -Description[ta]= K&Writeஐ இறக்கு -Description[te]=K&Write దించుము -Description[tg]=Кушодани K&Write -Description[th]=เรียกใช้งาน 'K&Write' -Description[tr]=K&Write Uygulamasını Çalıştır -Description[ug]=K&Write قوزغات -Description[uk]=Запустити K&Write -Description[uz]=K&Write'ni ishga tushirish -Description[uz@cyrillic]=K&Write'ни ишга тушириш -Description[vi]=Khởi chạy K&Write -Description[wa]=Enonder K&Write -Description[xh]=Launch K&Write -Description[x-test]=xxLaunch K&Writexx -Description[zh_CN]=启动 K&Write -Description[zh_TW]=啟動 K&Write -Enabled=true - -[Action_4] -Description=Local file URL -Description[af]=Plaaslike lêer Url -Description[ar]=رابط ملف محلي -Description[ast]=URL de ficheru llocal -Description[be]=URL мясцовага файла -Description[be@latin]=Adras lakalnaha fajła -Description[bg]=URL-адрес на локален файл -Description[bn]=স্থানীয় ফাইল ইউ-আর-এল -Description[bn_IN]=স্থানীয় ফাইলের URL -Description[br]=URL ur restr lec'hel -Description[bs]=URL lokalne datoteke -Description[ca]=URL d'un fitxer local -Description[ca@valencia]=URL d'un fitxer local -Description[cs]=Místní URL -Description[csb]=Lokalnô adresa lopkù -Description[cy]=URL ffeil lleol -Description[da]=Lokal fil-URL -Description[de]=Adresse einer lokalen Datei (URL) -Description[el]=URL τοπικού αρχείου -Description[en_GB]=Local file URL -Description[eo]=URL al loka dosiero -Description[es]=URL de archivo local -Description[et]=Kohaliku faili URL -Description[eu]=Fitxategi lokalaren URLa -Description[fa]=نشانی وب پرونده محلی -Description[fi]=Paikallisen tiedoston verkko-osoite -Description[fr]=URL de fichier local -Description[fy]=Lokale triem-URL-adres -Description[ga]=URL de chomhad logánta -Description[gl]=URL do ficheiro local -Description[gu]=સ્થળ ફાઇલ URL -Description[he]=כתובת של קובץ מקומי -Description[hi]=फ़ाइल यूआरएल निर्धारित करें -Description[hne]=लोकर फाइल यूआरएल -Description[hr]=URL lokalne datoteke -Description[hsb]=URL za lokalnu dataju -Description[hu]=helyi fájl URL-je -Description[ia]=URL de file local -Description[id]=URL berkas lokal -Description[is]=Staðbundin slóð -Description[it]=URL di file locale -Description[ja]=ローカルファイル URL -Description[ka]=ბმული ლოკალურ ფაილზე -Description[kk]=Жергілікті файлдың URL -Description[km]=URL ឯកសារ​មូលដ្ឋាន -Description[kn]=ಸ್ಥಳೀಯ ಕಡತದ URL -Description[ko]=로컬 파일 URL -Description[ku]=URL'ya pelê herêmî -Description[lt]=Vietinio failo URL -Description[lv]=Lokāla faila URL -Description[mai]=फाइल यूआरएल निर्धारित करू -Description[mk]=URL на локалната датотека -Description[ml]=ലോക്കല്‍ ഫയലിനുള്ള യുആര്‍എല്‍ -Description[mr]=स्थानिक फाईल URL -Description[ms]=URL fail setempat -Description[nb]=Lokal filadresse -Description[nds]=URL vun en lokale Datei -Description[ne]=स्थानीय फाइल यूआरएल -Description[nl]=Lokaal bestands-URL-adres -Description[nn]=Lokal filadresse -Description[pa]=ਲੋਕਲ ਫਾਇਲ URL -Description[pl]=Adres URL lokalnego pliku -Description[pt]=URL de ficheiro local -Description[pt_BR]=URL de arquivo local -Description[ro]=URL de fișier local -Description[ru]=Ссылка на локальный файл -Description[se]=Báikkalaš fiilačujuhus -Description[si]=ප්‍රාදේශිය ගොනු URL -Description[sk]=URL lokálneho súboru -Description[sl]=URL krajevne datoteke -Description[sr]=УРЛ локалног фајла -Description[sr@ijekavian]=УРЛ локалног фајла -Description[sr@ijekavianlatin]=URL lokalnog fajla -Description[sr@latin]=URL lokalnog fajla -Description[sv]=Webbadress för lokal fil -Description[ta]=உள் கோப்பு வலைப்பின்னல் -Description[te]=స్థానిక దస్త్ర యూ ఆర్ ఎల్ -Description[tg]=Ҷойгиршавии файли дохилӣ -Description[th]=ที่อยู่ของแฟ้มในระบบ -Description[tr]=Yerel dosya adresi -Description[ug]=يەرلىك ھۆججەت URL -Description[uk]=URL локального файла -Description[uz]=Lokal faylining URL'i -Description[uz@cyrillic]=Локал файлининг URL'и -Description[vi]=URL tập tin nội bộ -Description[wa]=Hårdêye viè on fitchî locå -Description[xh]=Ifayile yobulali ye URL -Description[x-test]=xxLocal file URLxx -Description[zh_CN]=本地文件 URL -Description[zh_TW]=本地檔案 URL -Number of commands=2 -Regexp=^file:. - -[Action_4/Command_0] -Commandline=kmail --body %s -Description=Send &URL -Description[af]=Stuur URL -Description[ar]=ارسل &رابطاً -Description[ast]=Unviar &URL -Description[be]=Даслаць &URL -Description[be@latin]=Vyšli &adras -Description[bg]=&Изпращане на адрес -Description[bn]=ই&উ-আর-এল পাঠাও -Description[bn_IN]=URL প্রেরণ করুন (&U) -Description[br]=Kas an &URL -Description[bs]=Pošalji &URL -Description[ca]=Envia l'&URL -Description[ca@valencia]=Envia l'&URL -Description[cs]=Poslat &URL -Description[csb]=Wëslë adresã (&URL) -Description[cy]=Anfon &URL -Description[da]=Send &URL -Description[de]=&URL senden -Description[el]=Αποστολή &URL -Description[en_GB]=Send &URL -Description[eo]=Sendi &retadreson -Description[es]=Enviar &URL -Description[et]=&URL-i saatmine -Description[eu]=Bidali &URLa -Description[fa]=ارسال &نشانی ‌وب‌ -Description[fi]=Lähetä &verkko-osoite -Description[fr]=Envoyer l'&URL -Description[fy]=&URL-adres stjoere -Description[ga]=Seol &URL -Description[gl]=Enviar o &URL -Description[gu]=&URL મોકલો -Description[he]=שליחת &כתובת -Description[hi]=यूआरएल भेजें (&U) -Description[hne]=यूआरएल भेजव (&U) -Description[hr]=Pošalji &URL -Description[hsb]=URL &pósłać -Description[hu]=Az &URL elküldése -Description[ia]=Invia &URL -Description[id]=Kirim &URL -Description[is]=Senda &slóð -Description[it]=Invia l'&URL -Description[ja]=URL を送信(&U) -Description[ka]=&URL-ს გაგზავნა -Description[kk]=&URL-ді жіберу -Description[km]=ផ្ញើ URL -Description[kn]=&URL ಅನ್ನು ಕಳುಹಿಸು -Description[ko]=URL 보내기(&U) -Description[ku]=&URL Bişîne -Description[lt]=Siųsti &URL -Description[lv]=Sūtīt &URL -Description[mai]=यूआरएल भेजू (&U) -Description[mk]=Испрати &URL -Description[ml]=&യുആര്‍എല്‍ അയയ്ക്കുക -Description[mr]=URL पाठवा (&U) -Description[ms]=Hantar &URL -Description[nb]=Send &Nettadressen -Description[nds]=&URL schicken -Description[ne]=यूआरएल पठाउनुहोस् -Description[nl]=&URL-adres verzenden -Description[nn]=Send &URL -Description[oc]=Enviar l'&URL -Description[pa]=&URL ਭੇਜੋ -Description[pl]=Wyślij adres &URL -Description[pt]=Enviar o &URL -Description[pt_BR]=Enviar &URL -Description[ro]=Trimite &URL-ul -Description[ru]=&Отправить ссылку -Description[se]=Sádde &URL:a -Description[si]=&URL යනවන්න -Description[sk]=Poslať &URL -Description[sl]=Pošlji &URL -Description[sr]=Пошаљи &УРЛ -Description[sr@ijekavian]=Пошаљи &УРЛ -Description[sr@ijekavianlatin]=Pošalji &URL -Description[sr@latin]=Pošalji &URL -Description[sv]=Skicka &webbadress -Description[ta]=வலைப்பின்னலை அனுப்பு -Description[te]=(&U) యూ ఆర్ ఎల్ పంపించు -Description[tg]=Ирсоли &URL -Description[th]=ส่งที่อยู่ &URL -Description[tr]=&URL Gönder -Description[ug]=URL ئەۋەت(&U) -Description[uk]=Надіслати &URL -Description[uz]=URL'ni &joʻnatish -Description[uz@cyrillic]=URL'ни &жўнатиш -Description[vi]=Gửi &URL -Description[wa]=Evoyî &hårdêye -Description[xh]=Thumela i &URL -Description[x-test]=xxSend &URLxx -Description[zh_CN]=发送 &URL -Description[zh_TW]=送出 &URL -Enabled=true - -[Action_4/Command_1] -Commandline=kmail --attach %s -Description=Send &File -Description[af]=Stuur Lêer -Description[ar]=ارسل ال&ملف -Description[ast]=Unviar &ficheru -Description[be]=Даслаць файл -Description[be@latin]=Vyšli &fajł -Description[bg]=Изпращане на &файл -Description[bn]=ফাই&ল পাঠাও -Description[bn_IN]=ফাইল পাঠানো হবে (&F) -Description[br]=Kas ar &restr -Description[bs]=Pošalji &datoteku -Description[ca]=Envia &fitxer -Description[ca@valencia]=Envia &fitxer -Description[cs]=Posl&at soubor -Description[csb]=Nalezë lopczi -Description[cy]=Anfon &Ffeil -Description[da]=Send &fil -Description[de]=&Datei senden -Description[el]=Αποστολή &αρχείου -Description[en_GB]=Send &File -Description[eo]=Sendi &dosieron -Description[es]=Enviar &archivo -Description[et]=&Faili saatmine -Description[eu]=Bidali &fitxategia -Description[fa]=ارسال &پرونده‌ -Description[fi]=Lähetä &tiedosto -Description[fr]=Envoyer le &fichier -Description[fy]=&Triem stjoere -Description[ga]=Seol &Comhad -Description[gl]=Enviar o &ficheiro -Description[gu]=ફાઇલ મોકલો (&F) -Description[he]=שליחת &קובץ -Description[hi]=फ़ाइल भेजें (&F) -Description[hne]=फाइल भेजव (&F) -Description[hr]=Pošalji &datoteku -Description[hsb]=&Dataju pósłać -Description[hu]=&Fájl elküldése -Description[ia]=Invia &file -Description[id]=Kirim &Berkas -Description[is]=Senda &skrá -Description[it]=Invia &file -Description[ja]=ファイルを送信(&F) -Description[ka]=&ფაილის გაგზავნა -Description[kk]=&Файлды жіберу -Description[km]=ផ្ញើ​ឯកសារ -Description[kn]=&ಕಡತವನ್ನು ಕಳುಹಿಸು -Description[ko]=파일 보내기(&F) -Description[ku]=Pelî &Bişeyîne -Description[lt]=Siųsti &failą -Description[lv]=Sūtīt &failu -Description[mai]=फाइल भेजू (&F) -Description[mk]=Испрати &датотека -Description[ml]=&ഫയല്‍ അയയ്ക്കുക -Description[mr]=फाईल पाठवा (&F) -Description[ms]=Hantar &Fail -Description[nb]=Send &Fil -Description[nds]=Datei &schicken -Description[ne]=फाइल पठाउनुहोस् -Description[nl]=&Bestand verzenden -Description[nn]=Send &fil -Description[oc]=Enviar lo &fichièr -Description[pa]=ਫਾਇਲ ਭੇਜੋ(&F) -Description[pl]=Wyślij &plik -Description[pt]=Enviar o &Ficheiro -Description[pt_BR]=Enviar &arquivo -Description[ro]=Trimite &fișierul -Description[ru]=Отправить &файл -Description[se]=Sádde &fiilla -Description[si]=ගොනුව යවන්න (&F) -Description[sk]=Poslať &súbor -Description[sl]=Pošlji &datoteko -Description[sr]=Пошаљи &фајл -Description[sr@ijekavian]=Пошаљи &фајл -Description[sr@ijekavianlatin]=Pošalji &fajl -Description[sr@latin]=Pošalji &fajl -Description[sv]=Skicka &fil -Description[ta]=கோப்பை அனுப்பு -Description[te]=(&F) దస్త్రాన్ని పంపించు -Description[tg]=Ирсоли &файл -Description[th]=ส่งแ&ฟ้ม -Description[tr]=Dosya &Gönder -Description[ug]=ھۆججەت ئەۋەت(&F) -Description[uk]=Надіслати &файл -Description[uz]=&Faylni joʻnatish -Description[uz@cyrillic]=&Файлни жўнатиш -Description[vi]=Gửi &Tập tin -Description[wa]=Evoyî &fitchî -Description[xh]=Thumela &Ifayile -Description[x-test]=xxSend &Filexx -Description[zh_CN]=发送文件(&F) -Description[zh_TW]=送出檔案(&F) -Enabled=true - -[Action_5] -Description=Gopher URL -Description[af]=Gopher Url -Description[ar]=رابط غوفر -Description[ast]=URL de Gopher -Description[be]=Gopher URL -Description[be@latin]=Adras słužby „Gopher” -Description[bg]=URL-адрес в Gopher -Description[bn]=Gopher URL -Description[bn_IN]=Gopher URL -Description[br]=URL Gopher -Description[bs]=Gofer URL -Description[ca]=URL de Gopher -Description[ca@valencia]=URL de Gopher -Description[cs]=Gopher URL -Description[csb]=Adresa Gophera -Description[cy]=URL Gopher -Description[da]=Gopher-URL -Description[de]=Gopher-Adresse (URL) -Description[el]=Gopher URL -Description[en_GB]=Gopher URL -Description[eo]=Gofer-URL -Description[es]=URL de Gopher -Description[et]=Gopheri URL -Description[eu]=Gopher-en URLa -Description[fa]=نشانی وب گوفر -Description[fi]=Gopher-verkko-osoite -Description[fr]=URL Gopher -Description[fy]=Gopher URL-adres -Description[ga]=URL Gopher -Description[gl]=URL de Gopher -Description[gu]=ગોફર URL -Description[he]=כתובת Gopher -Description[hi]=गोफर यूआरएल -Description[hne]=गोफर यूआरएल -Description[hr]=Gopher URL -Description[hsb]=URL gopherować -Description[hu]=Gopher URL -Description[ia]=URL de Gopher -Description[id]=URL Gopher -Description[is]=Gopher slóð -Description[it]=URL Gopher -Description[ja]=Gopher URL -Description[ka]=Gopher ბმული -Description[kk]=Gopher сілтемесі -Description[km]=Gopher URL -Description[kn]=ಗೋಫರ್ URL -Description[ko]=Gopher URL -Description[ku]=URL ya gopher -Description[lt]=Gopher URL -Description[lv]=Gopher URL -Description[mai]=गोफर यूआरएल -Description[mk]=Gopher URL -Description[ml]=ഗോഫെര്‍ യുആര്‍എല്‍ -Description[mr]=गोफर URL -Description[ms]=URL Gopher -Description[nb]=Gopheradresse -Description[nds]=Gopher-URL -Description[ne]=गोफर यूआरएल -Description[nl]=Gopher URL-adres -Description[nn]=Gopher-adresse -Description[pa]=ਗੋਫਰ URL -Description[pl]=Adres URL Gophera -Description[pt]=URL do Gopher -Description[pt_BR]=URL para o Gopher -Description[ro]=URL Gopher -Description[ru]=Ссылка Gopher -Description[se]=Gopher-čujuhus -Description[si]=Gopher URL -Description[sk]=URL pre Gopher -Description[sl]=URL za gopher -Description[sr]=Гофер УРЛ -Description[sr@ijekavian]=Гофер УРЛ -Description[sr@ijekavianlatin]=Gopher URL -Description[sr@latin]=Gopher URL -Description[sv]=Gopher-webbadress -Description[ta]=கோப்பர் வலைப்பின்னல் -Description[te]=గొఫర్ యూ ఆర్ ఎల్ -Description[tg]=Суроғаи Gopher -Description[th]=ที่อยู่ URL ของโกเฟอร์ -Description[tr]=Gopher adresi -Description[ug]=Gopher URL -Description[uk]=Адреса Gopher -Description[uz]=Gopher URL -Description[uz@cyrillic]=Gopher URL -Description[vi]=URL Gopher -Description[wa]=Hårdêye Gopher -Description[xh]=Gopher URL -Description[x-test]=xxGopher URLxx -Description[zh_CN]=Gopher URL -Description[zh_TW]=Gopher URL -Number of commands=2 -Regexp=^gopher:. - -[Action_5/Command_0] -Commandline=kmail --body %s -Description=Send &URL -Description[af]=Stuur URL -Description[ar]=ارسل &رابطاً -Description[ast]=Unviar &URL -Description[be]=Даслаць &URL -Description[be@latin]=Vyšli &adras -Description[bg]=&Изпращане на адрес -Description[bn]=ই&উ-আর-এল পাঠাও -Description[bn_IN]=URL প্রেরণ করুন (&U) -Description[br]=Kas an &URL -Description[bs]=Pošalji &URL -Description[ca]=Envia l'&URL -Description[ca@valencia]=Envia l'&URL -Description[cs]=Poslat &URL -Description[csb]=Wëslë adresã (&URL) -Description[cy]=Anfon &URL -Description[da]=Send &URL -Description[de]=&URL senden -Description[el]=Αποστολή &URL -Description[en_GB]=Send &URL -Description[eo]=Sendi &retadreson -Description[es]=Enviar &URL -Description[et]=&URL-i saatmine -Description[eu]=Bidali &URLa -Description[fa]=ارسال &نشانی ‌وب‌ -Description[fi]=Lähetä &verkko-osoite -Description[fr]=Envoyer l'&URL -Description[fy]=&URL-adres stjoere -Description[ga]=Seol &URL -Description[gl]=Enviar o &URL -Description[gu]=&URL મોકલો -Description[he]=שליחת &כתובת -Description[hi]=यूआरएल भेजें (&U) -Description[hne]=यूआरएल भेजव (&U) -Description[hr]=Pošalji &URL -Description[hsb]=URL &pósłać -Description[hu]=Az &URL elküldése -Description[ia]=Invia &URL -Description[id]=Kirim &URL -Description[is]=Senda &slóð -Description[it]=Invia l'&URL -Description[ja]=URL を送信(&U) -Description[ka]=&URL-ს გაგზავნა -Description[kk]=&URL-ді жіберу -Description[km]=ផ្ញើ URL -Description[kn]=&URL ಅನ್ನು ಕಳುಹಿಸು -Description[ko]=URL 보내기(&U) -Description[ku]=&URL Bişîne -Description[lt]=Siųsti &URL -Description[lv]=Sūtīt &URL -Description[mai]=यूआरएल भेजू (&U) -Description[mk]=Испрати &URL -Description[ml]=&യുആര്‍എല്‍ അയയ്ക്കുക -Description[mr]=URL पाठवा (&U) -Description[ms]=Hantar &URL -Description[nb]=Send &Nettadressen -Description[nds]=&URL schicken -Description[ne]=यूआरएल पठाउनुहोस् -Description[nl]=&URL-adres verzenden -Description[nn]=Send &URL -Description[oc]=Enviar l'&URL -Description[pa]=&URL ਭੇਜੋ -Description[pl]=Wyślij adres &URL -Description[pt]=Enviar o &URL -Description[pt_BR]=Enviar &URL -Description[ro]=Trimite &URL-ul -Description[ru]=&Отправить ссылку -Description[se]=Sádde &URL:a -Description[si]=&URL යනවන්න -Description[sk]=Poslať &URL -Description[sl]=Pošlji &URL -Description[sr]=Пошаљи &УРЛ -Description[sr@ijekavian]=Пошаљи &УРЛ -Description[sr@ijekavianlatin]=Pošalji &URL -Description[sr@latin]=Pošalji &URL -Description[sv]=Skicka &webbadress -Description[ta]=வலைப்பின்னலை அனுப்பு -Description[te]=(&U) యూ ఆర్ ఎల్ పంపించు -Description[tg]=Ирсоли &URL -Description[th]=ส่งที่อยู่ &URL -Description[tr]=&URL Gönder -Description[ug]=URL ئەۋەت(&U) -Description[uk]=Надіслати &URL -Description[uz]=URL'ni &joʻnatish -Description[uz@cyrillic]=URL'ни &жўнатиш -Description[vi]=Gửi &URL -Description[wa]=Evoyî &hårdêye -Description[xh]=Thumela i &URL -Description[x-test]=xxSend &URLxx -Description[zh_CN]=发送 &URL -Description[zh_TW]=送出 &URL -Enabled=true - -[Action_5/Command_1] -Commandline=kmail --attach %s -Description=Send &File -Description[af]=Stuur Lêer -Description[ar]=ارسل ال&ملف -Description[ast]=Unviar &ficheru -Description[be]=Даслаць файл -Description[be@latin]=Vyšli &fajł -Description[bg]=Изпращане на &файл -Description[bn]=ফাই&ল পাঠাও -Description[bn_IN]=ফাইল পাঠানো হবে (&F) -Description[br]=Kas ar &restr -Description[bs]=Pošalji &datoteku -Description[ca]=Envia &fitxer -Description[ca@valencia]=Envia &fitxer -Description[cs]=Posl&at soubor -Description[csb]=Nalezë lopczi -Description[cy]=Anfon &Ffeil -Description[da]=Send &fil -Description[de]=&Datei senden -Description[el]=Αποστολή &αρχείου -Description[en_GB]=Send &File -Description[eo]=Sendi &dosieron -Description[es]=Enviar &archivo -Description[et]=&Faili saatmine -Description[eu]=Bidali &fitxategia -Description[fa]=ارسال &پرونده‌ -Description[fi]=Lähetä &tiedosto -Description[fr]=Envoyer le &fichier -Description[fy]=&Triem stjoere -Description[ga]=Seol &Comhad -Description[gl]=Enviar o &ficheiro -Description[gu]=ફાઇલ મોકલો (&F) -Description[he]=שליחת &קובץ -Description[hi]=फ़ाइल भेजें (&F) -Description[hne]=फाइल भेजव (&F) -Description[hr]=Pošalji &datoteku -Description[hsb]=&Dataju pósłać -Description[hu]=&Fájl elküldése -Description[ia]=Invia &file -Description[id]=Kirim &Berkas -Description[is]=Senda &skrá -Description[it]=Invia &file -Description[ja]=ファイルを送信(&F) -Description[ka]=&ფაილის გაგზავნა -Description[kk]=&Файлды жіберу -Description[km]=ផ្ញើ​ឯកសារ -Description[kn]=&ಕಡತವನ್ನು ಕಳುಹಿಸು -Description[ko]=파일 보내기(&F) -Description[ku]=Pelî &Bişeyîne -Description[lt]=Siųsti &failą -Description[lv]=Sūtīt &failu -Description[mai]=फाइल भेजू (&F) -Description[mk]=Испрати &датотека -Description[ml]=&ഫയല്‍ അയയ്ക്കുക -Description[mr]=फाईल पाठवा (&F) -Description[ms]=Hantar &Fail -Description[nb]=Send &Fil -Description[nds]=Datei &schicken -Description[ne]=फाइल पठाउनुहोस् -Description[nl]=&Bestand verzenden -Description[nn]=Send &fil -Description[oc]=Enviar lo &fichièr -Description[pa]=ਫਾਇਲ ਭੇਜੋ(&F) -Description[pl]=Wyślij &plik -Description[pt]=Enviar o &Ficheiro -Description[pt_BR]=Enviar &arquivo -Description[ro]=Trimite &fișierul -Description[ru]=Отправить &файл -Description[se]=Sádde &fiilla -Description[si]=ගොනුව යවන්න (&F) -Description[sk]=Poslať &súbor -Description[sl]=Pošlji &datoteko -Description[sr]=Пошаљи &фајл -Description[sr@ijekavian]=Пошаљи &фајл -Description[sr@ijekavianlatin]=Pošalji &fajl -Description[sr@latin]=Pošalji &fajl -Description[sv]=Skicka &fil -Description[ta]=கோப்பை அனுப்பு -Description[te]=(&F) దస్త్రాన్ని పంపించు -Description[tg]=Ирсоли &файл -Description[th]=ส่งแ&ฟ้ม -Description[tr]=Dosya &Gönder -Description[ug]=ھۆججەت ئەۋەت(&F) -Description[uk]=Надіслати &файл -Description[uz]=&Faylni joʻnatish -Description[uz@cyrillic]=&Файлни жўнатиш -Description[vi]=Gửi &Tập tin -Description[wa]=Evoyî &fitchî -Description[xh]=Thumela &Ifayile -Description[x-test]=xxSend &Filexx -Description[zh_CN]=发送文件(&F) -Description[zh_TW]=送出檔案(&F) -Enabled=true - -[Action_6] -Description=ftp URL -Description[af]=ftp Url -Description[ar]=رابط عنوان ftp -Description[ast]=URL de ftp -Description[be]=ftp URL -Description[be@latin]=Adras słužby „FTP” -Description[bg]=URL-адрес във ftp -Description[bn]=ftp URL -Description[bn_IN]=ftp URL -Description[br]=URL FTP -Description[bs]=FTP URL -Description[ca]=URL d'FTP -Description[ca@valencia]=URL d'FTP -Description[cs]=FTP URL -Description[csb]=ftp URL -Description[cy]=URL ftp -Description[da]=ftp-URL -Description[de]=FTP-Adresse (URL) -Description[el]=ftp URL -Description[en_GB]=FTP URL -Description[eo]=FTP-URL -Description[es]=URL de ftp -Description[et]=FTP URL -Description[eu]=FTPren URLa -Description[fa]=نشانی وب قاپ -Description[fi]=ftp-verkko-osoite -Description[fr]=URL FTP -Description[fy]=FTP URL-adres -Description[ga]=URL ftp -Description[gl]=URL ftp -Description[gu]=ftp URL -Description[he]=כתובת FTP -Description[hi]=एफटीपी यूआरएल -Description[hne]=एफटीपी यूआरएल -Description[hr]=ftp URL -Description[hsb]=ftp URL -Description[hu]=FTP URL -Description[ia]=URL ftp -Description[id]=URL ftp -Description[is]=ftp slóð -Description[it]=URL FTP -Description[ja]=ftp URL -Description[ka]=FTP ბმული -Description[kk]=ftp сілтемесі -Description[km]=ftp URL -Description[kn]=ftp URL -Description[ko]=ftp URL -Description[ku]=URL ya ftp -Description[lt]=ftp URL -Description[lv]=ftp URL -Description[mai]=एफटीपी यूआरएल -Description[mk]=ftp URL -Description[ml]=എഫ്‌ടിപി യുആര്‍എല്‍ -Description[mr]=ftp URL -Description[ms]=URL ftp -Description[nb]=Ftp-adresse -Description[nds]=FTP-URL -Description[ne]=एफटीपी यूआरएल -Description[nl]=FTP URL-adres -Description[nn]=FTP-adresse -Description[pa]=ftp URL -Description[pl]=Adres URL FTP -Description[pt]=URL de FTP -Description[pt_BR]=URL para FTP -Description[ro]=URL FTP -Description[ru]=Ссылка FTP -Description[se]=FTP-čujuhus -Description[si]=ftp URL -Description[sk]=URL pre FTP -Description[sl]=URL za FTP -Description[sr]=ФТП УРЛ -Description[sr@ijekavian]=ФТП УРЛ -Description[sr@ijekavianlatin]=FTP URL -Description[sr@latin]=FTP URL -Description[sv]=FTP-webbadress -Description[ta]=ftpவலைப்பின்னல் -Description[te]=ఎఫ్ టి పి యూ ఆర్ ఎల్ -Description[tg]=Суроғаи FTP -Description[th]=ที่อยู่ URL ของ ftp -Description[tr]=ftp adresi -Description[ug]=ftp تور ئادرېسى(URL) -Description[uk]=Адреса ftp -Description[uz]=ftp URL -Description[uz@cyrillic]=ftp URL -Description[vi]=URL FTP -Description[wa]=Hårdêye FTP -Description[xh]=ftp URL -Description[x-test]=xxftp URLxx -Description[zh_CN]=ftp URL -Description[zh_TW]=FTP URL -Number of commands=5 -Regexp=^ftp://. - -[Action_6/Command_0] -Commandline=kioclient exec %s -Description=Open with &default Browser -Description[af]=Open met verstekblaaier -Description[ar]=افتح بواسطة &المتصفح المبدئي -Description[ast]=Abrir col restola&dor predetermináu -Description[be@latin]=Adčyni ŭ &zmoŭčanym hartačy -Description[bg]=&Отваряне с подразбиращия се браузър -Description[bn]=ডি&ফল্ট ব্রাউজার দিয়ে খোলো -Description[bn_IN]=ডিফল্ট ব্রাউজার সহযোগে প্রদর্শিত হবে (&d) -Description[bs]=Otvori &podrazumijevanim pregledačem -Description[ca]=Obre amb el navega&dor per omissió -Description[ca@valencia]=Obri amb el navega&dor per omissió -Description[cs]=Otevřít pomocí vý&chozího prohlížeče -Description[csb]=Òtemkni w &domëslnym przezérnikù -Description[da]=Åbn med stan&dard browser -Description[de]=Mit &Standardbrowser öffnen -Description[el]=Άνοιγμα με τον &προκαθορισμένο περιηγητή -Description[en_GB]=Open with &default Browser -Description[eo]=Malfermi per &defaŭlta retumilo -Description[es]=Abrir con el navega&dor predeterminado -Description[et]=Avamine vaikimisi &brauseriga -Description[eu]=Ireki arakatzaile &lehenetsiarekin -Description[fi]=Avaa &oletusselaimella -Description[fr]=Ouvrir dans le navigateur par &défaut -Description[fy]=Iepenje mei &standert blêder -Description[ga]=Oscail leis an mBrabhsálaí &réamhshocraithe -Description[gl]=Abrir co &navegador predeterminado -Description[gu]=મૂળભૂત બ્રાઉઝર સાથે ખોલો (&d) -Description[he]=פתיחה באמצעות דפדפן &ברירת המחדל -Description[hi]=डिफ़ॉल्ट ब्राउज़र खोलें (&d) -Description[hne]=डिफाल्ट ब्राउजर एखर साथ खोलव (&d) -Description[hr]=Otvori pomoću &zadanog preglednika -Description[hsb]=Ze &standardnym browserom wočinić -Description[hu]=Megnyitás az &alapértelmezett böngészővel -Description[ia]=Aperi con navigator pre&definite -Description[id]=Buka &dengan Peramban standar -Description[is]=Opna með sjálf&gefnum vefskoðara -Description[it]=Apri con browser pre&definito -Description[ja]=デフォルトのブラウザで開く(&D) -Description[kk]=Ә&детті шолғышында ашу -Description[km]=បើក​ជាមួយ​កម្មវិធី​រុករក​លំនាំដើម -Description[kn]=ಪೂರ್ವನಿಯೋಜಿ&ತ ವೀಕ್ಷಕದೊಂದಿಗೆ ತೆರೆ -Description[ko]=기본 브라우저로 열기(&D) -Description[ku]=Bi geroka &standard veke -Description[lt]=Atverti su &numatyta naršykle -Description[lv]=Atvērt ar &noklusēto pārlūku -Description[mk]=Отвори со стан&дарден прелистувач -Description[ml]=&സഹജമായ ബ്രൌസറില്‍ തുറക്കുക -Description[mr]=मूलभूत ब्राऊजरमध्ये उघडा (&D) -Description[nb]=Åpne med &standardnettleser -Description[nds]=Mit Stan&dard-Nettkieker opmaken -Description[nl]=Openen met stan&daardbrowser -Description[nn]=Opna med &standard nettlesar -Description[pa]=ਡਿਫਾਲਟ ਬਰਾਊਜ਼ਰ ਨਾਲ ਖੋਲ੍ਹੋ(&d) -Description[pl]=Otwórz w &domyślnej przeglądarce -Description[pt]=Abrir com o Navegador Pre&definido -Description[pt_BR]=Abrir com o navegador pa&drão -Description[ro]=&Deschide cu navigatorul implicit -Description[ru]=Открыть в &браузере по умолчанию -Description[si]=පෙරනිමි ගවේශකය සමඟ විවෘත කරන්න (&d) -Description[sk]=Otvoriť štan&dardným prehliadačom -Description[sl]=Odpri v privzetem &brskalniku -Description[sr]=Отвори &подразумеваним прегледачем -Description[sr@ijekavian]=Отвори &подразумијеваним прегледачем -Description[sr@ijekavianlatin]=Otvori &podrazumijevanim pregledačem -Description[sr@latin]=Otvori &podrazumevanim pregledačem -Description[sv]=Öppna med &förvald webbläsare -Description[ta]=&இயல்பிருப்பு உலாவியுடன் திறக்க -Description[te]=అప్రమేయ అన్వేషణితో తెరువుము (&d) -Description[tg]=Кушодан бо намоишгари Интернети &стандартӣ -Description[th]=เปิดด้วยเบราเซอร์&ปริยาย -Description[tr]=&Öntanımlı tarayıcı ile aç -Description[ug]=كۆڭۈلدىكى تور كۆرگۈدە ئاچ(&D) -Description[uk]=Відкрити в &типовому навігаторі -Description[uz]=Andoza &brauzer bilan ochish -Description[uz@cyrillic]=Андоза &браузер билан очиш -Description[wa]=Drovi avou l' &prémetou betchteu -Description[x-test]=xxOpen with &default Browserxx -Description[zh_CN]=用默认浏览器打开(&D) -Description[zh_TW]=使用預設瀏覽器開啟(&D) -Enabled=true - -[Action_6/Command_1] -Commandline=konqueror %s -Description=Open with &Konqueror -Description[af]=Maak oop met Konqueror -Description[ar]=افتح بواسطة &كونكيورر -Description[ast]=Abrir con &Konqueror -Description[be]=Адкрыць у &Konqueror -Description[be@latin]=Adčyni ŭ hartačy „&Konqueror” -Description[bg]=&Отваряне с Konqueror -Description[bn]=কনকরার দিয়ে খোলো (&ক) -Description[bn_IN]=Konqueror সহযোগে প্রদর্শিত হবে (&K) -Description[br]=Digeriñ gant &Konqueror -Description[bs]=Otvori &Konquerorem -Description[ca]=Obre amb el &Konqueror -Description[ca@valencia]=Obri amb el &Konqueror -Description[cs]=Otevřít pomocí &Konqueroru -Description[csb]=Òtemkni w &Konquerorze -Description[cy]=Agor gyda &Konqueror -Description[da]=Åbn med &Konqueror -Description[de]=Mit &Konqueror öffnen -Description[el]=Άνοιγμα με τον &Konqueror -Description[en_GB]=Open with &Konqueror -Description[eo]=Malfermi per &Konkeranto -Description[es]=Abrir con &Konqueror -Description[et]=&Konqueroris avamine -Description[eu]=Ireki &Konqueror-ekin -Description[fa]=باز کردن با&Konqueror‌ -Description[fi]=Avaa &Konquerorissa -Description[fr]=Ouvrir dans &Konqueror -Description[fy]=Iepenje mei &Konqueror -Description[ga]=Oscail le &Konqueror -Description[gl]=Abrir con &Konqueror -Description[gu]=કોન્કરરની સાથે ખોલો (&K) -Description[he]=&פתיחה באמצעות Konqueror -Description[hi]=कॉन्करर के साथ खोलें (&K) -Description[hne]=कान्करर एखर साथ खोलव (&K) -Description[hr]=Otvori pomoću &Konquerora -Description[hsb]=Z &konquerororm wočinić -Description[hu]=Megnyitás a &Konquerorral -Description[ia]=Aperi con &Konqueror -Description[id]=Buka dengan &Konqueror -Description[is]=Opna með &Konqueror -Description[it]=Apri con &Konqueror -Description[ja]=Konqueror で開く(&K) -Description[ka]=&Konqueror-ში გახსნა -Description[kk]=&Konqueror-де ашу -Description[km]=បើក​ជាមួយ Konqueror -Description[kn]=ಕಾಂ&ಕರರ್ ನೊಂದಿಗೆ ತೆರೆ -Description[ko]=Konqueror로 열기(&K) -Description[ku]=Bi &Konqueror veke -Description[lt]=Atverti su &Konqueror -Description[lv]=Atvērt ar &Konqueror -Description[mai]=कान्करर केर सँग खोलू (&K) -Description[mk]=Отвори со &Konqueror -Description[ml]=&കോണ്‍ക്വററില്‍ തുറക്കുക -Description[mr]=कॉन्करर मध्ये उघडा (&K) -Description[ms]=Buka dengan &Konqueror -Description[nb]=Åpne med &Konqueror -Description[nds]=Mit &Konqueror opmaken -Description[ne]=कन्क्वेररसँग खोल्नुहोस् -Description[nl]=Openen met &Konqueror -Description[nn]=Opna med &Konqueror -Description[pa]=ਕੋਨਕਿਉਰੋਰ ਨਾਲ ਖੋਲ੍ਹੋ(&K) -Description[pl]=Otwórz w &Konquerorze -Description[pt]=Abrir com o &Konqueror -Description[pt_BR]=Abrir com o &Konqueror -Description[ro]=Deschide cu &Konqueror -Description[ru]=Открыть в &Konqueror -Description[se]=Raba &Konquerorain -Description[si]=&Konqueror සමඟ විවෘත කරන්න -Description[sk]=Otvoriť pomocou &Konquerora -Description[sl]=Odpri s &Konquerorjem -Description[sr]=Отвори &К‑освајачем -Description[sr@ijekavian]=Отвори &К‑освајачем -Description[sr@ijekavianlatin]=Otvori &K‑osvajačem -Description[sr@latin]=Otvori &K‑osvajačem -Description[sv]=Öppna med &Konqueror -Description[ta]=கான்கொரர் உடன் திற -Description[te]=(&K) కాంకెరర్ తొ తెరువు -Description[tg]=Кушодан бо &Konqueror -Description[th]=เปิดด้วย '&คอนเควอร์เรอร์' -Description[tr]=&Konqueror ile Aç -Description[ug]=&Konqueror دا ئاچ -Description[uk]=Відкрити у &Konqueror -Description[uz]=Konqueror &bilan ochish -Description[uz@cyrillic]=Konqueror &билан очиш -Description[vi]=Mở bằng &Konqueror -Description[wa]=Drovi avou &Konqueror -Description[xh]=Vula nge &Konqueror -Description[x-test]=xxOpen with &Konquerorxx -Description[zh_CN]=用 &Konqueror 打开 -Description[zh_TW]=使用 &Konqueror 開啟 -Enabled=true - -[Action_6/Command_2] -Commandline=mozilla -remote openURL(%s, new-window) -Description=Open with &Mozilla -Description[af]=Maak oop met Mozilla -Description[ar]=افتح بواسطة &موزيلا -Description[ast]=Abrir con &Mozilla -Description[be]=Адкрыць у &Mozilla -Description[be@latin]=Adčyni ŭ hartačy „&Mozilla” -Description[bg]=От&варяне с Mozilla -Description[bn]=মোজিলা দিয়ে খোলো (&ম) -Description[bn_IN]=Mozilla সহযোগে প্রদর্শিত হবে (&M) -Description[br]=Digeriñ gant &Mozilla -Description[bs]=Otvori &Mozilom -Description[ca]=Obre amb el &Mozilla -Description[ca@valencia]=Obri amb el &Mozilla -Description[cs]=Otevřít pomocí &Mozilla -Description[csb]=Òtemkni w &Mozillë -Description[cy]=Agor gyda &Mozilla -Description[da]=Åbn med &Mozilla -Description[de]=Mit &Mozilla öffnen -Description[el]=Άνοιγμα με το &Mozilla -Description[en_GB]=Open with &Mozilla -Description[eo]=Malfermi per &Mozilo -Description[es]=Abrir con &Mozilla -Description[et]=&Mozillas avamine -Description[eu]=Ireki &Mozillarekin -Description[fa]=باز کردن با &موزیلا‌ -Description[fi]=Avaa &Mozillalla -Description[fr]=Ouvrir dans &Mozilla -Description[fy]=Iepenje mei &Mozilla -Description[ga]=Oscail le &Mozilla -Description[gl]=Abrir con &Mozilla -Description[gu]=મોઝિલાની સાથે ખોલો (&M) -Description[he]=פ&תיחה באמצעות Mozilla -Description[hi]=मोज़िला के साथ खोलें (&M) -Description[hne]=मोजिला एखर साथ खोलव (&M) -Description[hr]=Otvori pomoću &Mozille -Description[hsb]=Z &Mozilla wočinić -Description[hu]=Megnyitás a &Mozillával -Description[ia]=Aperi con &Mozilla -Description[id]=Buka dengan &Mozilla -Description[is]=Opna með &Mozilla -Description[it]=Apri con &Mozilla -Description[ja]=Mozilla で開く(&M) -Description[ka]=&Mozilla-ში გასნა -Description[kk]=&Mozilla-да ашу -Description[km]=បើក​ជាមួយ Mozilla -Description[kn]=(&M)ಮೋಜಿಲ್ಲಾದೊಡನೆ ತೆರೆ -Description[ko]=Mozilla로 열기(&M) -Description[ku]=Bi &Mozilla veke -Description[lt]=Atverti su &Mozilla -Description[lv]=Atvērt ar &Mozilla -Description[mai]=मोजिला केर सँग खोलू (&M) -Description[mk]=Отвори со &Mozilla -Description[ml]=&മോസില്ലാ ഉപയോഗിച്ചു് തുറക്കുക -Description[mr]=मोजिला मध्ये उघडा (&M) -Description[ms]=Buka dengan &Mozilla -Description[nb]=Åpne med &Mozilla -Description[nds]=Mit &Mozilla opmaken -Description[ne]=मोजिलासँग खोल्नुहोस् -Description[nl]=Openen met &Mozilla -Description[nn]=Opna med &Mozilla -Description[pa]=ਮੋਜ਼ੀਲਾ ਨਾਲ ਖੋਲ੍ਹੋ(&M) -Description[pl]=Otwórz w &Mozilli -Description[pt]=Abrir com o &Mozilla -Description[pt_BR]=Abrir com o &Mozilla -Description[ro]=Deschide cu &Mozilla -Description[ru]=Открыть в &Mozilla -Description[se]=Raba &Mozillain -Description[si]=&Mozilla සමඟ විවෘත කරන්න -Description[sk]=Otvoriť pomocou &Mozilly -Description[sl]=Odpri z &Mozillo -Description[sr]=Отвори &Мозилом -Description[sr@ijekavian]=Отвори &Мозилом -Description[sr@ijekavianlatin]=Otvori &Mozillom -Description[sr@latin]=Otvori &Mozillom -Description[sv]=Öppna med &Mozilla -Description[ta]=மொசில்லாவுடன் திற -Description[te]=(&M) మొజిల్లా తొ తెరువు -Description[tg]=Кушодан бо &Mozilla -Description[th]=เปิดด้วย '&มอซซิลลา' -Description[tr]=&Mozilla ile Aç -Description[ug]=&Mozilla دا ئاچ -Description[uk]=Відкрити у &Mozilla -Description[uz]=Mozilla bilan &ochish -Description[uz@cyrillic]=Mozilla билан &очиш -Description[vi]=Mở bằng &Mozilla -Description[wa]=Drovi avou &Mozilla -Description[xh]=Vula nge &Mozilla -Description[x-test]=xxOpen with &Mozillaxx -Description[zh_CN]=用 &Mozilla 打开 -Description[zh_TW]=使用 &Mozilla 開啟 -Enabled=true - -[Action_6/Command_3] -Commandline=kmail --body %s -Description=Send &URL -Description[af]=Stuur URL -Description[ar]=ارسل &رابطاً -Description[ast]=Unviar &URL -Description[be]=Даслаць &URL -Description[be@latin]=Vyšli &adras -Description[bg]=&Изпращане на адрес -Description[bn]=ই&উ-আর-এল পাঠাও -Description[bn_IN]=URL প্রেরণ করুন (&U) -Description[br]=Kas an &URL -Description[bs]=Pošalji &URL -Description[ca]=Envia l'&URL -Description[ca@valencia]=Envia l'&URL -Description[cs]=Poslat &URL -Description[csb]=Wëslë adresã (&URL) -Description[cy]=Anfon &URL -Description[da]=Send &URL -Description[de]=&URL senden -Description[el]=Αποστολή &URL -Description[en_GB]=Send &URL -Description[eo]=Sendi &retadreson -Description[es]=Enviar &URL -Description[et]=&URL-i saatmine -Description[eu]=Bidali &URLa -Description[fa]=ارسال &نشانی ‌وب‌ -Description[fi]=Lähetä &verkko-osoite -Description[fr]=Envoyer l'&URL -Description[fy]=&URL-adres stjoere -Description[ga]=Seol &URL -Description[gl]=Enviar o &URL -Description[gu]=&URL મોકલો -Description[he]=שליחת &כתובת -Description[hi]=यूआरएल भेजें (&U) -Description[hne]=यूआरएल भेजव (&U) -Description[hr]=Pošalji &URL -Description[hsb]=URL &pósłać -Description[hu]=Az &URL elküldése -Description[ia]=Invia &URL -Description[id]=Kirim &URL -Description[is]=Senda &slóð -Description[it]=Invia l'&URL -Description[ja]=URL を送信(&U) -Description[ka]=&URL-ს გაგზავნა -Description[kk]=&URL-ді жіберу -Description[km]=ផ្ញើ URL -Description[kn]=&URL ಅನ್ನು ಕಳುಹಿಸು -Description[ko]=URL 보내기(&U) -Description[ku]=&URL Bişîne -Description[lt]=Siųsti &URL -Description[lv]=Sūtīt &URL -Description[mai]=यूआरएल भेजू (&U) -Description[mk]=Испрати &URL -Description[ml]=&യുആര്‍എല്‍ അയയ്ക്കുക -Description[mr]=URL पाठवा (&U) -Description[ms]=Hantar &URL -Description[nb]=Send &Nettadressen -Description[nds]=&URL schicken -Description[ne]=यूआरएल पठाउनुहोस् -Description[nl]=&URL-adres verzenden -Description[nn]=Send &URL -Description[oc]=Enviar l'&URL -Description[pa]=&URL ਭੇਜੋ -Description[pl]=Wyślij adres &URL -Description[pt]=Enviar o &URL -Description[pt_BR]=Enviar &URL -Description[ro]=Trimite &URL-ul -Description[ru]=&Отправить ссылку -Description[se]=Sádde &URL:a -Description[si]=&URL යනවන්න -Description[sk]=Poslať &URL -Description[sl]=Pošlji &URL -Description[sr]=Пошаљи &УРЛ -Description[sr@ijekavian]=Пошаљи &УРЛ -Description[sr@ijekavianlatin]=Pošalji &URL -Description[sr@latin]=Pošalji &URL -Description[sv]=Skicka &webbadress -Description[ta]=வலைப்பின்னலை அனுப்பு -Description[te]=(&U) యూ ఆర్ ఎల్ పంపించు -Description[tg]=Ирсоли &URL -Description[th]=ส่งที่อยู่ &URL -Description[tr]=&URL Gönder -Description[ug]=URL ئەۋەت(&U) -Description[uk]=Надіслати &URL -Description[uz]=URL'ni &joʻnatish -Description[uz@cyrillic]=URL'ни &жўнатиш -Description[vi]=Gửi &URL -Description[wa]=Evoyî &hårdêye -Description[xh]=Thumela i &URL -Description[x-test]=xxSend &URLxx -Description[zh_CN]=发送 &URL -Description[zh_TW]=送出 &URL -Enabled=true - -[Action_6/Command_4] -Commandline=kmail --attach %s -Description=Send &File -Description[af]=Stuur Lêer -Description[ar]=ارسل ال&ملف -Description[ast]=Unviar &ficheru -Description[be]=Даслаць файл -Description[be@latin]=Vyšli &fajł -Description[bg]=Изпращане на &файл -Description[bn]=ফাই&ল পাঠাও -Description[bn_IN]=ফাইল পাঠানো হবে (&F) -Description[br]=Kas ar &restr -Description[bs]=Pošalji &datoteku -Description[ca]=Envia &fitxer -Description[ca@valencia]=Envia &fitxer -Description[cs]=Posl&at soubor -Description[csb]=Nalezë lopczi -Description[cy]=Anfon &Ffeil -Description[da]=Send &fil -Description[de]=&Datei senden -Description[el]=Αποστολή &αρχείου -Description[en_GB]=Send &File -Description[eo]=Sendi &dosieron -Description[es]=Enviar &archivo -Description[et]=&Faili saatmine -Description[eu]=Bidali &fitxategia -Description[fa]=ارسال &پرونده‌ -Description[fi]=Lähetä &tiedosto -Description[fr]=Envoyer le &fichier -Description[fy]=&Triem stjoere -Description[ga]=Seol &Comhad -Description[gl]=Enviar o &ficheiro -Description[gu]=ફાઇલ મોકલો (&F) -Description[he]=שליחת &קובץ -Description[hi]=फ़ाइल भेजें (&F) -Description[hne]=फाइल भेजव (&F) -Description[hr]=Pošalji &datoteku -Description[hsb]=&Dataju pósłać -Description[hu]=&Fájl elküldése -Description[ia]=Invia &file -Description[id]=Kirim &Berkas -Description[is]=Senda &skrá -Description[it]=Invia &file -Description[ja]=ファイルを送信(&F) -Description[ka]=&ფაილის გაგზავნა -Description[kk]=&Файлды жіберу -Description[km]=ផ្ញើ​ឯកសារ -Description[kn]=&ಕಡತವನ್ನು ಕಳುಹಿಸು -Description[ko]=파일 보내기(&F) -Description[ku]=Pelî &Bişeyîne -Description[lt]=Siųsti &failą -Description[lv]=Sūtīt &failu -Description[mai]=फाइल भेजू (&F) -Description[mk]=Испрати &датотека -Description[ml]=&ഫയല്‍ അയയ്ക്കുക -Description[mr]=फाईल पाठवा (&F) -Description[ms]=Hantar &Fail -Description[nb]=Send &Fil -Description[nds]=Datei &schicken -Description[ne]=फाइल पठाउनुहोस् -Description[nl]=&Bestand verzenden -Description[nn]=Send &fil -Description[oc]=Enviar lo &fichièr -Description[pa]=ਫਾਇਲ ਭੇਜੋ(&F) -Description[pl]=Wyślij &plik -Description[pt]=Enviar o &Ficheiro -Description[pt_BR]=Enviar &arquivo -Description[ro]=Trimite &fișierul -Description[ru]=Отправить &файл -Description[se]=Sádde &fiilla -Description[si]=ගොනුව යවන්න (&F) -Description[sk]=Poslať &súbor -Description[sl]=Pošlji &datoteko -Description[sr]=Пошаљи &фајл -Description[sr@ijekavian]=Пошаљи &фајл -Description[sr@ijekavianlatin]=Pošalji &fajl -Description[sr@latin]=Pošalji &fajl -Description[sv]=Skicka &fil -Description[ta]=கோப்பை அனுப்பு -Description[te]=(&F) దస్త్రాన్ని పంపించు -Description[tg]=Ирсоли &файл -Description[th]=ส่งแ&ฟ้ม -Description[tr]=Dosya &Gönder -Description[ug]=ھۆججەت ئەۋەت(&F) -Description[uk]=Надіслати &файл -Description[uz]=&Faylni joʻnatish -Description[uz@cyrillic]=&Файлни жўнатиш -Description[vi]=Gửi &Tập tin -Description[wa]=Evoyî &fitchî -Description[xh]=Thumela &Ifayile -Description[x-test]=xxSend &Filexx -Description[zh_CN]=发送文件(&F) -Description[zh_TW]=送出檔案(&F) -Enabled=true diff --git a/klipper/klippersettings.kcfgc b/klipper/klippersettings.kcfgc deleted file mode 100644 index 9ef70f8c..00000000 --- a/klipper/klippersettings.kcfgc +++ /dev/null @@ -1,7 +0,0 @@ -# Code generation options for kconfig_compiler -File=klipper.kcfg -ClassName=KlipperSettings -Singleton=true -CustomAdditions=false -SetUserTexts=true -Mutators=URLGrabberEnabled,NoActionsForWM_CLASS,Version diff --git a/klipper/main.cpp b/klipper/main.cpp deleted file mode 100644 index ee041ace..00000000 --- a/klipper/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) Andrew Stanley-Jones - - 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 -#include - -#include -#include -#include -#include -#include - -#include "tray.h" -#include "klipper.h" - -int main(int argc, char *argv[]) -{ - Klipper::createAboutData(); - KCmdLineArgs::init( argc, argv, Klipper::aboutData()); - - if (!KUniqueApplication::start()) { - fprintf(stderr, "Klipper is already running! Check it in the system tray in the panel.\n"); - exit(0); - } - KUniqueApplication app; - app.disableSessionManagement(); - app.setQuitOnLastWindowClosed( false ); - - // make KConfigDialog "know" when our actions page is changed - KConfigDialogManager::changedMap()->insert("ActionsTreeWidget", SIGNAL(changed())); - - KlipperTray klipper; - int ret = app.exec(); - Klipper::destroyAboutData(); - return ret; -} diff --git a/klipper/popupproxy.cpp b/klipper/popupproxy.cpp deleted file mode 100644 index 4e9445a2..00000000 --- a/klipper/popupproxy.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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 "popupproxy.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "historyitem.h" -#include "history.h" -#include "klipperpopup.h" - - -PopupProxy::PopupProxy( KlipperPopup* parent, int menu_height, int menu_width ) - : QObject( parent ), - m_proxy_for_menu( parent ), - m_spill_uuid(), - m_menu_height( menu_height ), - m_menu_width( menu_width ) -{ - if (!parent->history()->empty()) { - m_spill_uuid = parent->history()->first()->uuid(); - } - connect( parent->history(), SIGNAL(changed()), SLOT(slotHistoryChanged()) ); - connect(m_proxy_for_menu, SIGNAL(triggered(QAction*)), parent->history(), SLOT(slotMoveToTop(QAction*))); -} - -void PopupProxy::slotHistoryChanged() { - deleteMoreMenus(); - -} - -void PopupProxy::deleteMoreMenus() { - const KMenu* myParent = parent(); - if ( myParent != m_proxy_for_menu ) { - KMenu* delme = m_proxy_for_menu; - m_proxy_for_menu = static_cast( m_proxy_for_menu->parent() ); - while ( m_proxy_for_menu != myParent ) { - delme = m_proxy_for_menu; - m_proxy_for_menu = static_cast( m_proxy_for_menu->parent() ); - } - // We are called probably from within the menus event-handler (triggered=>slotMoveToTop=>changed=>slotHistoryChanged=>deleteMoreMenus) - // what can result in a crash if we just delete the menu here (#155196 and #165154) So, delay the delete. - delme->deleteLater(); - } -} - -int PopupProxy::buildParent( int index, const QRegExp& filter ) { - deleteMoreMenus(); - // Start from top of history (again) - m_spill_uuid = parent()->history()->empty() ? QByteArray() : parent()->history()->first()->uuid(); - if ( filter.isValid() ) { - m_filter = filter; - } - - return insertFromSpill( index ); - -} - -KlipperPopup* PopupProxy::parent() { - return static_cast( QObject::parent() ); -} - -void PopupProxy::slotAboutToShow() { - insertFromSpill(); -} - -void PopupProxy::tryInsertItem( HistoryItem const * const item, - int& remainingHeight, - const int index ) -{ - QAction *action = new QAction(m_proxy_for_menu); - QPixmap image( item->image() ); - if ( image.isNull() ) { - // Squeeze text strings so that do not take up the entire screen (or more) - QString text = m_proxy_for_menu->fontMetrics().elidedText( item->text().simplified(), Qt::ElideMiddle, m_menu_width ); - text.replace( '&', "&&" ); - action->setText(text); - } else { -#if 0 // not used because QAction#setIcon does not respect this size; it does scale anyway. TODO: find a way to set a bigger image - const QSize max_size( m_menu_width,m_menu_height/4 ); - if ( image.height() > max_size.height() || image.width() > max_size.width() ) { - image = image.scaled( max_size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); - } -#endif - action->setIcon(QIcon(image)); - } - - action->setData(item->uuid()); - - // if the m_proxy_for_menu is a submenu (aka a "More" menu) then it may the case, that there is no other action in that menu yet. - QAction *before = index < m_proxy_for_menu->actions().count() ? m_proxy_for_menu->actions().at(index) : 0; - // insert the new action to the m_proxy_for_menu - m_proxy_for_menu->insertAction(before, action); - - // Determine height of a menu item. - QStyleOptionMenuItem style_options; - // It would be much easier to use QMenu::initStyleOptions. But that is protected, so until we have a better - // excuse to subclass that, I'd rather implement this manually. - // Note 2 properties, tabwidth and maxIconWidth, are not available from the public interface, so those are left out (probably not - // important for height. Also, Exlsive checkType is disregarded as I don't think we will ever use it) - style_options.initFrom(m_proxy_for_menu); - style_options.checkType = action->isCheckable() ? QStyleOptionMenuItem::NonExclusive : QStyleOptionMenuItem::NotCheckable; - style_options.checked = action->isChecked(); - style_options.font = action->font(); - style_options.icon = action->icon(); - style_options.menuHasCheckableItems = true; - style_options.menuRect = m_proxy_for_menu->rect(); - style_options.text = action->text(); - - int font_height = QFontMetrics(m_proxy_for_menu->fontMetrics()).height(); - - int itemheight = m_proxy_for_menu->style()->sizeFromContents(QStyle::CT_MenuItem, - &style_options, - QSize( 0, font_height ), - m_proxy_for_menu).height(); - // Subtract the used height - remainingHeight -= itemheight; -} - -int PopupProxy::insertFromSpill( int index ) { - - const History* history = parent()->history(); - // This menu is going to be filled, so we don't need the aboutToShow() - // signal anymore - disconnect( m_proxy_for_menu, 0, this, 0 ); - - // Insert history items into the current m_proxy_for_menu, - // discarding any that doesn't match the current filter. - // stop when the total number of items equal m_itemsPerMenu; - int count = 0; - int remainingHeight = m_menu_height - m_proxy_for_menu->sizeHint().height(); - const HistoryItem* item = history->find(m_spill_uuid); - if (!item) { - return count; - } - do { - if ( m_filter.indexIn( item->text() ) != -1) { - tryInsertItem( item, remainingHeight, index++ ); - count++; - } - item = history->find(item->next_uuid()); - } while ( item && history->first() != item && remainingHeight >= 0); - m_spill_uuid = item->uuid(); - - // If there is more items in the history, insert a new "More..." menu and - // make *this a proxy for that menu ('s content). - if (history->first() && m_spill_uuid != history->first()->uuid()) { - KMenu* moreMenu = new KMenu(i18n("&More"), m_proxy_for_menu); - connect(moreMenu, SIGNAL(aboutToShow()), SLOT(slotAboutToShow())); - QAction *before = index < m_proxy_for_menu->actions().count() ? m_proxy_for_menu->actions().at(index) : 0; - m_proxy_for_menu->insertMenu(before, moreMenu); - m_proxy_for_menu = moreMenu; - } - - // Return the number of items inserted. - return count; - -} -#include "moc_popupproxy.cpp" diff --git a/klipper/popupproxy.h b/klipper/popupproxy.h deleted file mode 100644 index 910bd6e1..00000000 --- a/klipper/popupproxy.h +++ /dev/null @@ -1,89 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004 Esben Mose Hansen - - 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. -*/ -#ifndef POPUPPROXY_H -#define POPUPPROXY_H - -#include -#include - -#include "history.h" - -class KMenu; - -class HistoryItem; -class KlipperPopup; - -/** - * Proxy helper for the "more" menu item - * - */ -class PopupProxy : public QObject -{ - Q_OBJECT - -public: - /** - * Inserts up to itemsPerMenu into parent from parent->youngest(), - * and spills any remaining items into a more menu. - */ - PopupProxy( KlipperPopup* parent, int menu_height, int menu_width ); - - KlipperPopup* parent(); - - /** - * Called when rebuilding the menu - * Deletes any More menus.. and start (re)inserting into the toplevel menu. - * @param index Items are inserted at index. - * @param filter If non-empty, only insert items that match filter as a regex - * @return number of items inserted. - */ - int buildParent( int index, const QRegExp& filter = QRegExp() ); - -public Q_SLOTS: - void slotAboutToShow(); - void slotHistoryChanged(); -private: - /** - * Insert up to m_itemsPerMenu items from spill and a new - * more-menu if necessary. - * @param index Items are inserted at index - * @return number of items inserted. - */ - int insertFromSpill( int index = 0 ); - - /** - * Insert item into proxy_for_menu at index, - * subtracting the items height from remainingHeight - */ - void tryInsertItem( HistoryItem const * const item, int& remainingHeight, const int index ); - - /** - * Delete all "More..." menus current created. - */ - void deleteMoreMenus(); - -private: - KMenu* m_proxy_for_menu; - QByteArray m_spill_uuid; - QRegExp m_filter; - int m_menu_height; - int m_menu_width; -}; - -#endif diff --git a/klipper/tray.cpp b/klipper/tray.cpp deleted file mode 100644 index 65aecca8..00000000 --- a/klipper/tray.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of the KDE project - - Copyright (C) by Andrew Stanley-Jones - Copyright (C) 2000 by Carsten Pfeiffer - Copyright (C) 2004 Esben Mose Hansen - - 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 "tray.h" - -#include -#include -#include -#include - -#include "klipper.h" -#include "history.h" -#include "klipperpopup.h" - -KlipperTray::KlipperTray() - : KStatusNotifierItem() -{ - setTitle( i18n( "Klipper" ) ); - setIconByName( "klipper" ); - setToolTip( "klipper", i18n( "Clipboard Contents" ), i18n( "Clipboard is empty" ) ); - setCategory( SystemServices ); - setStatus( Active ); - setStandardActionsEnabled( false ); - - m_klipper = new Klipper( this, KGlobal::config()); - setContextMenu( m_klipper->history()->popup() ); - setAssociatedWidget( m_klipper->history()->popup() ); - connect( m_klipper->history(), SIGNAL(changed()), SLOT(slotSetToolTipFromHistory())); - slotSetToolTipFromHistory(); - connect( m_klipper, SIGNAL(passivePopup(QString,QString)), SLOT(slotPassivePopup(QString,QString))); -} - -void KlipperTray::slotSetToolTipFromHistory() -{ - const int TOOLTIP_LENGTH_LIMIT = 200; - if (m_klipper->history()->empty()) { - setToolTipSubTitle( i18n("Clipboard is empty")); - } else { - const HistoryItem* top = m_klipper->history()->first(); - if (top->text().length() <= TOOLTIP_LENGTH_LIMIT) { - setToolTipSubTitle(top->text()); - } else { - setToolTipSubTitle(top->text().left(TOOLTIP_LENGTH_LIMIT - 3) + "..." ); - } - } -} - -void KlipperTray::slotPassivePopup(const QString& caption, const QString& text) -{ - if (!m_notification) { - m_notification = new KNotification(this); - m_notification->setEventID("kde/notification"); - m_notification->setIcon("klipper"); - } - m_notification->setTitle(caption); - m_notification->setText(text); - m_notification->send(); -} - -#include "moc_tray.cpp" diff --git a/klipper/tray.h b/klipper/tray.h deleted file mode 100644 index e9e962a3..00000000 --- a/klipper/tray.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) by Andrew Stanley-Jones - Copyright (C) 2004 Esben Mose Hansen - - 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. -*/ -#ifndef TRAY_H -#define TRAY_H - -#include - -#include - -class KNotification; -class Klipper; - -class KlipperTray : public KStatusNotifierItem -{ - Q_OBJECT - -public: - KlipperTray(); - -public slots: - void slotSetToolTipFromHistory(); - void slotPassivePopup(const QString& caption, const QString& text); - -private: - Klipper* m_klipper; - QPointer m_notification; -}; - -#endif diff --git a/klipper/urlgrabber.cpp b/klipper/urlgrabber.cpp deleted file mode 100644 index 7cfe0b9d..00000000 --- a/klipper/urlgrabber.cpp +++ /dev/null @@ -1,524 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) (C) 2000,2001,2002 by Carsten Pfeiffer - - 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 "urlgrabber.h" - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "klippersettings.h" -#include "clipcommandprocess.h" - -// TODO: script-interface? -#include "history.h" -#include "historystringitem.h" - -URLGrabber::URLGrabber(History* history): - m_myMenu(0L), - m_myPopupKillTimer(new QTimer( this )), - m_myPopupKillTimeout(8), - m_stripWhiteSpace(true), - m_history(history) -{ - m_myPopupKillTimer->setSingleShot( true ); - connect( m_myPopupKillTimer, SIGNAL(timeout()), - SLOT(slotKillPopupMenu())); - - // testing - /* - ClipAction *action; - action = new ClipAction( "^http:\\/\\/", "Web-URL" ); - action->addCommand("kioclient exec %s", "Open with Browser", true); - action->addCommand("netscape -no-about-splash -remote \"openURL(%s, new-window)\"", "Open with Netscape", true); - m_myActions->append( action ); - - action = new ClipAction( "^mailto:", "Mail-URL" ); - action->addCommand("kmail --composer %s", "Launch kmail", true); - m_myActions->append( action ); - - action = new ClipAction( "^\\/.+\\.jpg$", "Jpeg-Image" ); - action->addCommand("kuickshow %s", "Launch KuickShow", true); - action->addCommand("kview %s", "Launch KView", true); - m_myActions->append( action ); - */ -} - - -URLGrabber::~URLGrabber() -{ - qDeleteAll(m_myActions); - m_myActions.clear(); - delete m_myMenu; -} - -// -// Called from Klipper::slotRepeatAction, i.e. by pressing Ctrl-Alt-R -// shortcut. I.e. never from clipboard monitoring -// -void URLGrabber::invokeAction( const HistoryItem* item ) -{ - m_myClipItem = item; - actionMenu( item, false ); -} - - -void URLGrabber::setActionList( const ActionList& list ) -{ - qDeleteAll(m_myActions); - m_myActions.clear(); - m_myActions = list; -} - -void URLGrabber::matchingMimeActions(const QString& clipData) -{ - KUrl url(clipData); - KConfigGroup cg(KGlobal::config(), "Actions"); - if(!cg.readEntry("EnableMagicMimeActions",true)) { - //kDebug() << "skipping mime magic due to configuration"; - return; - } - if(!url.isValid()) { - //kDebug() << "skipping mime magic due to invalid url"; - return; - } - if(url.isRelative()) { //openinng a relative path will just not work. what path should be used? - //kDebug() << "skipping mime magic due to relative url"; - return; - } - if(url.isLocalFile()) { - if ( clipData == "//") { - //kDebug() << "skipping mime magic due to C++ comment //"; - return; - } - if(!QFile::exists(url.toLocalFile())) { - //kDebug() << "skipping mime magic due to nonexistent localfile"; - return; - } - } - - // try to figure out if clipData contains a filename - KMimeType::Ptr mimetype = KMimeType::findByUrl( url, 0, - false, - true /*fast mode*/ ); - - // let's see if we found some reasonable mimetype. - // If we do we'll populate menu with actions for apps - // that can handle that mimetype - - // first: if clipboard contents starts with http, let's assume it's "text/html". - // That is even if we've url like "http://www.kde.org/somescript.pl", we'll - // still treat that as html page, because determining a mimetype using kio - // might take a long time, and i want this function to be quick! - if ( ( clipData.startsWith( QLatin1String("http://") ) || clipData.startsWith( QLatin1String("https://") ) ) - && mimetype->name() != "text/html" ) - { - // use a fake path to create a mimetype that corresponds to "text/html" - mimetype = KMimeType::findByPath( "/tmp/klipper.html", 0, true /*fast mode*/ ); - } - - if ( !mimetype->isDefault() ) { - ClipAction* action = new ClipAction( QString(), mimetype->comment() ); - KService::List lst = KMimeTypeTrader::self()->query( mimetype->name(), "Application" ); - foreach( const KService::Ptr &service, lst ) { - QHash map; - map.insert( 'i', "--icon " + service->icon() ); - map.insert( 'c', service->name() ); - - QString exec = service->exec(); - exec = KMacroExpander::expandMacros( exec, map ).trimmed(); - - action->addCommand( ClipCommand( exec, service->name(), true, service->icon() ) ); - } - if ( !lst.isEmpty() ) - m_myMatches.append( action ); - } -} - -const ActionList& URLGrabber::matchingActions( const QString& clipData, bool automatically_invoked ) -{ - m_myMatches.clear(); - - matchingMimeActions(clipData); - - - // now look for matches in custom user actions - foreach (ClipAction* action, m_myActions) { - if ( action->matches( clipData ) && (action->automatic() || !automatically_invoked) ) { - m_myMatches.append( action ); - } - } - - return m_myMatches; -} - - -void URLGrabber::checkNewData( const HistoryItem* item ) -{ - // kDebug() << "** checking new data: " << clipData; - actionMenu( item, true ); // also creates m_myMatches -} - - -void URLGrabber::actionMenu( const HistoryItem* item, bool automatically_invoked ) -{ - if (!item) { - qWarning("Attempt to invoke URLGrabber without an item"); - return; - } - QString text(item->text()); - if (m_stripWhiteSpace) { - text = text.trimmed(); - } - ActionList matchingActionsList = matchingActions( text, automatically_invoked ); - - if (!matchingActionsList.isEmpty()) { - // don't react on blacklisted (e.g. konqi's/netscape's urls) unless the user explicitly asked for it - if ( automatically_invoked && isAvoidedWindow() ) { - return; - } - - m_myCommandMapper.clear(); - - m_myPopupKillTimer->stop(); - - m_myMenu = new KMenu; - - connect(m_myMenu, SIGNAL(triggered(QAction*)), SLOT(slotItemSelected(QAction*))); - - foreach (ClipAction* clipAct, matchingActionsList) { - m_myMenu->addTitle(KIcon( "klipper" ), - i18n("%1 - Actions For: %2", clipAct->description(), KStringHandler::csqueeze(text, 45))); - QList cmdList = clipAct->commands(); - int listSize = cmdList.count(); - for (int i=0; isetData(id); - action->setText(item); - - if (!command.icon.isEmpty()) - action->setIcon(KIcon(command.icon)); - - m_myCommandMapper.insert(id, qMakePair(clipAct,i)); - m_myMenu->addAction(action); - } - } - - // only insert this when invoked via clipboard monitoring, not from an - // explicit Ctrl-Alt-R - if ( automatically_invoked ) - { - m_myMenu->addSeparator(); - QAction *disableAction = new QAction(i18n("Disable This Popup"), this); - connect(disableAction, SIGNAL(triggered()), SIGNAL(sigDisablePopup())); - m_myMenu->addAction(disableAction); - } - m_myMenu->addSeparator(); - - QAction *cancelAction = new QAction(KIcon("dialog-cancel"), i18n("&Cancel"), this); - connect(cancelAction, SIGNAL(triggered()), m_myMenu, SLOT(hide())); - m_myMenu->addAction(cancelAction); - m_myClipItem = item; - - if ( m_myPopupKillTimeout > 0 ) - m_myPopupKillTimer->start( 1000 * m_myPopupKillTimeout ); - - emit sigPopup( m_myMenu ); - } -} - - -void URLGrabber::slotItemSelected(QAction* action) -{ - if (m_myMenu) - m_myMenu->hide(); // deleted by the timer or the next action - - QByteArray id = action->data().toByteArray(); - - if (id.isEmpty()) { - kDebug() << "Klipper: no command associated"; - return; - } - - // first is action ptr, second is command index - QPair actionCommand = m_myCommandMapper.value(id); - - if (actionCommand.first) - execute(actionCommand.first, actionCommand.second); - else - kDebug() << "Klipper: cannot find associated action"; -} - - -void URLGrabber::execute( const ClipAction* action, int cmdIdx ) const -{ - if (!action) { - kDebug() << "Action object is null"; - return; - } - - ClipCommand command = action->command(cmdIdx); - - if ( command.isEnabled ) { - QString text(m_myClipItem->text()); - if (m_stripWhiteSpace) { - text = text.trimmed(); - } - ClipCommandProcess* proc = new ClipCommandProcess(*action, command, text, m_history, m_myClipItem); - if (proc->program().isEmpty()) { - delete proc; - proc = 0L; - } else { - proc->start(); - } - } -} - -void URLGrabber::loadSettings() -{ - m_stripWhiteSpace = KlipperSettings::stripWhiteSpace(); - m_myAvoidWindows = KlipperSettings::noActionsForWM_CLASS(); - m_myPopupKillTimeout = KlipperSettings::timeoutForActionPopups(); - - qDeleteAll(m_myActions); - m_myActions.clear(); - - KConfigGroup cg(KGlobal::config(), "General"); - int num = cg.readEntry("Number of Actions", 0); - QString group; - for ( int i = 0; i < num; i++ ) { - group = QString("Action_%1").arg( i ); - m_myActions.append( new ClipAction( KGlobal::config(), group ) ); - } -} - -void URLGrabber::saveSettings() const -{ - KConfigGroup cg(KGlobal::config(), "General"); - cg.writeEntry( "Number of Actions", m_myActions.count() ); - - int i = 0; - QString group; - foreach (ClipAction* action, m_myActions) { - group = QString("Action_%1").arg( i ); - action->save( KGlobal::config(), group ); - ++i; - } - - KlipperSettings::setNoActionsForWM_CLASS(m_myAvoidWindows); -} - -// find out whether the active window's WM_CLASS is in our avoid-list -// digged a little bit in netwm.cpp -bool URLGrabber::isAvoidedWindow() const -{ -#ifdef Q_WS_X11 - Display *d = QX11Info::display(); - static Atom wm_class = XInternAtom( d, "WM_CLASS", true ); - static Atom active_window = XInternAtom( d, "_NET_ACTIVE_WINDOW", true ); - Atom type_ret; - int format_ret; - unsigned long nitems_ret, unused; - unsigned char *data_ret; - long BUFSIZE = 2048; - bool ret = false; - Window active = 0L; - QString wmClass; - - // get the active window - if (XGetWindowProperty(d, DefaultRootWindow( d ), active_window, 0l, 1l, - False, XA_WINDOW, &type_ret, &format_ret, - &nitems_ret, &unused, &data_ret) - == Success) { - if (type_ret == XA_WINDOW && format_ret == 32 && nitems_ret == 1) { - active = *((Window *) data_ret); - } - XFree(data_ret); - } - if ( !active ) - return false; - - // get the class of the active window - if ( XGetWindowProperty(d, active, wm_class, 0L, BUFSIZE, False, XA_STRING, - &type_ret, &format_ret, &nitems_ret, - &unused, &data_ret ) == Success) { - if ( type_ret == XA_STRING && format_ret == 8 && nitems_ret > 0 ) { - wmClass = QString::fromUtf8( (const char *) data_ret ); - ret = (m_myAvoidWindows.indexOf( wmClass ) != -1); - } - - XFree( data_ret ); - } - - return ret; -#else - return false; -#endif -} - - -void URLGrabber::slotKillPopupMenu() -{ - if ( m_myMenu && m_myMenu->isVisible() ) - { - if ( m_myMenu->geometry().contains( QCursor::pos() ) && - m_myPopupKillTimeout > 0 ) - { - m_myPopupKillTimer->start( 1000 * m_myPopupKillTimeout ); - return; - } - } - - if ( m_myMenu ) { - m_myMenu->deleteLater(); - m_myMenu = 0; - } -} - -/////////////////////////////////////////////////////////////////////////// -//////// - -ClipCommand::ClipCommand(const QString&_command, const QString& _description, - bool _isEnabled, const QString& _icon, Output _output) - : command(_command), - description(_description), - isEnabled(_isEnabled), - output(_output) -{ - - if (!_icon.isEmpty()) - icon = _icon; - else - { - // try to find suitable icon - QString appName = command.section( ' ', 0, 0 ); - if ( !appName.isEmpty() ) - { - QPixmap iconPix = KIconLoader::global()->loadIcon( - appName, KIconLoader::Small, 0, - KIconLoader::DefaultState, - QStringList(), 0, true /* canReturnNull */ ); - if ( !iconPix.isNull() ) - icon = appName; - else - icon.clear(); - } - } -} - - -ClipAction::ClipAction( const QString& regExp, const QString& description, bool automatic ) - : m_myRegExp( regExp ), m_myDescription( description ), m_automatic(automatic) -{ -} - -ClipAction::ClipAction( KSharedConfigPtr kc, const QString& group ) - : m_myRegExp( kc->group(group).readEntry("Regexp") ), - m_myDescription (kc->group(group).readEntry("Description") ), - m_automatic(kc->group(group).readEntry("Automatic", QVariant(true)).toBool() ) -{ - KConfigGroup cg(kc, group); - - int num = cg.readEntry( "Number of commands", 0 ); - - // read the commands - for ( int i = 0; i < num; i++ ) { - QString _group = group + "/Command_%1"; - KConfigGroup _cg(kc, _group.arg(i)); - - addCommand( ClipCommand(_cg.readPathEntry( "Commandline", QString() ), - _cg.readEntry( "Description" ), // i18n'ed - _cg.readEntry( "Enabled" , false), - _cg.readEntry( "Icon"), - static_cast(_cg.readEntry( "Output", QVariant(ClipCommand::IGNORE)).toInt()))); - } -} - - -ClipAction::~ClipAction() -{ - m_myCommands.clear(); -} - - -void ClipAction::addCommand( const ClipCommand& cmd ) -{ - if ( cmd.command.isEmpty() ) - return; - - m_myCommands.append( cmd ); -} - -void ClipAction::replaceCommand( int idx, const ClipCommand& cmd ) -{ - if ( idx < 0 || idx >= m_myCommands.count() ) { - kDebug() << "wrong command index given"; - return; - } - - m_myCommands.replace(idx, cmd); -} - - -// precondition: we're in the correct action's group of the KConfig object -void ClipAction::save( KSharedConfigPtr kc, const QString& group ) const -{ - KConfigGroup cg(kc, group); - cg.writeEntry( "Description", description() ); - cg.writeEntry( "Regexp", regExp() ); - cg.writeEntry( "Number of commands", m_myCommands.count() ); - cg.writeEntry( "Automatic", automatic() ); - - int i=0; - // now iterate over all commands of this action - foreach (const ClipCommand& cmd, m_myCommands) { - QString _group = group + "/Command_%1"; - KConfigGroup cg(kc, _group.arg(i)); - - cg.writePathEntry( "Commandline", cmd.command ); - cg.writeEntry( "Description", cmd.description ); - cg.writeEntry( "Enabled", cmd.isEnabled ); - cg.writeEntry( "Icon", cmd.icon ); - cg.writeEntry( "Output", static_cast(cmd.output) ); - - ++i; - } -} - -#include "moc_urlgrabber.cpp" diff --git a/klipper/urlgrabber.h b/klipper/urlgrabber.h deleted file mode 100644 index 5f7a1b2e..00000000 --- a/klipper/urlgrabber.h +++ /dev/null @@ -1,193 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2000 by Carsten Pfeiffer - - 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. -*/ -#ifndef URLGRABBER_H -#define URLGRABBER_H - -#include -#include -#include - -#include - -class History; -class HistoryItem; -#include - -class KConfig; -class KMenu; -#include -#include - -class ClipAction; -class ClipCommand; -typedef QList ActionList; - -class URLGrabber : public QObject -{ - Q_OBJECT - -public: - URLGrabber(History* history); - ~URLGrabber(); - - /** - * Checks a given string whether it matches any of the user-defined criteria. - * If it does, the configured action will be executed. - * @returns false if the string should be put into the popupmenu or not, - * otherwise true. - */ - void checkNewData( const HistoryItem* item ); - void invokeAction( const HistoryItem* item ); - - ActionList actionList() const { return m_myActions; } - void setActionList( const ActionList& ); - - void loadSettings(); - void saveSettings() const; - - int popupTimeout() const { return m_myPopupKillTimeout; } - void setPopupTimeout( int timeout ) { m_myPopupKillTimeout = timeout; } - - QStringList excludedWMClasses() const { return m_myAvoidWindows; } - void setExcludedWMClasses( const QStringList& list ) { m_myAvoidWindows = list; } - - bool stripWhiteSpace() const { return m_stripWhiteSpace; } - void setStripWhiteSpace( bool enable ) { m_stripWhiteSpace = enable; } - -private: - const ActionList& matchingActions( const QString&, bool automatically_invoked ); - void execute( const ClipAction *action, int commandIdx ) const; - bool isAvoidedWindow() const; - void actionMenu( const HistoryItem* item, bool automatically_invoked ); - void matchingMimeActions(const QString& clipData); - - ActionList m_myActions; - ActionList m_myMatches; - QStringList m_myAvoidWindows; - const HistoryItem* m_myClipItem; - - // holds mappings of menu action IDs to action commands (action+cmd index in it) - QHash > m_myCommandMapper; - KMenu* m_myMenu; - QTimer* m_myPopupKillTimer; - int m_myPopupKillTimeout; - bool m_stripWhiteSpace; - History* m_history; - -private Q_SLOTS: - void slotItemSelected(QAction* action); - void slotKillPopupMenu(); - -Q_SIGNALS: - void sigPopup( QMenu * ); - void sigDisablePopup(); - -}; - - -class ClipCommand -{ -public: - /** - * What to do with output of command - */ - enum Output { - IGNORE, // Discard output - REPLACE, // Replace clipboard entry with output - ADD // Add output as new clipboard element - }; - - ClipCommand( const QString& _command, - const QString& _description, - bool enabled=true, - const QString& _icon=QString(), - Output _output=IGNORE); - - QString command; - QString description; - bool isEnabled; - QString icon; - Output output; -}; - -Q_DECLARE_METATYPE(ClipCommand::Output) - -/** - * Represents one configured action. An action consists of one regular - * expression, an (optional) description and a list of ClipCommands - * (a command to be executed, a description and an enabled/disabled flag). - */ -class ClipAction -{ -public: - explicit ClipAction( const QString& regExp = QString(), - const QString& description = QString(), - bool automagic = true); - - ClipAction( KSharedConfigPtr kc, const QString& ); - ~ClipAction(); - - void setRegExp( const QString& r) { m_myRegExp = QRegExp( r ); } - QString regExp() const { return m_myRegExp.pattern(); } - - bool matches( const QString& string ) const { return ( m_myRegExp.indexIn( string ) != -1 ); } - - QStringList regExpMatches() const { return m_myRegExp.capturedTexts(); } - - void setDescription( const QString& d) { m_myDescription = d; } - QString description() const { return m_myDescription; } - - void setAutomatic( bool automatic ) { m_automatic = automatic; } - bool automatic() const { return m_automatic; } - - /** - * Removes all ClipCommands associated with this ClipAction. - */ - void clearCommands() { m_myCommands.clear(); } - - void addCommand(const ClipCommand& cmd); - - /** - * Replaces command at index @p idx with command @p newCmd - */ - void replaceCommand( int idx, const ClipCommand& newCmd ); - - /** - * Returns command by its index in command list - */ - ClipCommand command(int idx) const { return m_myCommands.at(idx); } - - QList commands() const { return m_myCommands; } - - /** - * Saves this action to a a given KConfig object - */ - void save( KSharedConfigPtr, const QString& ) const; - - -private: - QRegExp m_myRegExp; - QString m_myDescription; - QList m_myCommands; - bool m_automatic; - -}; - - -#endif // URLGRABBER_H diff --git a/klipper/version.h b/klipper/version.h deleted file mode 100644 index e238f90c..00000000 --- a/klipper/version.h +++ /dev/null @@ -1,25 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) Andrew Stanley-Jones - - 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. -*/ -#ifndef VERSION_H -#define VERSION_H - -static const char * const klipper_version = "0.9.7"; -static const qint8 klipper_version_int = 97; - -#endif diff --git a/kmediaplayer/kmediaplayer.desktop b/kmediaplayer/kmediaplayer.desktop index ddf7aa60..9c9e675d 100644 --- a/kmediaplayer/kmediaplayer.desktop +++ b/kmediaplayer/kmediaplayer.desktop @@ -10,4 +10,3 @@ Categories=Qt;KDE;AudioVideo;Audio;Video;Player;TV; MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/mp4;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-flv;video/x-theora;video/x-matroska;video/webm;audio/x-flac;audio/x-vorbis+ogg;video/x-ogm+ogg;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;video/mp2t;audio/flac;audio/mp4; StartupNotify=true X-KDE-MediaPlayer=kmediaplayer -X-KDE-HasTrayOption=true diff --git a/kmenuedit/basictab.cpp b/kmenuedit/basictab.cpp index 109c2a1c..18297609 100644 --- a/kmenuedit/basictab.cpp +++ b/kmenuedit/basictab.cpp @@ -78,7 +78,6 @@ BasicTab::BasicTab( QWidget *parent ) "%c - the caption")); _launchCB = new QCheckBox(i18n("Enable &launch feedback"), general_group); - _systrayCB = new QCheckBox(i18n("&Place in system tray"), general_group); _onlyShowInKdeCB = new QCheckBox( i18n( "Only show in KDE" ), general_group ); _hiddenEntryCB = new QCheckBox( i18n( "Hidden entry" ), general_group ); _hiddenEntryCB->hide(); @@ -109,7 +108,6 @@ BasicTab::BasicTab( QWidget *parent ) connect(_execEdit, SIGNAL(urlSelected(KUrl)), SLOT(slotExecSelected())); connect(_launchCB, SIGNAL(clicked()), SLOT(launchcb_clicked())); - connect(_systrayCB, SIGNAL(clicked()), SLOT(systraycb_clicked())); connect(_onlyShowInKdeCB, SIGNAL(clicked()), SLOT(onlyshowcb_clicked()) ); connect( _hiddenEntryCB, SIGNAL(clicked()), SLOT(hiddenentrycb_clicked()) ); // add line inputs to the grid @@ -118,9 +116,8 @@ BasicTab::BasicTab( QWidget *parent ) grid->addWidget(_commentEdit, 2, 1, 1, 2); grid->addWidget(_execEdit, 3, 1, 1, 2); grid->addWidget(_launchCB, 4, 0, 1, 3 ); - grid->addWidget(_systrayCB, 5, 0, 1, 3 ); - grid->addWidget(_onlyShowInKdeCB, 6, 0, 1, 3 ); - grid->addWidget(_hiddenEntryCB, 7, 0, 1, 3 ); + grid->addWidget(_onlyShowInKdeCB, 5, 0, 1, 3 ); + grid->addWidget(_hiddenEntryCB, 6, 0, 1, 3 ); // setup icon button _iconButton = new KIconButton(general_group); @@ -226,7 +223,6 @@ void BasicTab::slotDisableAction() _commentEdit->setEnabled(false); _execEdit->setEnabled(false); _launchCB->setEnabled(false); - _systrayCB->setEnabled(false); _onlyShowInKdeCB->setEnabled( false ); _hiddenEntryCB->setEnabled( false ); _nameLabel->setEnabled(false); @@ -248,7 +244,6 @@ void BasicTab::enableWidgets(bool isDF, bool isDeleted) _iconButton->setEnabled(!isDeleted); _execEdit->setEnabled(isDF && !isDeleted); _launchCB->setEnabled(isDF && !isDeleted); - // _systrayCB->setEnabled(isDF && !isDeleted); _onlyShowInKdeCB->setEnabled(isDF && !isDeleted); _hiddenEntryCB->setEnabled(isDF && !isDeleted); _nameLabel->setEnabled(!isDeleted); @@ -286,7 +281,6 @@ void BasicTab::setFolderInfo(MenuFolderInfo *folderInfo) _termOptEdit->clear(); _uidEdit->clear(); _launchCB->setChecked(false); - _systrayCB->setChecked(false); _terminalCB->setChecked(false); _onlyShowInKdeCB->setChecked( false ); _hiddenEntryCB->setChecked( false ); @@ -310,7 +304,6 @@ void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo) _iconButton->setIcon( QString() ); _execEdit->lineEdit()->clear(); - _systrayCB->setChecked(false); _onlyShowInKdeCB->setChecked( false ); _hiddenEntryCB->setChecked( false ); @@ -335,18 +328,7 @@ void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo) _commentEdit->setCursorPosition(0); _iconButton->setIcon(df->readIcon()); - QString temp = df->desktopGroup().readEntry("Exec"); - if (temp.endsWith(QLatin1String(" -tray"))) - { - _execEdit->lineEdit()->setText(temp.left(temp.length()-6)); - _systrayCB->setChecked(true); - } - else - { - _execEdit->lineEdit()->setText(temp); - _systrayCB->setChecked(false); - } - _systrayCB->setEnabled(df->desktopGroup().readEntry("X-KDE-HasTrayOption", false)); + _execEdit->lineEdit()->setText(df->desktopGroup().readEntry("Exec")); _pathEdit->lineEdit()->setText(df->readPath()); _termOptEdit->setText(df->desktopGroup().readEntry("TerminalOptions")); @@ -385,10 +367,7 @@ void BasicTab::apply() KDesktopFile *df = _menuEntryInfo->desktopFile(); KConfigGroup dg = df->desktopGroup(); dg.writeEntry("Comment", _commentEdit->text()); - if (_systrayCB->isEnabled() && _systrayCB->isChecked()) - dg.writeEntry("Exec", _execEdit->lineEdit()->text().append(" -tray")); - else - dg.writeEntry("Exec", _execEdit->lineEdit()->text()); + dg.writeEntry("Exec", _execEdit->lineEdit()->text()); dg.writePathEntry("Path", _pathEdit->lineEdit()->text()); @@ -442,11 +421,6 @@ void BasicTab::launchcb_clicked() slotChanged(); } -void BasicTab::systraycb_clicked() -{ - slotChanged(); -} - void BasicTab::onlyshowcb_clicked() { slotChanged(); diff --git a/kmenuedit/basictab.h b/kmenuedit/basictab.h index 883ff871..3f32c3fc 100644 --- a/kmenuedit/basictab.h +++ b/kmenuedit/basictab.h @@ -58,7 +58,6 @@ public Q_SLOTS: protected Q_SLOTS: void slotChanged(); void launchcb_clicked(); - void systraycb_clicked(); void termcb_clicked(); void uidcb_clicked(); void slotExecSelected(); @@ -74,7 +73,7 @@ protected: KLineEdit *_descriptionEdit; KUrlRequester *_execEdit, *_pathEdit; KLineEdit *_termOptEdit, *_uidEdit; - QCheckBox *_terminalCB, *_uidCB, *_launchCB, *_systrayCB, *_onlyShowInKdeCB, *_hiddenEntryCB; + QCheckBox *_terminalCB, *_uidCB, *_launchCB, *_onlyShowInKdeCB, *_hiddenEntryCB; KIconButton *_iconButton; QGroupBox *_path_group, *_term_group, *_uid_group; QLabel *_termOptLabel, *_uidLabel, *_pathLabel, *_nameLabel, *_commentLabel, *_execLabel; diff --git a/konsole/desktop/konsole.desktop b/konsole/desktop/konsole.desktop index a453ae24..c9faabc6 100755 --- a/konsole/desktop/konsole.desktop +++ b/konsole/desktop/konsole.desktop @@ -8,7 +8,6 @@ Categories=Qt;KDE;System;TerminalEmulator; Actions=NewWindow; X-DocPath=konsole/index.html StartupNotify=true -X-KDE-HasTrayOption=true Name=Konsole Name[af]=Konsole diff --git a/kstyles/oxygen/oxygenshadowhelper.cpp b/kstyles/oxygen/oxygenshadowhelper.cpp index 10ff4ca0..16dcab8f 100644 --- a/kstyles/oxygen/oxygenshadowhelper.cpp +++ b/kstyles/oxygen/oxygenshadowhelper.cpp @@ -359,29 +359,11 @@ namespace Oxygen in most cases all 4 paddings are identical, since offsets are handled when generating the pixmaps. There is one extra pixel needed with respect to actual shadow size, to deal with how menu backgrounds are rendered. - Some special care is needed for QBalloonTip, since the later have an arrow */ if( isToolTip( widget ) ) { - if( widget->inherits( "QBalloonTip" ) ) - { - - // balloon tip needs special margins to deal with the arrow - int top = 0; - int bottom = 0; - widget->getContentsMargins(NULL, &top, NULL, &bottom ); - - // also need to decrement default size further due to extra hard coded round corner - const int size = _size - 2; - - // it seems arrow can be either to the top or the bottom. Adjust margins accordingly - if( top > bottom ) data << size - (top - bottom) << size << size << size; - else data << size << size << size - (bottom - top) << size; - - } else { - data << _size << _size << _size << _size; - } + data << _size << _size << _size << _size; } else if( isToolBar( widget ) ) { diff --git a/ksysguard/gui/ksysguard.desktop b/ksysguard/gui/ksysguard.desktop index 1e6bd110..98e5efd8 100755 --- a/ksysguard/gui/ksysguard.desktop +++ b/ksysguard/gui/ksysguard.desktop @@ -175,4 +175,3 @@ X-DocPath=ksysguard/index.html Terminal=false StartupNotify=true Categories=Qt;KDE;System; -X-KDE-HasTrayOption=true diff --git a/kwin/CMakeLists.txt b/kwin/CMakeLists.txt index 8e475c00..3fabb591 100644 --- a/kwin/CMakeLists.txt +++ b/kwin/CMakeLists.txt @@ -1,8 +1,6 @@ ########### configure tests ############### -option(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON) option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON) -option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) option(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON) option(KWIN_BUILD_COMPOSITE "Enable building of KWin with XRender Compositing support" ON) @@ -23,7 +21,6 @@ include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects ${CMAKE_CURRENT_SOURCE_DIR}/libkdecorations ${CMAKE_CURRENT_SOURCE_DIR}/effects - ${CMAKE_CURRENT_SOURCE_DIR}/tabbox ) add_subdirectory( libkdecorations ) @@ -34,7 +31,6 @@ if(KWIN_BUILD_KCMS) endif() add_subdirectory( clients ) -add_subdirectory( tabbox ) # Install the KWin/Effect service type @@ -113,7 +109,6 @@ set(kwin_SRCS unmanaged.cpp scene.cpp scene_xrender.cpp - thumbnailitem.cpp deleted.cpp effects.cpp compositingprefs.cpp @@ -122,19 +117,6 @@ set(kwin_SRCS xcbutils.cpp ) -if(KWIN_BUILD_TABBOX) - set(kwin_SRCS - ${kwin_SRCS} - tabbox/tabbox.cpp - tabbox/clientmodel.cpp - tabbox/declarative.cpp - tabbox/desktopchain.cpp - tabbox/desktopmodel.cpp - tabbox/tabboxconfig.cpp - tabbox/tabboxhandler.cpp - ) -endif() - if(KWIN_BUILD_SCREENEDGES) set(kwin_SRCS ${kwin_SRCS} @@ -167,7 +149,6 @@ add_executable(kwin ${kwin_SRCS} ${kwin4_effect_builtins_sources}) target_link_libraries(kwin KDE4::kdeui - KDE4::kdeclarative ${X11_X11_LIB} ${X11_Xext_LIB} ${X11_ICE_LIB} diff --git a/kwin/COMPLIANCE b/kwin/COMPLIANCE index be88f16d..0b308790 100644 --- a/kwin/COMPLIANCE +++ b/kwin/COMPLIANCE @@ -233,7 +233,6 @@ _KDE_NET_WM_USER_CREATION_TIME window property _KDE_NET_WM_BLOCK_COMPOSITING window property _KDE_NET_WM_SHADOW window property _KDE_NET_WM_TAB_GROUP window property -_KDE_FIRST_IN_WINDOWLIST window property _KDE_NET_WM_TEMPORARY_RULES window property _NET_WM_CONTEXT_HELP - Katie extension diff --git a/kwin/Messages.sh b/kwin/Messages.sh index eef24b78..5fdb7846 100644 --- a/kwin/Messages.sh +++ b/kwin/Messages.sh @@ -1,3 +1,3 @@ #!/bin/bash $EXTRACTRC *.kcfg >> rc.cpp -$XGETTEXT *.h *.cpp killer/*.cpp tabbox/*.cpp -o $podir/kwin.pot +$XGETTEXT *.h *.cpp killer/*.cpp -o $podir/kwin.pot diff --git a/kwin/atoms.cpp b/kwin/atoms.cpp index 8f63d40d..cb11edd6 100644 --- a/kwin/atoms.cpp +++ b/kwin/atoms.cpp @@ -118,9 +118,6 @@ Atoms::Atoms() atoms[n] = &kde_net_wm_tab_group; names[n++] = (char*) "_KDE_NET_WM_TAB_GROUP"; - atoms[n] = &kde_first_in_window_list; - names[n++] = (char*) "_KDE_FIRST_IN_WINDOWLIST"; - atoms[n] = &kde_skip_close_animation; names[n++] = (char*) "_KDE_NET_WM_SKIP_CLOSE_ANIMATION"; diff --git a/kwin/atoms.h b/kwin/atoms.h index 0f6fbb00..23419128 100644 --- a/kwin/atoms.h +++ b/kwin/atoms.h @@ -61,7 +61,6 @@ public: Atom kde_net_wm_shadow; Atom net_wm_opaque_region; Atom kde_net_wm_tab_group; - Atom kde_first_in_window_list; Atom kde_skip_close_animation; }; diff --git a/kwin/client.cpp b/kwin/client.cpp index b23a6ff0..fedb4419 100644 --- a/kwin/client.cpp +++ b/kwin/client.cpp @@ -32,9 +32,6 @@ along with this program. If not, see . #include "group.h" #include "paintredirector.h" #include "shadow.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif #include "workspace.h" // KDE #include @@ -119,7 +116,6 @@ Client::Client() , padding_bottom(0) , sm_stacking_order(-1) , paintRedirector(0) - , m_firstInTabBox(false) , electricMaximizing(false) , needsSessionInteract(false) , needsXWindowMove(false) @@ -178,11 +174,6 @@ Client::Client() //Client to workspace connections require that each //client constructed be connected to the workspace wrapper -#ifdef KWIN_BUILD_TABBOX - // TabBoxClient - m_tabBoxClient = QSharedPointer(new TabBox::TabBoxClientImpl(this)); -#endif - geom = QRect(0, 0, 100, 100); // So that decorations don't start with size being (0,0) client_size = QSize(100, 100); ready_for_painting = false; // wait for first damage or sync reply @@ -2201,24 +2192,6 @@ KDecorationDefines::Position Client::titlebarPosition() const return titlePos; } -void Client::updateFirstInTabBox() -{ - // TODO: move into KWindowInfo - Atom type; - int format, status; - unsigned long nitems = 0; - unsigned long extra = 0; - unsigned char *data = 0; - status = XGetWindowProperty(display(), window(), atoms->kde_first_in_window_list, 0, 1, false, atoms->kde_first_in_window_list, &type, &format, &nitems, &extra, &data); - if (status == Success && format == 32 && nitems == 1) { - setFirstInTabBox(true); - } else { - setFirstInTabBox(false); - } - if (data) - XFree(data); -} - bool Client::isClient() const { return true; diff --git a/kwin/client.h b/kwin/client.h index fca08e61..5b7de014 100644 --- a/kwin/client.h +++ b/kwin/client.h @@ -50,11 +50,6 @@ class KStartupInfoId; namespace KWin { -namespace TabBox -{ - -class TabBoxClientImpl; -} class Bridge; class PaintRedirector; @@ -609,17 +604,6 @@ public: }; void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom, CoordinateMode mode) const; - QWeakPointer tabBoxClient() const { - return m_tabBoxClient.toWeakRef(); - } - bool isFirstInTabBox() const { - return m_firstInTabBox; - } - void setFirstInTabBox(bool enable) { - m_firstInTabBox = enable; - } - void updateFirstInTabBox(); - //sets whether the client should be treated as a SessionInteract window void setSessionInteract(bool needed); virtual bool isClient() const; @@ -935,8 +919,6 @@ private: friend struct ResetupRulesProcedure; friend class GeometryUpdatesBlocker; PaintRedirector* paintRedirector; - QSharedPointer m_tabBoxClient; - bool m_firstInTabBox; bool electricMaximizing; QuickTileMode electricMode; diff --git a/kwin/clients/CMakeLists.txt b/kwin/clients/CMakeLists.txt index 692f02b0..4918a5c7 100644 --- a/kwin/clients/CMakeLists.txt +++ b/kwin/clients/CMakeLists.txt @@ -1,4 +1 @@ -add_subdirectory( aurorae ) -if(KWIN_BUILD_OXYGEN) - add_subdirectory( oxygen ) -endif() +add_subdirectory( oxygen ) diff --git a/kwin/clients/aurorae/CMakeLists.txt b/kwin/clients/aurorae/CMakeLists.txt deleted file mode 100644 index 01c0ee80..00000000 --- a/kwin/clients/aurorae/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -project(aurorae) - -add_subdirectory(src) -#add_subdirectory(themes/example-deco) - -add_subdirectory(themes) diff --git a/kwin/clients/aurorae/README b/kwin/clients/aurorae/README deleted file mode 100644 index 72e833a1..00000000 --- a/kwin/clients/aurorae/README +++ /dev/null @@ -1,6 +0,0 @@ -Aurorae is a themeable window decoration for KWin. - -It supports theme files consisting of several SVG files for decoration and buttons. Themes can be -installed and selected directly in the configuration module of KWin decorations. - -Please have a look at theme-description on how to write a theme file. \ No newline at end of file diff --git a/kwin/clients/aurorae/src/CMakeLists.txt b/kwin/clients/aurorae/src/CMakeLists.txt deleted file mode 100644 index 9b1e42b3..00000000 --- a/kwin/clients/aurorae/src/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -########### decoration ############### -include_directories( - ./lib - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} -) - -set(kwin3_aurorae_PART_SRCS - aurorae.cpp - lib/auroraetheme.cpp - lib/themeconfig.cpp -) - -kde4_add_plugin(kwin3_aurorae ${kwin3_aurorae_PART_SRCS}) - -target_link_libraries(kwin3_aurorae KDE4::kdeui ${QT_QTDECLARATIVE_LIBRARY} kdecorations) - -install(TARGETS kwin3_aurorae DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} ) - -set(decoration_plugin_SRCS - decorationplugin.cpp - decorationoptions.cpp - colorhelper.cpp -) - -add_library(decorationplugin SHARED ${decoration_plugin_SRCS}) -target_link_libraries(decorationplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} KDE4::kdeui kdecorations) -install(TARGETS decorationplugin DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration) - -########### install files ############### - -install( FILES aurorae.desktop DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin ) -install( FILES - qml/aurorae.qml - qml/AuroraeButton.qml - qml/AuroraeButtonGroup.qml - qml/AuroraeMaximizeButton.qml - qml/Decoration.qml - qml/DecorationButton.qml - qml/MenuButton.qml - DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/aurorae ) -install( FILES - qml/Decoration.qml - qml/DecorationButton.qml - qml/MenuButton.qml - qml/ButtonGroup.qml - qml/qmldir - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration ) -install( FILES kwindecoration.desktop DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR} ) diff --git a/kwin/clients/aurorae/src/aurorae.cpp b/kwin/clients/aurorae/src/aurorae.cpp deleted file mode 100644 index 1b07a3ad..00000000 --- a/kwin/clients/aurorae/src/aurorae.cpp +++ /dev/null @@ -1,646 +0,0 @@ -/******************************************************************** -Copyright (C) 2009, 2010, 2012 Martin Gräßlin - -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, see . -*********************************************************************/ - -#include "aurorae.h" -#include "auroraetheme.h" -#include "config-kwin.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace Aurorae -{ - -AuroraeFactory::AuroraeFactory() - : QObject() - , KDecorationFactory() - , m_theme(new AuroraeTheme(this)) - , m_engine(new QDeclarativeEngine(this)) - , m_component(new QDeclarativeComponent(m_engine, this)) - , m_engineType(AuroraeEngine) -{ - init(); -} - -void AuroraeFactory::init() -{ - qRegisterMetaType("Qt::MouseButtons"); - - KConfig conf("auroraerc"); - KConfigGroup group(&conf, "Engine"); - if (!group.hasKey("EngineType") && !group.hasKey("ThemeName")) { - // neither engine type and theme name are configured, use the only available theme - initQML(group); - } else if (group.hasKey("EngineType")) { - const QString engineType = group.readEntry("EngineType", "aurorae").toLower(); - if (engineType == "qml") { - initQML(group); - } else { - // fallback to classic Aurorae Themes - initAurorae(conf, group); - } - } else { - // fallback to classic Aurorae Themes - initAurorae(conf, group); - } -} - -void AuroraeFactory::initAurorae(KConfig &conf, KConfigGroup &group) -{ - m_engineType = AuroraeEngine; - const QString themeName = group.readEntry("ThemeName"); - if (themeName.isEmpty()) { - // no theme configured, fall back to Plastik QML theme - initQML(group); - return; - } - KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data"); - KConfigGroup themeGroup(&conf, themeName); - m_theme->loadTheme(themeName, config); - m_theme->setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry("BorderSize", KDecorationDefines::BorderNormal)); - m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry("ButtonSize", KDecorationDefines::BorderNormal)); - m_theme->setTabDragMimeType(tabDragMimeType()); - // setup the QML engine - /* use logic from KDeclarative::setupBindings(): - "addImportPath adds the path at the beginning, so to honour user's - paths we need to traverse the list in reverse order" */ - QStringListIterator paths(KGlobal::dirs()->findDirs("module", "imports")); - paths.toBack(); - while (paths.hasPrevious()) { - m_engine->addImportPath(paths.previous()); - } - m_component->loadUrl(QUrl(KStandardDirs::locate("data", "kwin/aurorae/aurorae.qml"))); - m_engine->rootContext()->setContextProperty("auroraeTheme", m_theme); - m_themeName = themeName; -} - -void AuroraeFactory::initQML(const KConfigGroup &group) -{ - // try finding the QML package - const QString themeName = group.readEntry("ThemeName", "kwin4_decoration_qml_plastik"); - kDebug(1212) << "Trying to load QML Decoration " << themeName; - const QString internalname = themeName.toLower(); - - QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(internalname); - KService::List offers = KServiceTypeTrader::self()->query("KWin/Decoration", constraint); - if (offers.isEmpty()) { - kError(1212) << "Couldn't find QML Decoration " << themeName; - // TODO: what to do in error case? - return; - } - KService::Ptr service = offers.first(); - KPluginInfo plugininfo(service); - const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString(); - const QString scriptName = service->property("X-Plasma-MainScript").toString(); - const QString file = KStandardDirs::locate("data", "kwin/decorations/" + pluginName + "/contents/" + scriptName); - if (file.isNull()) { - kDebug(1212) << "Could not find script file for " << pluginName; - // TODO: what to do in error case? - return; - } - m_engineType = QMLEngine; - // setup the QML engine - /* use logic from KDeclarative::setupBindings(): - "addImportPath adds the path at the beginning, so to honour user's - paths we need to traverse the list in reverse order" */ - QStringListIterator paths(KGlobal::dirs()->findDirs("module", "imports")); - paths.toBack(); - while (paths.hasPrevious()) { - m_engine->addImportPath(paths.previous()); - } - m_component->loadUrl(QUrl::fromLocalFile(file)); - m_themeName = themeName; -} - -AuroraeFactory::~AuroraeFactory() -{ - s_instance = NULL; -} - -AuroraeFactory *AuroraeFactory::instance() -{ - if (!s_instance) { - s_instance = new AuroraeFactory; - } - - return s_instance; -} - -bool AuroraeFactory::reset(unsigned long changed) -{ - if (changed & SettingButtons) { - emit buttonsChanged(); - } - if (changed & SettingFont){ - emit titleFontChanged(); - } - if (changed == SettingCompositing) { - return false; - } - const KConfig conf("auroraerc"); - const KConfigGroup group(&conf, "Engine"); - const QString themeName = group.readEntry("ThemeName", "example-deco"); - const KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data"); - const KConfigGroup themeGroup(&conf, themeName); - if (themeName != m_themeName) { - m_engine->clearComponentCache(); - init(); - // recreate all decorations - return true; - } - if (m_engineType == AuroraeEngine) { - m_theme->setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry("BorderSize", KDecorationDefines::BorderNormal)); - m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry("ButtonSize", KDecorationDefines::BorderNormal)); - } - emit configChanged(); - return changed & (SettingDecoration | SettingButtons | SettingBorder); // need hard reset -} - -bool AuroraeFactory::supports(Ability ability) const -{ - switch (ability) { - case AbilityUsesAlphaChannel: - case AbilityAnnounceAlphaChannel: - case AbilityButtonMenu: - case AbilityButtonSpacer: - case AbilityExtendIntoClientArea: - case AbilityButtonMinimize: - case AbilityButtonMaximize: - case AbilityButtonClose: - case AbilityButtonAboveOthers: - case AbilityButtonBelowOthers: - case AbilityButtonShade: - case AbilityButtonOnAllDesktops: - case AbilityButtonHelp: - case AbilityProvidesShadow: - return true; // TODO: correct value from theme - case AbilityTabbing: - return false; - default: - return false; - } -} - -KDecoration *AuroraeFactory::createDecoration(KDecorationBridge *bridge) -{ - AuroraeClient *client = new AuroraeClient(bridge, this); - return client; -} - -QList< KDecorationDefines::BorderSize > AuroraeFactory::borderSizes() const -{ - return QList< BorderSize >() << BorderTiny << BorderNormal << - BorderLarge << BorderVeryLarge << BorderHuge << - BorderVeryHuge << BorderOversized; -} - -QDeclarativeItem *AuroraeFactory::createQmlDecoration(Aurorae::AuroraeClient *client) -{ - QDeclarativeContext *context = new QDeclarativeContext(m_engine->rootContext(), this); - context->setContextProperty("decoration", client); - return qobject_cast< QDeclarativeItem* >(m_component->create(context)); -} - -AuroraeFactory *AuroraeFactory::s_instance = NULL; - -/******************************************************* -* Client -*******************************************************/ -AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory) - : KDecoration(bridge, factory) - , m_view(NULL) - , m_scene(new QGraphicsScene(this)) - , m_item(AuroraeFactory::instance()->createQmlDecoration(this)) -{ - connect(this, SIGNAL(keepAboveChanged(bool)), SIGNAL(keepAboveChangedWrapper())); - connect(this, SIGNAL(keepBelowChanged(bool)), SIGNAL(keepBelowChangedWrapper())); - connect(AuroraeFactory::instance(), SIGNAL(buttonsChanged()), SIGNAL(buttonsChanged())); - connect(AuroraeFactory::instance(), SIGNAL(configChanged()), SIGNAL(configChanged())); - connect(AuroraeFactory::instance(), SIGNAL(titleFontChanged()), SIGNAL(fontChanged())); - connect(m_item, SIGNAL(alphaChanged()), SLOT(slotAlphaChanged())); -} - -AuroraeClient::~AuroraeClient() -{ - if (m_item) { - m_item->setParent(NULL); - m_item->deleteLater(); - } - m_scene->setParent(NULL); - m_scene->deleteLater(); - m_view->setParent(NULL); - m_view->deleteLater(); -} - -void AuroraeClient::init() -{ - m_scene->setItemIndexMethod(QGraphicsScene::NoIndex); - // HACK: we need to add the GraphicsView as a child widget to a normal widget - // the GraphicsView eats the mouse release event and by that kwin core starts to move - // the decoration each time the decoration is clicked - // therefore we use two widgets and inject an own mouse release event to the parent widget - // when the graphics view eats a mouse event - createMainWidget(); - widget()->setAttribute(Qt::WA_TranslucentBackground); - widget()->setAttribute(Qt::WA_NoSystemBackground); - widget()->installEventFilter(this); - m_view = new QGraphicsView(m_scene, widget()); - m_view->setAttribute(Qt::WA_TranslucentBackground); - m_view->setWindowFlags(Qt::X11BypassWindowManagerHint); - m_view->setFrameShape(QFrame::NoFrame); - m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_view->setOptimizationFlags(QGraphicsView::DontSavePainterState); - m_view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - QPalette pal = m_view->palette(); - pal.setColor(m_view->backgroundRole(), Qt::transparent); - m_view->setPalette(pal); - QPalette pal2 = widget()->palette(); - pal2.setColor(widget()->backgroundRole(), Qt::transparent); - widget()->setPalette(pal2); - if (m_item) - m_scene->addItem(m_item); - slotAlphaChanged(); - - AuroraeFactory::instance()->theme()->setCompositingActive(compositingActive()); -} - -bool AuroraeClient::eventFilter(QObject *object, QEvent *event) -{ - // we need to filter the wheel events on the decoration - // QML does not yet provide a way to accept wheel events, this will change with Qt 5 - // TODO: remove in KDE5 - // see BUG: 304248 - if (object != widget() || event->type() != QEvent::Wheel) { - return KDecoration::eventFilter(object, event); - } - QWheelEvent *wheel = static_cast(event); - if (mousePosition(wheel->pos()) == PositionCenter) { - titlebarMouseWheelOperation(wheel->delta()); - return true; - } - return false; -} - -void AuroraeClient::activeChange() -{ - emit activeChanged(); -} - -void AuroraeClient::captionChange() -{ - emit captionChanged(); -} - -void AuroraeClient::iconChange() -{ - emit iconChanged(); -} - -void AuroraeClient::desktopChange() -{ - emit desktopChanged(); -} - -void AuroraeClient::maximizeChange() -{ - emit maximizeChanged(); -} - -void AuroraeClient::resize(const QSize &s) -{ - if (m_item) { - m_item->setWidth(s.width()); - m_item->setHeight(s.height()); - } - m_scene->setSceneRect(QRectF(QPoint(0, 0), s)); - m_view->resize(s); - widget()->resize(s); -} - -void AuroraeClient::shadeChange() -{ - emit shadeChanged(); -} - -void AuroraeClient::borders(int &left, int &right, int &top, int &bottom) const -{ - if (!m_item) { - left = right = top = bottom = 0; - return; - } - const bool maximized = maximizeMode() == MaximizeFull; - QObject *borders = NULL; - if (maximized) { - borders = m_item->findChild("maximizedBorders"); - } else { - borders = m_item->findChild("borders"); - } - sizesFromBorders(borders, left, right, top, bottom); -} - -void AuroraeClient::padding(int &left, int &right, int &top, int &bottom) const -{ - if (!m_item || maximizeMode() == MaximizeFull) { - left = right = top = bottom = 0; - return; - } - sizesFromBorders(m_item->findChild("padding"), left, right, top, bottom); -} - -void AuroraeClient::sizesFromBorders(const QObject *borders, int &left, int &right, int &top, int &bottom) const -{ - if (!borders) { - return; - } - left = borders->property("left").toInt(); - right = borders->property("right").toInt(); - top = borders->property("top").toInt(); - bottom = borders->property("bottom").toInt(); -} - -QSize AuroraeClient::minimumSize() const -{ - return widget()->minimumSize(); -} - -KDecorationDefines::Position AuroraeClient::mousePosition(const QPoint &point) const -{ - // based on the code from deKorator - int pos = PositionCenter; - if (isShade() || isMaximized()) { - return Position(pos); - } - - int borderLeft, borderTop, borderRight, borderBottom; - borders(borderLeft, borderRight, borderTop, borderBottom); - int paddingLeft, paddingTop, paddingRight, paddingBottom; - padding(paddingLeft, paddingRight, paddingTop, paddingBottom); - int titleEdgeLeft, titleEdgeRight, titleEdgeTop, titleEdgeBottom; - AuroraeFactory::instance()->theme()->titleEdges(titleEdgeLeft, titleEdgeTop, titleEdgeRight, titleEdgeBottom, false); - switch (AuroraeFactory::instance()->theme()->decorationPosition()) { - case DecorationTop: - borderTop = titleEdgeTop; - break; - case DecorationLeft: - borderLeft = titleEdgeLeft; - break; - case DecorationRight: - borderRight = titleEdgeRight; - break; - case DecorationBottom: - borderBottom = titleEdgeBottom; - break; - default: - break; // nothing - } - if (point.x() >= (m_view->width() - borderRight - paddingRight)) { - pos |= PositionRight; - } else if (point.x() <= borderLeft + paddingLeft) { - pos |= PositionLeft; - } - - if (point.y() >= m_view->height() - borderBottom - paddingBottom) { - pos |= PositionBottom; - } else if (point.y() <= borderTop + paddingTop ) { - pos |= PositionTop; - } - - return Position(pos); -} - -void AuroraeClient::reset(long unsigned int changed) -{ - KDecoration::reset(changed); -} - -void AuroraeClient::menuClicked() -{ - showWindowMenu(QCursor::pos()); -} - -void AuroraeClient::toggleShade() -{ - setShade(!isShade()); -} - -void AuroraeClient::toggleKeepAbove() -{ - setKeepAbove(!keepAbove()); -} - -void AuroraeClient::toggleKeepBelow() -{ - setKeepBelow(!keepBelow()); -} - -bool AuroraeClient::isMaximized() const -{ - return maximizeMode()==KDecorationDefines::MaximizeFull; -} - -void AuroraeClient::titlePressed(int button, int buttons) -{ - titlePressed(static_cast(button), static_cast(buttons)); -} - -void AuroraeClient::titleReleased(int button, int buttons) -{ - titleReleased(static_cast(button), static_cast(buttons)); -} - -void AuroraeClient::titleMouseMoved(int button, int buttons) -{ - titleMouseMoved(static_cast(button), static_cast(buttons)); -} - -void AuroraeClient::titlePressed(Qt::MouseButton button, Qt::MouseButtons buttons) -{ - const QPoint cursor = QCursor::pos(); - QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, widget()->mapFromGlobal(cursor), - cursor, button, buttons, Qt::NoModifier); - processMousePressEvent(event); - delete event; - event = 0; -} - -void AuroraeClient::titleReleased(Qt::MouseButton button, Qt::MouseButtons buttons) -{ - const QPoint cursor = QCursor::pos(); - QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonRelease, widget()->mapFromGlobal(cursor), - cursor, button, buttons, Qt::NoModifier); - QApplication::sendEvent(widget(), event); - delete event; - event = 0; -} - -void AuroraeClient::titleMouseMoved(Qt::MouseButton button, Qt::MouseButtons buttons) -{ - const QPoint cursor = QCursor::pos(); - QMouseEvent *event = new QMouseEvent(QEvent::MouseMove, widget()->mapFromGlobal(cursor), - cursor, button, buttons, Qt::NoModifier); - QApplication::sendEvent(widget(), event); - delete event; - event = 0; -} - -void AuroraeClient::themeChanged() -{ - m_scene->clear(); - m_item = AuroraeFactory::instance()->createQmlDecoration(this); - if (!m_item) { - return; - } - - m_item->setWidth(m_scene->sceneRect().width()); - m_item->setHeight(m_scene->sceneRect().height()); - m_scene->addItem(m_item); - connect(m_item, SIGNAL(alphaChanged()), SLOT(slotAlphaChanged())); - slotAlphaChanged(); -} - -int AuroraeClient::doubleClickInterval() const -{ - return QApplication::doubleClickInterval(); -} - -void AuroraeClient::closeWindow() -{ - QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doCloseWindow", Qt::QueuedConnection); -} - -void AuroraeClient::doCloseWindow() -{ - KDecoration::closeWindow(); -} - -void AuroraeClient::maximize(int button) -{ - // a maximized window does not need to have a window decoration - // in that case we need to delay handling by one cycle - // BUG: 304870 - QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), - "doMaximzie", - Qt::QueuedConnection, - Q_ARG(int, button)); -} - -void AuroraeClient::doMaximzie(int button) -{ - KDecoration::maximize(static_cast(button)); -} - -void AuroraeClient::titlebarDblClickOperation() -{ - // the double click operation can result in a window being maximized - // see maximize - QMetaObject::invokeMethod(qobject_cast< KDecoration* >(this), "doTitlebarDblClickOperation", Qt::QueuedConnection); -} - -void AuroraeClient::doTitlebarDblClickOperation() -{ - KDecoration::titlebarDblClickOperation(); -} - -QVariant AuroraeClient::readConfig(const QString &key, const QVariant &defaultValue) -{ - KSharedConfigPtr config = KSharedConfig::openConfig("auroraerc"); - return config->group(AuroraeFactory::instance()->currentThemeName()).readEntry(key, defaultValue); -} - -void AuroraeClient::slotAlphaChanged() -{ - if (!m_item) { - setAlphaEnabled(false); - return; - } - QVariant alphaProperty = m_item->property("alpha"); - if (alphaProperty.isValid() && alphaProperty.canConvert()) { - setAlphaEnabled(alphaProperty.toBool()); - } else { - // by default all Aurorae themes use the alpha channel - setAlphaEnabled(true); - } -} - -QRegion AuroraeClient::region(KDecorationDefines::Region r) -{ - if (r != ExtendedBorderRegion) { - return QRegion(); - } - if (!m_item) { - return QRegion(); - } - if (isMaximized()) { - // empty region for maximized windows - return QRegion(); - } - int left, right, top, bottom; - left = right = top = bottom = 0; - sizesFromBorders(m_item->findChild("extendedBorders"), left, right, top, bottom); - if (top == 0 && right == 0 && bottom == 0 && left == 0) { - // no extended borders - return QRegion(); - } - - int paddingLeft, paddingRight, paddingTop, paddingBottom; - paddingLeft = paddingRight = paddingTop = paddingBottom = 0; - padding(paddingLeft, paddingRight, paddingTop, paddingBottom); - QRect rect = widget()->rect().adjusted(paddingLeft, paddingTop, -paddingRight, -paddingBottom); - rect.translate(-paddingLeft, -paddingTop); - - return QRegion(rect.adjusted(-left, -top, right, bottom)).subtract(rect); -} - -bool AuroraeClient::animationsSupported() const -{ - if (!compositingActive()) { - return false; - } - QPixmap pix(1,1); - QPainter p(&pix); - const bool raster = p.paintEngine()->type() == QPaintEngine::Raster; - p.end(); - return raster; -} - -} // namespace Aurorae - -extern "C" -{ - KDE_EXPORT KDecorationFactory *create_factory() { - return Aurorae::AuroraeFactory::instance(); - } - KWIN_EXPORT int decoration_version() { - return KWIN_DECORATION_API_VERSION; - } -} - - -#include "moc_aurorae.cpp" diff --git a/kwin/clients/aurorae/src/aurorae.desktop b/kwin/clients/aurorae/src/aurorae.desktop deleted file mode 100644 index 1b7a522e..00000000 --- a/kwin/clients/aurorae/src/aurorae.desktop +++ /dev/null @@ -1,68 +0,0 @@ -[Desktop Entry] -Name=Aurorae Decoration Theme Engine -Name[ar]=محرك شفق لسمات التزيين -Name[ast]=Motor de temes de decoración Aurorae -Name[bg]=Теми за декорация на прозорци Aurorae -Name[bs]=Aurore, tematski motor dekoracija -Name[ca]=Motor del tema de decoració Aurorae -Name[ca@valencia]=Motor del tema de decoració Aurorae -Name[cs]=Stroj motivů dekorace Aurorae -Name[csb]=Mòtór dekòracëji wëzdrzatkù Aurorae -Name[da]=Temamotor til Aurorae-dekorationen -Name[de]=Aurorae-Dekorationsdesign-Engine -Name[el]=Μηχανισμός διακόσμησης θεμάτων Aurorae -Name[en_GB]=Auroræ Decoration Theme Engine -Name[eo]=Aurorae Ornamaĵ-etosa Modulo -Name[es]=Motor de temas de decoración Aurorae -Name[et]=Aurorae dekoratsioonide teema mootor -Name[eu]=Aurorae apainketa-gaiaren motorra -Name[fi]=Kehysten teemamoottori Aurorae -Name[fr]=Moteur de thèmes pour la décoration « Aurorae » -Name[fy]=Aurorae dekoraasje tema motor -Name[ga]=Inneall Téama Maisiúcháin Aurorae -Name[gl]=Motor de temas de decoración Aurorae -Name[he]=מנוע ערכת התצוגה Aurorae Decoration -Name[hr]=Tematski mehanizam za ukrase Aurorae -Name[hu]=Aurorae ablakdekorációs témamodul -Name[ia]=Motor de thema de decoration Aurorae -Name[id]=Mesin Tema Dekorasi Aurorae -Name[is]=Aurorae skjáskreytiþemavél -Name[it]=Motore dei temi decorativi Aurorae -Name[ja]=オーロラ装飾テーマエンジン -Name[kk]=Aurorae безендіру нақыш теігі -Name[km]=ម៉ាស៊ីន​ស្បែក​តុបតែង​ Aurorae -Name[kn]=ಅರೋರೆ ಪರಿಸರ ವಿನ್ಯಾಸ(ಥೀಮ್) ಎಂಜಿನ್ -Name[ko]=Aurorae 장식 테마 엔진 -Name[lt]=Aurorae dekoracijos temos variklis -Name[lv]=Aurorae dekorācijas tēmu dzinējs -Name[ml]=അറോറ അണിയിച്ചൊരുക്കാനുള്ള പ്രമേയ എഞ്ചിന്‍ -Name[mr]=ओरोरा सजावट शैली इंजिन -Name[nb]=Aurorae motor for dekorasjonstema -Name[nds]=Aurorae Dekoratschonen-Musterkarn -Name[nl]=Aurorae decoratiethema-engine -Name[nn]=Motor for pynting med temaet Aurorae -Name[pa]=ਔਰੋਰਾਈ ਸਜਾਵਟ ਥੀਮ ਇੰਜਣ -Name[pl]=Silnik zestawu ozdób Aurora -Name[pt]=Motor do Tema de Decoração Aurorae -Name[pt_BR]=Mecanismo do tema de decoração Aurorae -Name[ro]=Motor pentru tematici de decorare Aurorae -Name[ru]=Движок оформлений окон Aurorae -Name[si]=Aurorae සැරසිලි තේමා එන්ජිම -Name[sk]=Aurorae témy dekorácie -Name[sl]=Pogon Aurorae za teme okraskov -Name[sr]=Ауроре, тематски мотор декорација -Name[sr@ijekavian]=Ауроре, тематски мотор декорација -Name[sr@ijekavianlatin]=Aurore, tematski motor dekoracija -Name[sr@latin]=Aurore, tematski motor dekoracija -Name[sv]=Aurora dekorationstemagränssnitt -Name[tg]=Системаи мавзӯъҳои аврора -Name[th]=กลไกชุดตกแต่ง Aurorae -Name[tr]=Aurorae Dekorasyon Teması Motoru -Name[ug]=Aurorae زىننەتلەش ئۆرنەك ماتورى -Name[uk]=Рушій декорації тем Aurorae -Name[vi]=Cơ chế sắc thái trang trí Aurorae -Name[wa]=Moteur di tinme di gåyotaedje Aurorae -Name[x-test]=xxAurorae Decoration Theme Enginexx -Name[zh_CN]=Aurorae 装饰主题引擎 -Name[zh_TW]=Aurorae 裝飾主題引擎 -X-KDE-Library=kwin3_aurorae diff --git a/kwin/clients/aurorae/src/aurorae.h b/kwin/clients/aurorae/src/aurorae.h deleted file mode 100644 index 47e821e2..00000000 --- a/kwin/clients/aurorae/src/aurorae.h +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************** -Copyright (C) 2009, 2010, 2012 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef AURORAE_H -#define AURORAE_H - -#include "themeconfig.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -class KConfig; -class KConfigGroup; - -namespace Aurorae -{ -class AuroraeTheme; -class AuroraeClient; - -class AuroraeFactory : public QObject, public KDecorationFactory -{ - Q_OBJECT -public: - ~AuroraeFactory(); - - static AuroraeFactory* instance(); - bool reset(unsigned long changed); - KDecoration *createDecoration(KDecorationBridge*); - bool supports(Ability ability) const; - virtual QList< BorderSize > borderSizes() const; - - AuroraeTheme *theme() const { - return m_theme; - } - QDeclarativeItem *createQmlDecoration(AuroraeClient *client); - const QString ¤tThemeName() const { - return m_themeName; - } - -private: - enum EngineType { - AuroraeEngine, - QMLEngine - }; - AuroraeFactory(); - void init(); - void initAurorae(KConfig &conf, KConfigGroup &group); - void initQML(const KConfigGroup& group); - -Q_SIGNALS: - void buttonsChanged(); - void titleFontChanged(); - void configChanged(); - -private: - static AuroraeFactory *s_instance; - - AuroraeTheme *m_theme; - QDeclarativeEngine *m_engine; - QDeclarativeComponent *m_component; - EngineType m_engineType; - QString m_themeName; -}; - -class AuroraeClient : public KDecoration -{ - Q_OBJECT - Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) - Q_PROPERTY(QString caption READ caption NOTIFY captionChanged) - Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged) - Q_PROPERTY(QRect geometry READ geometry) - Q_PROPERTY(int height READ height) - Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) - Q_PROPERTY(bool closeable READ isCloseable CONSTANT) - Q_PROPERTY(bool maximizeable READ isMaximizable CONSTANT) - Q_PROPERTY(bool minimizeable READ isMinimizable CONSTANT) - Q_PROPERTY(bool modal READ isModal) - Q_PROPERTY(bool moveable READ isMovable CONSTANT) - Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged) - Q_PROPERTY(bool preview READ isPreview CONSTANT) - Q_PROPERTY(bool resizeable READ isResizable CONSTANT) - Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged) - Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged) - Q_PROPERTY(bool shadeable READ isShadeable) - Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChangedWrapper) - Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper) - Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizeChanged) - Q_PROPERTY(bool providesContextHelp READ providesContextHelp) - Q_PROPERTY(QRect transparentRect READ transparentRect) - Q_PROPERTY(int width READ width) - Q_PROPERTY(qulonglong windowId READ windowId CONSTANT) - Q_PROPERTY(int doubleClickInterval READ doubleClickInterval) - Q_PROPERTY(bool animationsSupported READ animationsSupported CONSTANT) - // TODO: window tabs - they suck for dynamic features -public: - AuroraeClient(KDecorationBridge* bridge, KDecorationFactory* factory); - virtual ~AuroraeClient(); - virtual bool eventFilter(QObject *object, QEvent *event); - virtual void activeChange(); - virtual void borders(int& left, int& right, int& top, int& bottom) const; - virtual void captionChange(); - virtual void desktopChange(); - virtual void iconChange(); - virtual void init(); - virtual void maximizeChange(); - virtual QSize minimumSize() const; - virtual Position mousePosition(const QPoint& p) const; - virtual void resize(const QSize& s); - virtual void shadeChange(); - // optional overrides - virtual void padding(int &left, int &right, int &top, int &bottom) const; - virtual void reset(long unsigned int changed); - bool isMaximized() const; - int doubleClickInterval() const; - - bool animationsSupported() const; - - Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant()); - -Q_SIGNALS: - void activeChanged(); - void captionChanged(); - void desktopChanged(); - void iconChanged(); - void maximizeChanged(); - void shadeChanged(); - void keepAboveChangedWrapper(); - void keepBelowChangedWrapper(); - void buttonsChanged(); - /** - * Signal emitted when the decoration's configuration might have changed. - * A decoration could reload it's configuration when this signal is emitted. - **/ - void configChanged(); - void fontChanged(); - -public slots: - void menuClicked(); - void toggleShade(); - void toggleKeepAbove(); - void toggleKeepBelow(); - void titlePressed(int button, int buttons); - void titleReleased(int button, int buttons); - void titleMouseMoved(int button, int buttons); - void titlePressed(Qt::MouseButton button, Qt::MouseButtons buttons); - void titleReleased(Qt::MouseButton button, Qt::MouseButtons buttons); - void titleMouseMoved(Qt::MouseButton button, Qt::MouseButtons buttons); - void closeWindow(); - void titlebarDblClickOperation(); - void maximize(int button); - - QRegion region(KDecorationDefines::Region r); - -private slots: - void themeChanged(); - void doCloseWindow(); - void doTitlebarDblClickOperation(); - void doMaximzie(int button); - void slotAlphaChanged(); - -private: - void sizesFromBorders(const QObject *borders, int &left, int &right, int &top, int &bottom) const; - QGraphicsView *m_view; - QGraphicsScene *m_scene; - QDeclarativeItem *m_item; -}; - -} - -#endif diff --git a/kwin/clients/aurorae/src/colorhelper.cpp b/kwin/clients/aurorae/src/colorhelper.cpp deleted file mode 100644 index 81e206fc..00000000 --- a/kwin/clients/aurorae/src/colorhelper.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "colorhelper.h" - -#include -#include - -ColorHelper::ColorHelper(QObject *parent) - : QObject(parent) -{ -} - -ColorHelper::~ColorHelper() -{ -} - -QColor ColorHelper::shade(const QColor &color, ColorHelper::ShadeRole role) -{ - return KColorScheme::shade(color, static_cast(role)); -} - -QColor ColorHelper::shade(const QColor &color, ColorHelper::ShadeRole role, qreal contrast) -{ - return KColorScheme::shade(color, static_cast(role), contrast); -} - -qreal ColorHelper::contrast() const -{ - return KGlobalSettings::contrastF(); -} - -QColor ColorHelper::multiplyAlpha(const QColor &color, qreal alpha) -{ - QColor retCol(color); - retCol.setAlphaF(color.alphaF() * alpha); - return retCol; -} - -QColor ColorHelper::background(bool active, ColorHelper::BackgroundRole role) const -{ - KColorScheme kcs(active ? QPalette::Active : QPalette::Inactive, KColorScheme::Button); - return kcs.background(static_cast(role)).color(); -} - -QColor ColorHelper::foreground(bool active, ColorHelper::ForegroundRole role) const -{ - KColorScheme kcs(active ? QPalette::Active : QPalette::Inactive, KColorScheme::Button); - return kcs.foreground(static_cast(role)).color(); -} - -#include "moc_colorhelper.cpp" diff --git a/kwin/clients/aurorae/src/colorhelper.h b/kwin/clients/aurorae/src/colorhelper.h deleted file mode 100644 index 6282321c..00000000 --- a/kwin/clients/aurorae/src/colorhelper.h +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef COLOR_HELPER_H -#define COLOR_HELPER_H - -#include -#include - -/** - * @short Helper to manipulate colors. - * - * Exports a few functions from KColorScheme. - **/ -class ColorHelper : public QObject -{ - Q_OBJECT - Q_ENUMS(ShadeRole) - Q_ENUMS(ForegroundRole) - Q_ENUMS(BackgroundRole) - /** - * Same as KGlobalSettings::contrastF. - **/ - Q_PROPERTY(qreal contrast READ contrast CONSTANT) -public: - explicit ColorHelper(QObject *parent = 0); - ~ColorHelper(); - /** - * This enumeration describes the color shade being selected from the given - * set. - * - * Color shades are used to draw "3d" elements, such as frames and bevels. - * They are neither foreground nor background colors. Text should not be - * painted over a shade, and shades should not be used to draw text. - */ - enum ShadeRole { - /** - * The light color is lighter than dark() or shadow() and contrasts - * with the base color. - */ - LightShade, - /** - * The midlight color is in between base() and light(). - */ - MidlightShade, - /** - * The mid color is in between base() and dark(). - */ - MidShade, - /** - * The dark color is in between mid() and shadow(). - */ - DarkShade, - /** - * The shadow color is darker than light() or midlight() and contrasts - * the base color. - */ - ShadowShade - }; - /** - * This enumeration describes the background color being selected from the - * given set. - * - * Background colors are suitable for drawing under text, and should never - * be used to draw text. In combination with one of the overloads of - * KColorScheme::shade, they may be used to generate colors for drawing - * frames, bevels, and similar decorations. - */ - enum BackgroundRole { - /** - * Normal background. - */ - NormalBackground = 0, - /** - * Alternate background; for example, for use in lists. - * - * This color may be the same as BackgroundNormal, especially in sets - * other than View and Window. - */ - AlternateBackground = 1, - /** - * Third color; for example, items which are new, active, requesting - * attention, etc. - * - * Alerting the user that a certain field must be filled out would be a - * good usage (although NegativeBackground could be used to the same - * effect, depending on what you are trying to achieve). Unlike - * ActiveText, this should not be used for mouseover effects. - */ - ActiveBackground = 2, - /** - * Fourth color; corresponds to (unvisited) links. - * - * Exactly what this might be used for is somewhat harder to qualify; - * it might be used for bookmarks, as a 'you can click here' indicator, - * or to highlight recent content (i.e. in a most-recently-accessed - * list). - */ - LinkBackground = 3, - /** - * Fifth color; corresponds to visited links. - * - * This can also be used to indicate "not recent" content, especially - * when a color is needed to denote content which is "old" or - * "archival". - */ - VisitedBackground = 4, - /** - * Sixth color; for example, errors, untrusted content, etc. - */ - NegativeBackground = 5, - /** - * Seventh color; for example, warnings, secure/encrypted content. - */ - NeutralBackground = 6, - /** - * Eigth color; for example, success messages, trusted content. - */ - PositiveBackground = 7 - }; - - /** - * This enumeration describes the foreground color being selected from the - * given set. - * - * Foreground colors are suitable for drawing text or glyphs (such as the - * symbols on window decoration buttons, assuming a suitable background - * brush is used), and should never be used to draw backgrounds. - * - * For window decorations, the following is suggested, but not set in - * stone: - * @li Maximize - PositiveText - * @li Minimize - NeutralText - * @li Close - NegativeText - * @li WhatsThis - LinkText - * @li Sticky - ActiveText - */ - enum ForegroundRole { - /** - * Normal foreground. - */ - NormalText = 0, - /** - * Second color; for example, comments, items which are old, inactive - * or disabled. Generally used for things that are meant to be "less - * important". InactiveText is not the same role as NormalText in the - * inactive state. - */ - InactiveText = 1, - /** - * Third color; for example items which are new, active, requesting - * attention, etc. May be used as a hover color for clickable items. - */ - ActiveText = 2, - /** - * Fourth color; use for (unvisited) links. May also be used for other - * clickable items or content that indicates relationships, items that - * indicate somewhere the user can visit, etc. - */ - LinkText = 3, - /** - * Fifth color; used for (visited) links. As with LinkText, may be used - * for items that have already been "visited" or accessed. May also be - * used to indicate "historical" (i.e. "old") items or information, - * especially if InactiveText is being used in the same context to - * express something different. - */ - VisitedText = 4, - /** - * Sixth color; for example, errors, untrusted content, deletions, - * etc. - */ - NegativeText = 5, - /** - * Seventh color; for example, warnings, secure/encrypted content. - */ - NeutralText = 6, - /** - * Eigth color; for example, additions, success messages, trusted - * content. - */ - PositiveText = 7 - }; - /** - * Retrieve the requested shade color, using the specified color as the - * base color and the system contrast setting. - * - * @note Shades are chosen such that all shades would contrast with the - * base color. This means that if base is very dark, the 'dark' shades will - * be lighter than the base color, with midlight() == shadow(). - * Conversely, if the base color is very light, the 'light' shades will be - * darker than the base color, with light() == mid(). - */ - Q_INVOKABLE QColor shade(const QColor& color, ShadeRole role); - Q_INVOKABLE QColor shade(const QColor& color, ShadeRole role, qreal contrast); /** - * Retrieve the requested shade color, using the specified color as the - * base color and the specified contrast. - * - * @param contrast Amount roughly specifying the contrast by which to - * adjust the base color, between -1.0 and 1.0 (values between 0.0 and 1.0 - * correspond to the value from KGlobalSettings::contrastF) - * - * @note Shades are chosen such that all shades would contrast with the - * base color. This means that if base is very dark, the 'dark' shades will - * be lighter than the base color, with midlight() == shadow(). - * Conversely, if the base color is very light, the 'light' shades will be - * darker than the base color, with light() == mid(). - * - * @see KColorUtils::shade - */ - Q_INVOKABLE QColor multiplyAlpha(const QColor& color, qreal alpha); - /** - * Retrieve the requested background brush's color for the @p active button. - * @param active Whether the active or inactive palette should be used. - */ - Q_INVOKABLE QColor background(bool active, BackgroundRole role = NormalBackground) const; - - /** - * Retrieve the requested foreground brush's color for the @p active button. - * @param active Whether the active or inactive palette should be used. - */ - Q_INVOKABLE QColor foreground(bool active, ForegroundRole role = NormalText) const; - - qreal contrast() const; -}; - -#endif diff --git a/kwin/clients/aurorae/src/decorationoptions.cpp b/kwin/clients/aurorae/src/decorationoptions.cpp deleted file mode 100644 index 90530aaa..00000000 --- a/kwin/clients/aurorae/src/decorationoptions.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "decorationoptions.h" -#include - -namespace KWin -{ - -DecorationOptions::DecorationOptions(QObject *parent) - : QObject(parent) - , m_active(true) - , m_decoration(NULL) -{ - connect(this, SIGNAL(decorationChanged()), SLOT(slotActiveChanged())); - connect(this, SIGNAL(decorationChanged()), SIGNAL(colorsChanged())); - connect(this, SIGNAL(decorationChanged()), SIGNAL(fontChanged())); -} - -DecorationOptions::~DecorationOptions() -{ -} - -QColor DecorationOptions::borderColor() const -{ - return KDecoration::options()->color(KDecorationDefines::ColorFrame, m_active); -} - -QColor DecorationOptions::buttonColor() const -{ - return KDecoration::options()->color(KDecorationDefines::ColorButtonBg, m_active); -} - -QColor DecorationOptions::fontColor() const -{ - return KDecoration::options()->color(KDecorationDefines::ColorFont, m_active); -} - -QColor DecorationOptions::resizeHandleColor() const -{ - return KDecoration::options()->color(KDecorationDefines::ColorHandle, m_active); -} - -QColor DecorationOptions::titleBarBlendColor() const -{ - return KDecoration::options()->color(KDecorationDefines::ColorTitleBlend, m_active); -} - -QColor DecorationOptions::titleBarColor() const -{ - return KDecoration::options()->color(KDecorationDefines::ColorTitleBar, m_active); -} - -QFont DecorationOptions::titleFont() const -{ - return KDecoration::options()->font(m_active); -} - -QString DecorationOptions::titleButtonsLeft() const -{ - if (KDecoration::options()->customButtonPositions()) { - return KDecoration::options()->titleButtonsLeft(); - } else { - return KDecorationOptions::defaultTitleButtonsLeft(); - } -} - -QString DecorationOptions::titleButtonsRight() const -{ - if (KDecoration::options()->customButtonPositions()) { - return KDecoration::options()->titleButtonsRight(); - } else { - return KDecorationOptions::defaultTitleButtonsRight(); - } -} - -QObject *DecorationOptions::decoration() const -{ - return m_decoration; -} - -void DecorationOptions::setDecoration(QObject *decoration) -{ - if (m_decoration == decoration) { - return; - } - if (m_decoration) { - // disconnect from existing decoration - disconnect(m_decoration, SIGNAL(activeChanged()), this, SLOT(slotActiveChanged())); - disconnect(m_decoration, SIGNAL(buttonsChanged()), this, SIGNAL(titleButtonsChanged())); - disconnect(m_decoration, SIGNAL(fontChanged()), this, SIGNAL(fontChanged())); - } - m_decoration = decoration; - connect(m_decoration, SIGNAL(activeChanged()), SLOT(slotActiveChanged())); - connect(m_decoration, SIGNAL(buttonsChanged()), SIGNAL(titleButtonsChanged())); - connect(m_decoration, SIGNAL(fontChanged()), SIGNAL(fontChanged())); - emit decorationChanged(); -} - -void DecorationOptions::slotActiveChanged() -{ - if (!m_decoration) { - return; - } - if (m_active == m_decoration->property("active").toBool()) { - return; - } - m_active = m_decoration->property("active").toBool(); - emit colorsChanged(); - emit fontChanged(); -} - -Borders::Borders(QObject *parent) - : QObject(parent) - , m_left(0) - , m_right(0) - , m_top(0) - , m_bottom(0) -{ -} - -Borders::~Borders() -{ -} - -#define SETTER( methodName, name ) \ -void Borders::methodName(int name) \ -{ \ - if (m_##name == name) { \ - return; \ - } \ - m_##name = name; \ - emit name##Changed(); \ -} - -SETTER(setLeft, left) -SETTER(setRight, right) -SETTER(setTop, top) -SETTER(setBottom, bottom) - -#undef SETTER - -void Borders::setAllBorders(int border) -{ - setBorders(border); - setTitle(border); -} - -void Borders::setBorders(int border) -{ - setSideBorders(border); - setBottom(border); -} - -void Borders::setSideBorders(int border) -{ - setLeft(border); - setRight(border); -} - -void Borders::setTitle(int value) -{ - setTop(value); -} - -} // namespace - -#include "moc_decorationoptions.cpp" diff --git a/kwin/clients/aurorae/src/decorationoptions.h b/kwin/clients/aurorae/src/decorationoptions.h deleted file mode 100644 index 34bb606d..00000000 --- a/kwin/clients/aurorae/src/decorationoptions.h +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_DECORATION_OPTIONS_H -#define KWIN_DECORATION_OPTIONS_H - -#include -#include -#include - -namespace KWin -{ - -/** - * @short Common Window Decoration Options. - * - * This Class provides common window decoration options which can be used, but do not have to - * be used by a window decoration. The class provides properties for global settings such as - * color, font and decoration button position. - * - * If a window decoration wants to follow the global color scheme it should honor the values - * provided by the properties. - * - * In any case it makes sense to respect the font settings for the decoration as this is also - * an accessibility feature. - * - * In order to use the options in a QML based window decoration an instance of this object needs - * to be created and the as a context property available "decoration" needs to be passed to the - * DecorationOptions instance: - * - * @code - * DecorationOptions { - * id: options - * deco: decoration - * } - * @endcode - **/ -class DecorationOptions : public QObject -{ - Q_OBJECT - Q_ENUMS(BorderSize) - /** - * The decoration Object for which this set of options should be used. The decoration is - * required to get the correct colors and fonts depending on whether the decoration represents - * an active or inactive window. - * - * Best pass the decoration object available as a context property to this property. - **/ - Q_PROPERTY(QObject *deco READ decoration WRITE setDecoration NOTIFY decorationChanged) - /** - * The color for the titlebar depending on the decoration's active state. - **/ - Q_PROPERTY(QColor titleBarColor READ titleBarColor NOTIFY colorsChanged) - /** - * The blend color for the titlebar depending on the decoration's active state. - **/ - Q_PROPERTY(QColor titleBarBlendColor READ titleBarBlendColor NOTIFY colorsChanged) - /** - * The titlebar text color depending on the decoration's active state. - **/ - Q_PROPERTY(QColor fontColor READ fontColor NOTIFY colorsChanged) - /** - * The color to use for titlebar buttons depending on the decoration's active state. - **/ - Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY colorsChanged) - /** - * The color for the window frame (border) depending on the decoration's active state. - **/ - Q_PROPERTY(QColor borderColor READ borderColor NOTIFY colorsChanged) - /** - * The color for the resize handle depending on the decoration's active state. - **/ - Q_PROPERTY(QColor resizeHandleColor READ resizeHandleColor NOTIFY colorsChanged) - /** - * The font to be used for the decoration caption depending on the decoration's active state. - **/ - Q_PROPERTY(QFont titleFont READ titleFont NOTIFY fontChanged) - /** - * The buttons to be positioned on the left side of the titlebar from left to right. - * - * Characters in the returned string have the following meaning: - *
    - *
  • 'M' menu button
  • - *
  • 'S' on all desktops button
  • - *
  • 'H' quickhelp button
  • - *
  • 'I' minimize button
  • - *
  • 'A' maximize button
  • - *
  • 'X' close button
  • - *
  • 'F' keep above button
  • - *
  • 'B' keep below button
  • - *
  • 'L' shade button
  • - *
  • '_' explicit spacer
  • - *
- * @todo: make this a list of enum values - **/ - Q_PROPERTY(QString titleButtonsLeft READ titleButtonsLeft NOTIFY titleButtonsChanged) - /** - * The buttons to be positioned on the right side of the titlebar from left to right. - * @see titleButtonsRight - **/ - Q_PROPERTY(QString titleButtonsRight READ titleButtonsRight NOTIFY titleButtonsChanged) -public: - enum BorderSize { - BorderTiny, ///< Minimal borders - BorderNormal, ///< Standard size borders, the default setting - BorderLarge, ///< Larger borders - BorderVeryLarge, ///< Very large borders - BorderHuge, ///< Huge borders - BorderVeryHuge, ///< Very huge borders - BorderOversized, ///< Oversized borders - BorderNoSides, ///< No borders on sides - BorderNone ///< No borders except title - }; - explicit DecorationOptions(QObject *parent = 0); - virtual ~DecorationOptions(); - - QColor titleBarColor() const; - QColor titleBarBlendColor() const; - QColor fontColor() const; - QColor buttonColor() const; - QColor borderColor() const; - QColor resizeHandleColor() const; - QFont titleFont() const; - QString titleButtonsLeft() const; - QString titleButtonsRight() const; - QObject *decoration() const; - void setDecoration(QObject *decoration); - -signals: - void colorsChanged(); - void fontChanged(); - void decorationChanged(); - void titleButtonsChanged(); - -private slots: - void slotActiveChanged(); - -private: - bool m_active; - QObject *m_decoration; -}; - -class Borders : public QObject -{ - Q_OBJECT - Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged) - Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged) - Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) - Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged) -public: - Borders(QObject *parent = NULL); - virtual ~Borders(); - int left() const; - int right() const; - int top() const; - int bottom() const; - - void setLeft(int left); - void setRight(int right); - void setTop(int top); - void setBottom(int bottom); - -public Q_SLOTS: - /** - * Sets all four borders to @p value. - **/ - void setAllBorders(int value); - /** - * Sets all borders except the title border to @p value. - **/ - void setBorders(int value); - /** - * Sets the side borders (e.g. if title is on top, the left and right borders) - * to @p value. - **/ - void setSideBorders(int value); - /** - * Sets the title border to @p value. - **/ - void setTitle(int value); - -Q_SIGNALS: - void leftChanged(); - void rightChanged(); - void topChanged(); - void bottomChanged(); - -private: - int m_left; - int m_right; - int m_top; - int m_bottom; -}; - -#define GETTER( name ) \ -inline int Borders::name() const \ -{ \ - return m_##name;\ -}\ - -GETTER(left) -GETTER(right) -GETTER(top) -GETTER(bottom) - -#undef GETTER - -} // namespace -#endif // KWIN_DECORATION_OPTIONS_H diff --git a/kwin/clients/aurorae/src/decorationplugin.cpp b/kwin/clients/aurorae/src/decorationplugin.cpp deleted file mode 100644 index f7e8cd3b..00000000 --- a/kwin/clients/aurorae/src/decorationplugin.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "decorationplugin.h" -#include "colorhelper.h" -#include "decorationoptions.h" -#include - -Q_EXPORT_PLUGIN(DecorationPlugin) - -void DecorationPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.kwin.decoration")); - qmlRegisterType(uri, 0, 1, "ColorHelper"); - qmlRegisterType(uri, 0, 1, "DecorationOptions"); - qmlRegisterType(uri, 0, 1, "Borders"); -} - -#include "moc_decorationplugin.cpp" diff --git a/kwin/clients/aurorae/src/decorationplugin.h b/kwin/clients/aurorae/src/decorationplugin.h deleted file mode 100644 index 0a9ef7c3..00000000 --- a/kwin/clients/aurorae/src/decorationplugin.h +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef DECORATION_PLUGIN_H -#define DECORATION_PLUGIN_H -#include - -class DecorationPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - void registerTypes(const char *uri); -}; - -#endif diff --git a/kwin/clients/aurorae/src/kwindecoration.desktop b/kwin/clients/aurorae/src/kwindecoration.desktop deleted file mode 100644 index 691f8a13..00000000 --- a/kwin/clients/aurorae/src/kwindecoration.desktop +++ /dev/null @@ -1,53 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=KWin/Decoration - -Comment=KWin Window Decoration -Comment[bs]=KWin Dekoracije prozora -Comment[ca]=Decoració de finestres del KWin -Comment[ca@valencia]=Decoració de finestres del KWin -Comment[cs]=Dekorace oken KWin -Comment[da]=KWin vinduesdekoration -Comment[de]=KWin-Fensterdekoration -Comment[el]=Διακοσμήσεις παραθύρου KWin -Comment[en_GB]=KWin Window Decoration -Comment[es]=Decoración de ventanas de KWin -Comment[et]=KWini akna dekoratsioon -Comment[eu]=KWin leihoen apainketa -Comment[fi]=KWin-ikkunan kehys -Comment[fr]=Décorations de fenêtres KWin -Comment[ga]=Maisiúchán Fuinneog KWin -Comment[gl]=Decoración de xanela de Kwin -Comment[he]=קישוטי חלון -Comment[hu]=KWin ablakdekoráció -Comment[ia]=Decorationes de fenestra de KWin -Comment[is]=KWin gluggaskreytingar -Comment[it]=Decorazione delle finestre di KWin -Comment[kk]=KWin терезе безендіруі -Comment[ko]=KWin 창 장식 -Comment[lt]=KWin lango dekoracija -Comment[mr]=के-विन चौकट सजावट -Comment[nb]=KWin Vinduspynt -Comment[nds]=KWin-Finsterdekoratschoon -Comment[nl]=KWin vensterdecoratie -Comment[pa]=ਕੇਵਿੰਨ ਵਿੰਡੋ ਸਜਾਵਟ -Comment[pl]=Wystrój okien KWin -Comment[pt]=Decoração das Janelas do KWin -Comment[pt_BR]=Decorações de janelas do KWin -Comment[ro]=Decorații de fereastră KWin -Comment[ru]=Оформление окон KWin -Comment[sk]=Dekorácie okien KWin -Comment[sl]=Okraski oken KWin -Comment[sr]=К‑винова декорација прозора -Comment[sr@ijekavian]=К‑винова декорација прозора -Comment[sr@ijekavianlatin]=KWinova dekoracija prozora -Comment[sr@latin]=KWinova dekoracija prozora -Comment[sv]=Kwin-fönsterdekorationer -Comment[tr]=KWin Pencere Dekorasyonu -Comment[uk]=Обрамлення вікон KWin -Comment[x-test]=xxKWin Window Decorationxx -Comment[zh_CN]=KWin 窗口装饰 -Comment[zh_TW]=KWin 視窗裝飾 - -[PropertyDef::X-Plasma-MainScript] -Type=QString diff --git a/kwin/clients/aurorae/src/lib/auroraetheme.cpp b/kwin/clients/aurorae/src/lib/auroraetheme.cpp deleted file mode 100644 index d3c265a9..00000000 --- a/kwin/clients/aurorae/src/lib/auroraetheme.cpp +++ /dev/null @@ -1,512 +0,0 @@ -/* - Library for Aurorae window decoration themes. - Copyright (C) 2009, 2010, 2012 Martin Gräßlin - - 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 "auroraetheme.h" -#include "themeconfig.h" -// Qt -#include -// KDE -#include -#include -#include -#include -#include - -namespace Aurorae { - -/************************************************ -* AuroraeThemePrivate -************************************************/ -class AuroraeThemePrivate -{ -public: - AuroraeThemePrivate(); - ~AuroraeThemePrivate(); - void initButtonFrame(AuroraeButtonType type); - QString themeName; - Aurorae::ThemeConfig themeConfig; - QHash< AuroraeButtonType, QString > pathes; - bool activeCompositing; - KDecorationDefines::BorderSize borderSize; - KDecorationDefines::BorderSize buttonSize; - QString dragMimeType; - QString decorationPath; -}; - -AuroraeThemePrivate::AuroraeThemePrivate() - :activeCompositing(true) - , borderSize(KDecoration::BorderNormal) - , buttonSize(KDecoration::BorderNormal) -{ -} - -AuroraeThemePrivate::~AuroraeThemePrivate() -{ -} - -void AuroraeThemePrivate::initButtonFrame(AuroraeButtonType type) -{ - QString file("aurorae/themes/" + themeName + '/' + AuroraeTheme::mapButtonToName(type) + ".svg"); - QString path = KGlobal::dirs()->findResource("data", file); - if (path.isEmpty()) { - // let's look for svgz - file.append("z"); - path = KGlobal::dirs()->findResource("data", file); - } - if (!path.isEmpty()) { - pathes[ type ] = path; - } else { - kDebug(1216) << "No button for: " << AuroraeTheme::mapButtonToName(type); - } -} - -/************************************************ -* AuroraeTheme -************************************************/ -AuroraeTheme::AuroraeTheme(QObject* parent) - : QObject(parent) - , d(new AuroraeThemePrivate) -{ - connect(this, SIGNAL(themeChanged()), SIGNAL(borderSizesChanged())); - connect(this, SIGNAL(buttonSizesChanged()), SIGNAL(borderSizesChanged())); -} - -AuroraeTheme::~AuroraeTheme() -{ - delete d; -} - -bool AuroraeTheme::isValid() const -{ - return !d->themeName.isNull(); -} - -void AuroraeTheme::loadTheme(const QString &name) -{ - KConfig conf("auroraerc"); - KConfig config("aurorae/themes/" + name + '/' + name + "rc", KConfig::FullConfig, "data"); - KConfigGroup themeGroup(&conf, name); - loadTheme(name, config); - setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry("BorderSize", KDecorationDefines::BorderNormal)); - setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry("ButtonSize", KDecorationDefines::BorderNormal)); -} - -void AuroraeTheme::loadTheme(const QString &name, const KConfig &config) -{ - d->themeName = name; - QString file("aurorae/themes/" + d->themeName + "/decoration.svg"); - QString path = KGlobal::dirs()->findResource("data", file); - if (path.isEmpty()) { - file += 'z'; - path = KGlobal::dirs()->findResource("data", file); - } - if (path.isEmpty()) { - kDebug(1216) << "Could not find decoration svg: aborting"; - d->themeName.clear(); - return; - } - d->decorationPath = path; - - // load the buttons - d->initButtonFrame(MinimizeButton); - d->initButtonFrame(MaximizeButton); - d->initButtonFrame(RestoreButton); - d->initButtonFrame(CloseButton); - d->initButtonFrame(AllDesktopsButton); - d->initButtonFrame(KeepAboveButton); - d->initButtonFrame(KeepBelowButton); - d->initButtonFrame(ShadeButton); - d->initButtonFrame(HelpButton); - - d->themeConfig.load(config); - emit themeChanged(); -} - -bool AuroraeTheme::hasButton(AuroraeButtonType button) const -{ - return d->pathes.contains(button); -} - -QLatin1String AuroraeTheme::mapButtonToName(AuroraeButtonType type) -{ - switch(type) { - case MinimizeButton: - return QLatin1String("minimize"); - case MaximizeButton: - return QLatin1String("maximize"); - case RestoreButton: - return QLatin1String("restore"); - case CloseButton: - return QLatin1String("close"); - case AllDesktopsButton: - return QLatin1String("alldesktops"); - case KeepAboveButton: - return QLatin1String("keepabove"); - case KeepBelowButton: - return QLatin1String("keepbelow"); - case ShadeButton: - return QLatin1String("shade"); - case HelpButton: - return QLatin1String("help"); - case MenuButton: - return QLatin1String("menu"); - default: - return QLatin1String(""); - } -} - -const QString &AuroraeTheme::themeName() const -{ - return d->themeName; -} - -void AuroraeTheme::borders(int& left, int& top, int& right, int& bottom, bool maximized) const -{ - const qreal titleHeight = qMax((qreal)d->themeConfig.titleHeight(), - d->themeConfig.buttonHeight()*buttonSizeFactor() + - d->themeConfig.buttonMarginTop()); - if (maximized) { - const qreal title = titleHeight + d->themeConfig.titleEdgeTopMaximized() + d->themeConfig.titleEdgeBottomMaximized(); - switch ((DecorationPosition)d->themeConfig.decorationPosition()) { - case DecorationTop: - left = right = bottom = 0; - top = title; - break; - case DecorationBottom: - left = right = top = 0; - bottom = title; - break; - case DecorationLeft: - top = right = bottom = 0; - left = title; - break; - case DecorationRight: - left = top = bottom = 0; - right = title; - break; - default: - left = right = bottom = top = 0; - break; - } - } else { - switch (d->borderSize) { - case KDecoration::BorderTiny: - // TODO: this looks wrong - if (isCompositingActive()) { - left = qMin(0, (int)left - d->themeConfig.borderLeft() - d->themeConfig.paddingLeft()); - right = qMin(0, (int)right - d->themeConfig.borderRight() - d->themeConfig.paddingRight()); - bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom() - d->themeConfig.paddingBottom()); - } else { - left = qMin(0, (int)left - d->themeConfig.borderLeft()); - right = qMin(0, (int)right - d->themeConfig.borderRight()); - bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom()); - } - break; - case KDecoration::BorderLarge: - left = right = bottom = top = 4; - break; - case KDecoration::BorderVeryLarge: - left = right = bottom = top = 8; - break; - case KDecoration::BorderHuge: - left = right = bottom = top = 12; - break; - case KDecoration::BorderVeryHuge: - left = right = bottom = top = 23; - break; - case KDecoration::BorderOversized: - left = right = bottom = top = 36; - break; - case KDecoration::BorderNormal: - default: - left = right = bottom = top = 0; - } - const qreal title = titleHeight + d->themeConfig.titleEdgeTop() + d->themeConfig.titleEdgeBottom(); - switch ((DecorationPosition)d->themeConfig.decorationPosition()) { - case DecorationTop: - left += d->themeConfig.borderLeft(); - right += d->themeConfig.borderRight(); - bottom += d->themeConfig.borderBottom(); - top = title; - break; - case DecorationBottom: - left += d->themeConfig.borderLeft(); - right += d->themeConfig.borderRight(); - bottom = title; - top += d->themeConfig.borderTop(); - break; - case DecorationLeft: - left = title; - right += d->themeConfig.borderRight(); - bottom += d->themeConfig.borderBottom(); - top += d->themeConfig.borderTop(); - break; - case DecorationRight: - left += d->themeConfig.borderLeft(); - right = title; - bottom += d->themeConfig.borderBottom(); - top += d->themeConfig.borderTop(); - break; - default: - left = right = bottom = top = 0; - break; - } - } -} - -int AuroraeTheme::bottomBorder() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, false); - return bottom; -} - -int AuroraeTheme::leftBorder() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, false); - return left; -} - -int AuroraeTheme::rightBorder() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, false); - return right; -} - -int AuroraeTheme::topBorder() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, false); - return top; -} - -int AuroraeTheme::bottomBorderMaximized() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, true); - return bottom; -} - -int AuroraeTheme::leftBorderMaximized() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, true); - return left; -} - -int AuroraeTheme::rightBorderMaximized() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, true); - return right; -} - -int AuroraeTheme::topBorderMaximized() const -{ - int left, top, right, bottom; - left = top = right = bottom = 0; - borders(left, top, right, bottom, true); - return top; -} - -void AuroraeTheme::padding(int& left, int& top, int& right, int& bottom) const -{ - left = d->themeConfig.paddingLeft(); - top = d->themeConfig.paddingTop(); - right = d->themeConfig.paddingRight(); - bottom = d->themeConfig.paddingBottom(); -} - -#define THEME_CONFIG( prototype ) \ -int AuroraeTheme::prototype ( ) const \ -{ \ - return d->themeConfig.prototype( ); \ -} - -THEME_CONFIG(paddingBottom) -THEME_CONFIG(paddingLeft) -THEME_CONFIG(paddingRight) -THEME_CONFIG(paddingTop) -THEME_CONFIG(buttonWidth) -THEME_CONFIG(buttonWidthMinimize) -THEME_CONFIG(buttonWidthMaximizeRestore) -THEME_CONFIG(buttonWidthClose) -THEME_CONFIG(buttonWidthAllDesktops) -THEME_CONFIG(buttonWidthKeepAbove) -THEME_CONFIG(buttonWidthKeepBelow) -THEME_CONFIG(buttonWidthShade) -THEME_CONFIG(buttonWidthHelp) -THEME_CONFIG(buttonWidthMenu) -THEME_CONFIG(buttonHeight) -THEME_CONFIG(buttonSpacing) -THEME_CONFIG(buttonMarginTop) -THEME_CONFIG(explicitButtonSpacer) -THEME_CONFIG(animationTime) -THEME_CONFIG(titleEdgeLeft) -THEME_CONFIG(titleEdgeRight) -THEME_CONFIG(titleEdgeTop) -THEME_CONFIG(titleEdgeLeftMaximized) -THEME_CONFIG(titleEdgeRightMaximized) -THEME_CONFIG(titleEdgeTopMaximized) -THEME_CONFIG(titleBorderLeft) -THEME_CONFIG(titleBorderRight) -THEME_CONFIG(titleHeight) - -#undef THEME_CONFIG - -#define THEME_CONFIG_TYPE( rettype, prototype ) \ -rettype AuroraeTheme::prototype ( ) const \ -{\ - return d->themeConfig.prototype(); \ -} - -THEME_CONFIG_TYPE(QColor, activeTextColor) -THEME_CONFIG_TYPE(QColor, inactiveTextColor) -THEME_CONFIG_TYPE(Qt::Alignment, alignment) -THEME_CONFIG_TYPE(Qt::Alignment, verticalAlignment) - -#undef THEME_CONFIG_TYPE - -QString AuroraeTheme::decorationPath() const -{ - return d->decorationPath; -} - -#define BUTTON_PATH( prototype, buttonType ) \ -QString AuroraeTheme::prototype ( ) const \ -{ \ - if (hasButton( buttonType )) { \ - return d->pathes[ buttonType ]; \ - } else { \ - return ""; \ - } \ -}\ - -BUTTON_PATH(minimizeButtonPath, MinimizeButton) -BUTTON_PATH(maximizeButtonPath, MaximizeButton) -BUTTON_PATH(restoreButtonPath, RestoreButton) -BUTTON_PATH(closeButtonPath, CloseButton) -BUTTON_PATH(allDesktopsButtonPath, AllDesktopsButton) -BUTTON_PATH(keepAboveButtonPath, KeepAboveButton) -BUTTON_PATH(keepBelowButtonPath, KeepBelowButton) -BUTTON_PATH(shadeButtonPath, ShadeButton) -BUTTON_PATH(helpButtonPath, HelpButton) - -#undef BUTTON_PATH - -void AuroraeTheme::titleEdges(int &left, int &top, int &right, int &bottom, bool maximized) const -{ - if (maximized) { - left = d->themeConfig.titleEdgeLeftMaximized(); - top = d->themeConfig.titleEdgeTopMaximized(); - right = d->themeConfig.titleEdgeRightMaximized(); - bottom = d->themeConfig.titleEdgeBottomMaximized(); - } else { - left = d->themeConfig.titleEdgeLeft(); - top = d->themeConfig.titleEdgeTop(); - right = d->themeConfig.titleEdgeRight(); - bottom = d->themeConfig.titleEdgeBottom(); - } -} - -bool AuroraeTheme::isCompositingActive() const -{ - return d->activeCompositing; -} - -void AuroraeTheme::setCompositingActive(bool active) -{ - d->activeCompositing = active; -} - -QString AuroraeTheme::defaultButtonsLeft() const -{ - return d->themeConfig.defaultButtonsLeft(); -} - -QString AuroraeTheme::defaultButtonsRight() const -{ - return d->themeConfig.defaultButtonsRight(); -} - -void AuroraeTheme::setBorderSize(KDecorationDefines::BorderSize size) -{ - if (d->borderSize == size) { - return; - } - d->borderSize = size; - emit borderSizesChanged(); -} - -void AuroraeTheme::setButtonSize(KDecorationDefines::BorderSize size) -{ - if (d->buttonSize == size) { - return; - } - d->buttonSize = size; - emit buttonSizesChanged(); -} - -void AuroraeTheme::setTabDragMimeType(const QString &mime) -{ - d->dragMimeType = mime; -} - -const QString &AuroraeTheme::tabDragMimeType() const -{ - return d->dragMimeType; -} - -qreal AuroraeTheme::buttonSizeFactor() const -{ - switch (d->buttonSize) { - case KDecorationDefines::BorderTiny: - return 0.8; - case KDecorationDefines::BorderLarge: - return 1.2; - case KDecorationDefines::BorderVeryLarge: - return 1.4; - case KDecorationDefines::BorderHuge: - return 1.6; - case KDecorationDefines::BorderVeryHuge: - return 1.8; - case KDecorationDefines::BorderOversized: - return 2.0; - case KDecorationDefines::BorderNormal: // fall through - default: - return 1.0; - } -} - -DecorationPosition AuroraeTheme::decorationPosition() const -{ - return (DecorationPosition)d->themeConfig.decorationPosition(); -} - -} // namespace diff --git a/kwin/clients/aurorae/src/lib/auroraetheme.h b/kwin/clients/aurorae/src/lib/auroraetheme.h deleted file mode 100644 index ad013b84..00000000 --- a/kwin/clients/aurorae/src/lib/auroraetheme.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - Library for Aurorae window decoration themes. - Copyright (C) 2009, 2010, 2012 Martin Gräßlin - - 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 AURORAETHEME_H -#define AURORAETHEME_H - -// #include "libaurorae_export.h" - -#include -#include - -class KConfig; - -namespace Aurorae { -class AuroraeThemePrivate; -class ThemeConfig; - -enum AuroraeButtonType { - MinimizeButton = 0, - MaximizeButton, - RestoreButton, - CloseButton, - AllDesktopsButton, - KeepAboveButton, - KeepBelowButton, - ShadeButton, - HelpButton, - MenuButton -}; - -enum DecorationPosition { - DecorationTop = 0, - DecorationLeft, - DecorationRight, - DecorationBottom -}; - -class /*LIBAURORAE_EXPORT*/ AuroraeTheme : public QObject -{ - Q_OBJECT - Q_PROPERTY(int borderLeft READ leftBorder NOTIFY borderSizesChanged) - Q_PROPERTY(int borderRight READ rightBorder NOTIFY borderSizesChanged) - Q_PROPERTY(int borderTop READ topBorder NOTIFY borderSizesChanged) - Q_PROPERTY(int borderBottom READ bottomBorder NOTIFY borderSizesChanged) - Q_PROPERTY(int borderLeftMaximized READ leftBorderMaximized NOTIFY borderSizesChanged) - Q_PROPERTY(int borderRightMaximized READ rightBorderMaximized NOTIFY borderSizesChanged) - Q_PROPERTY(int borderTopMaximized READ topBorderMaximized NOTIFY borderSizesChanged) - Q_PROPERTY(int borderBottomMaximized READ bottomBorderMaximized NOTIFY borderSizesChanged) - Q_PROPERTY(int paddingLeft READ paddingLeft NOTIFY themeChanged) - Q_PROPERTY(int paddingRight READ paddingRight NOTIFY themeChanged) - Q_PROPERTY(int paddingTop READ paddingTop NOTIFY themeChanged) - Q_PROPERTY(int paddingBottom READ paddingBottom NOTIFY themeChanged) - Q_PROPERTY(QString themeName READ themeName NOTIFY themeChanged) - Q_PROPERTY(int buttonHeight READ buttonHeight NOTIFY themeChanged) - Q_PROPERTY(int buttonWidth READ buttonWidth NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthMinimize READ buttonWidthMinimize NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthMaximizeRestore READ buttonWidthMaximizeRestore NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthClose READ buttonWidthClose NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthAllDesktops READ buttonWidthAllDesktops NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthKeepAbove READ buttonWidthKeepAbove NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthKeepBelow READ buttonWidthKeepBelow NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthShade READ buttonWidthShade NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthHelp READ buttonWidthHelp NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthMenu READ buttonWidthMenu NOTIFY themeChanged) - Q_PROPERTY(int buttonSpacing READ buttonSpacing NOTIFY themeChanged) - Q_PROPERTY(int buttonMarginTop READ buttonMarginTop NOTIFY themeChanged) - Q_PROPERTY(int explicitButtonSpacer READ explicitButtonSpacer NOTIFY themeChanged) - Q_PROPERTY(qreal buttonSizeFactor READ buttonSizeFactor NOTIFY buttonSizesChanged) - Q_PROPERTY(int animationTime READ animationTime NOTIFY themeChanged) - Q_PROPERTY(int titleEdgeLeft READ titleEdgeLeft NOTIFY themeChanged) - Q_PROPERTY(int titleEdgeRight READ titleEdgeRight NOTIFY themeChanged) - Q_PROPERTY(int titleEdgeTop READ titleEdgeTop NOTIFY themeChanged) - Q_PROPERTY(int titleEdgeLeftMaximized READ titleEdgeLeftMaximized NOTIFY themeChanged) - Q_PROPERTY(int titleEdgeRightMaximized READ titleEdgeRightMaximized NOTIFY themeChanged) - Q_PROPERTY(int titleEdgeTopMaximized READ titleEdgeTopMaximized NOTIFY themeChanged) - Q_PROPERTY(int titleBorderRight READ titleBorderRight NOTIFY themeChanged) - Q_PROPERTY(int titleBorderLeft READ titleBorderLeft NOTIFY themeChanged) - Q_PROPERTY(int titleHeight READ titleHeight NOTIFY themeChanged) - Q_PROPERTY(QString decorationPath READ decorationPath NOTIFY themeChanged) - Q_PROPERTY(QString minimizeButtonPath READ minimizeButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString maximizeButtonPath READ maximizeButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString restoreButtonPath READ restoreButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString closeButtonPath READ closeButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString allDesktopsButtonPath READ allDesktopsButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString keepAboveButtonPath READ keepAboveButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString keepBelowButtonPath READ keepBelowButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString shadeButtonPath READ shadeButtonPath NOTIFY themeChanged) - Q_PROPERTY(QString helpButtonPath READ helpButtonPath NOTIFY themeChanged) - Q_PROPERTY(QColor activeTextColor READ activeTextColor NOTIFY themeChanged) - Q_PROPERTY(QColor inactiveTextColor READ inactiveTextColor NOTIFY themeChanged) - Q_PROPERTY(Qt::Alignment horizontalAlignment READ alignment NOTIFY themeChanged) - Q_PROPERTY(Qt::Alignment verticalAlignment READ verticalAlignment NOTIFY themeChanged) - Q_PROPERTY(QString defaultButtonsLeft READ defaultButtonsLeft NOTIFY themeChanged) - Q_PROPERTY(QString defaultButtonsRight READ defaultButtonsRight NOTIFY themeChanged) -public: - explicit AuroraeTheme(QObject* parent = 0); - virtual ~AuroraeTheme(); - // TODO: KSharedConfigPtr - void loadTheme(const QString &name, const KConfig &config); - bool isValid() const; - const QString &themeName() const; - int leftBorder() const; - int rightBorder() const; - int topBorder() const; - int bottomBorder() const; - int leftBorderMaximized() const; - int rightBorderMaximized() const; - int topBorderMaximized() const; - int bottomBorderMaximized() const; - int paddingLeft() const; - int paddingRight() const; - int paddingTop() const; - int paddingBottom() const; - int buttonWidth() const; - int buttonWidthMinimize() const; - int buttonWidthMaximizeRestore() const; - int buttonWidthClose() const; - int buttonWidthAllDesktops() const; - int buttonWidthKeepAbove() const; - int buttonWidthKeepBelow() const; - int buttonWidthShade() const; - int buttonWidthHelp() const; - int buttonWidthMenu() const; - int buttonHeight() const; - int buttonSpacing() const; - int buttonMarginTop() const; - int explicitButtonSpacer() const; - int animationTime() const; - int titleEdgeLeft() const; - int titleEdgeRight() const; - int titleEdgeTop() const; - int titleEdgeLeftMaximized() const; - int titleEdgeRightMaximized() const; - int titleEdgeTopMaximized() const; - int titleBorderLeft() const; - int titleBorderRight() const; - int titleHeight() const; - QString decorationPath() const; - QString minimizeButtonPath() const; - QString maximizeButtonPath() const; - QString restoreButtonPath() const; - QString closeButtonPath() const; - QString allDesktopsButtonPath() const; - QString keepAboveButtonPath() const; - QString keepBelowButtonPath() const; - QString shadeButtonPath() const; - QString helpButtonPath() const; - QColor activeTextColor() const; - QColor inactiveTextColor() const; - Qt::Alignment alignment() const; - Qt::Alignment verticalAlignment() const; - /** - * Sets the title edges according to maximized state. - * Title edges are global to all windows. - */ - void titleEdges(int &left, int &top, int &right, int &bottom, bool maximized) const; - void setCompositingActive(bool active); - bool isCompositingActive() const; - - /** - * @returns true if the theme contains a FrameSvg for specified button. - */ - bool hasButton(AuroraeButtonType button) const; - QString defaultButtonsLeft() const; - QString defaultButtonsRight() const; - void setBorderSize(KDecorationDefines::BorderSize size); - /** - * Sets the size of the buttons. - * The available sizes are identical to border sizes, therefore BorderSize is used. - * @param size The buttons size - */ - void setButtonSize(KDecorationDefines::BorderSize size); - qreal buttonSizeFactor() const; - - DecorationPosition decorationPosition() const; - - void setTabDragMimeType(const QString &mime); - const QString &tabDragMimeType() const; - - // TODO: move to namespace - static QLatin1String mapButtonToName(AuroraeButtonType type); - -public Q_SLOTS: - void loadTheme(const QString &name); - -Q_SIGNALS: - void themeChanged(); - void buttonSizesChanged(); - void borderSizesChanged(); - -private: - /** - * Sets the borders according to maximized state. - * Borders are global to all windows. - */ - void borders(int &left, int &top, int &right, int &bottom, bool maximized) const; - /** - * Sets the padding according. - * Padding is global to all windows. - */ - void padding(int &left, int &top, int &right, int &bottom) const; - - AuroraeThemePrivate* const d; -}; - -} // namespace - -#endif // AURORAETHEME_H diff --git a/kwin/clients/aurorae/src/lib/themeconfig.cpp b/kwin/clients/aurorae/src/lib/themeconfig.cpp deleted file mode 100644 index 799067ed..00000000 --- a/kwin/clients/aurorae/src/lib/themeconfig.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************** -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "themeconfig.h" -#include - -#include -#include - -namespace Aurorae -{ - -ThemeConfig::ThemeConfig() - : m_activeTextColor(defaultActiveTextColor()) - , m_activeFocusedTextColor(defaultActiveFocusedTextColor()) - , m_activeUnfocusedTextColor(defaultActiveUnfocusedTextColor()) - , m_inactiveTextColor(defaultInactiveTextColor()) - , m_inactiveFocusedTextColor(defaultInactiveFocusedTextColor()) - , m_inactiveUnfocusedTextColor(defaultInactiveUnfocusedTextColor()) - , m_activeTextShadowColor(defaultActiveTextShadowColor()) - , m_inactiveTextShadowColor(defaultInactiveTextShadowColor()) - , m_textShadowOffsetX(defaultTextShadowOffsetX()) - , m_textShadowOffsetY(defaultTextShadowOffsetY()) - , m_useTextShadow(defaultUseTextShadow()) - , m_haloActive(defaultHaloActive()) - , m_haloInactive(defaultHaloInactive()) - , m_alignment(defaultAlignment()) - , m_verticalAlignment(defaultVerticalAlignment()) - // borders - , m_borderLeft(defaultBorderLeft()) - , m_borderRight(defaultBorderRight()) - , m_borderBottom(defaultBorderBottom()) - , m_borderTop(defaultBorderTop()) - // title - , m_titleEdgeTop(defaultTitleEdgeTop()) - , m_titleEdgeBottom(defaultTitleEdgeBottom()) - , m_titleEdgeLeft(defaultTitleEdgeLeft()) - , m_titleEdgeRight(defaultTitleEdgeRight()) - , m_titleEdgeTopMaximized(defaultTitleEdgeTopMaximized()) - , m_titleEdgeBottomMaximized(defaultTitleEdgeBottomMaximized()) - , m_titleEdgeLeftMaximized(defaultTitleEdgeLeftMaximized()) - , m_titleEdgeRightMaximized(defaultTitleEdgeRightMaximized()) - , m_titleBorderLeft(defaultTitleBorderLeft()) - , m_titleBorderRight(defaultTitleBorderRight()) - , m_titleHeight(defaultTitleHeight()) - // buttons - , m_buttonWidth(defaultButtonWidth()) - , m_buttonWidthMinimize(defaultButtonWidthMinimize()) - , m_buttonWidthMaximizeRestore(defaultButtonWidthMaximizeRestore()) - , m_buttonWidthClose(defaultButtonWidthClose()) - , m_buttonWidthAllDesktops(defaultButtonWidthAllDesktops()) - , m_buttonWidthKeepAbove(defaultButtonWidthKeepAbove()) - , m_buttonWidthKeepBelow(defaultButtonWidthKeepBelow()) - , m_buttonWidthShade(defaultButtonWidthShade()) - , m_buttonWidthHelp(defaultButtonWidthHelp()) - , m_buttonWidthMenu(defaultButtonWidthMenu()) - , m_buttonHeight(defaultButtonHeight()) - , m_buttonSpacing(defaultButtonSpacing()) - , m_buttonMarginTop(defaultButtonMarginTop()) - , m_explicitButtonSpacer(defaultExplicitButtonSpacer()) - // padding - , m_paddingLeft(defaultPaddingLeft()) - , m_paddingRight(defaultPaddingRight()) - , m_paddingTop(defaultPaddingTop()) - , m_paddingBottom(defaultPaddingBottom()) - , m_animationTime(defaultAnimationTime()) - , m_defaultButtonsLeft(KDecorationOptions::defaultTitleButtonsLeft()) - , m_defaultButtonsRight(KDecorationOptions::defaultTitleButtonsRight()) - , m_shadow(defaultShadow()) - , m_decorationPosition(defaultDecorationPosition()) -{ -} - -void ThemeConfig::load(const KConfig &conf) -{ - KConfigGroup general(&conf, "General"); - m_activeTextColor = general.readEntry("ActiveTextColor", defaultActiveTextColor()); - m_inactiveTextColor = general.readEntry("InactiveTextColor", defaultInactiveTextColor()); - m_activeFocusedTextColor = general.readEntry("ActiveFocusedTabColor", m_activeTextColor); - m_activeUnfocusedTextColor = general.readEntry("ActiveUnfocusedTabColor", m_inactiveTextColor); - m_inactiveFocusedTextColor = general.readEntry("InactiveFocusedTabColor", m_inactiveTextColor); - m_inactiveUnfocusedTextColor = general.readEntry("InactiveUnfocusedTabColor", m_inactiveTextColor); - m_useTextShadow = general.readEntry("UseTextShadow", defaultUseTextShadow()); - m_activeTextShadowColor = general.readEntry("ActiveTextShadowColor", defaultActiveTextColor()); - m_inactiveTextShadowColor = general.readEntry("InactiveTextShadowColor", defaultInactiveTextColor()); - m_textShadowOffsetX = general.readEntry("TextShadowOffsetX", defaultTextShadowOffsetX()); - m_textShadowOffsetY = general.readEntry("TextShadowOffsetY", defaultTextShadowOffsetY()); - m_haloActive = general.readEntry("HaloActive", defaultHaloActive()); - m_haloInactive = general.readEntry("HaloInactive", defaultHaloInactive()); - QString alignment = (general.readEntry("TitleAlignment", "Left")).toLower(); - if (alignment == "left") { - m_alignment = Qt::AlignLeft; - } - else if (alignment == "center") { - m_alignment = Qt::AlignCenter; - } - else { - m_alignment = Qt::AlignRight; - } - alignment = (general.readEntry("TitleVerticalAlignment", "Center")).toLower(); - if (alignment == "top") { - m_verticalAlignment = Qt::AlignTop; - } - else if (alignment == "center") { - m_verticalAlignment = Qt::AlignVCenter; - } - else { - m_verticalAlignment = Qt::AlignBottom; - } - m_animationTime = general.readEntry("Animation", defaultAnimationTime()); - m_defaultButtonsLeft = general.readEntry("LeftButtons", KDecorationOptions::defaultTitleButtonsLeft()); - m_defaultButtonsRight = general.readEntry("RightButtons", KDecorationOptions::defaultTitleButtonsRight()); - m_shadow = general.readEntry("Shadow", defaultShadow()); - m_decorationPosition = general.readEntry("DecorationPosition", defaultDecorationPosition()); - - KConfigGroup border(&conf, "Layout"); - // default values taken from KCommonDecoration::layoutMetric() in kcommondecoration.cpp - m_borderLeft = border.readEntry("BorderLeft", defaultBorderLeft()); - m_borderRight = border.readEntry("BorderRight", defaultBorderRight()); - m_borderBottom = border.readEntry("BorderBottom", defaultBorderBottom()); - m_borderTop = border.readEntry("BorderTop", defaultBorderTop()); - - m_titleEdgeTop = border.readEntry("TitleEdgeTop", defaultTitleEdgeTop()); - m_titleEdgeBottom = border.readEntry("TitleEdgeBottom", defaultTitleEdgeBottom()); - m_titleEdgeLeft = border.readEntry("TitleEdgeLeft", defaultTitleEdgeLeft()); - m_titleEdgeRight = border.readEntry("TitleEdgeRight", defaultTitleEdgeRight()); - m_titleEdgeTopMaximized = border.readEntry("TitleEdgeTopMaximized", defaultTitleEdgeTopMaximized()); - m_titleEdgeBottomMaximized = border.readEntry("TitleEdgeBottomMaximized", defaultTitleEdgeBottomMaximized()); - m_titleEdgeLeftMaximized = border.readEntry("TitleEdgeLeftMaximized", defaultTitleEdgeLeftMaximized()); - m_titleEdgeRightMaximized = border.readEntry("TitleEdgeRightMaximized", defaultTitleEdgeRightMaximized()); - m_titleBorderLeft = border.readEntry("TitleBorderLeft", defaultTitleBorderLeft()); - m_titleBorderRight = border.readEntry("TitleBorderRight", defaultTitleBorderRight()); - m_titleHeight = border.readEntry("TitleHeight", defaultTitleHeight()); - - m_buttonWidth = border.readEntry("ButtonWidth", defaultButtonWidth()); - m_buttonWidthMinimize = border.readEntry("ButtonWidthMinimize", m_buttonWidth); - m_buttonWidthMaximizeRestore = border.readEntry("ButtonWidthMaximizeRestore", m_buttonWidth); - m_buttonWidthClose = border.readEntry("ButtonWidthClose", m_buttonWidth); - m_buttonWidthAllDesktops = border.readEntry("ButtonWidthAlldesktops", m_buttonWidth); - m_buttonWidthKeepAbove = border.readEntry("ButtonWidthKeepabove", m_buttonWidth); - m_buttonWidthKeepBelow = border.readEntry("ButtonWidthKeepbelow", m_buttonWidth); - m_buttonWidthShade = border.readEntry("ButtonWidthShade", m_buttonWidth); - m_buttonWidthHelp = border.readEntry("ButtonWidthHelp", m_buttonWidth); - m_buttonWidthMenu = border.readEntry("ButtonWidthMenu", m_buttonWidth); - m_buttonHeight = border.readEntry("ButtonHeight", defaultButtonHeight()); - m_buttonSpacing = border.readEntry("ButtonSpacing", defaultButtonSpacing()); - m_buttonMarginTop = border.readEntry("ButtonMarginTop", defaultButtonMarginTop()); - m_explicitButtonSpacer = border.readEntry("ExplicitButtonSpacer", defaultExplicitButtonSpacer()); - - m_paddingLeft = border.readEntry("PaddingLeft", defaultPaddingLeft()); - m_paddingRight = border.readEntry("PaddingRight", defaultPaddingRight()); - m_paddingTop = border.readEntry("PaddingTop", defaultPaddingTop()); - m_paddingBottom = border.readEntry("PaddingBottom", defaultPaddingBottom()); -} - -QColor ThemeConfig::activeTextColor(bool useTabs, bool focused) const -{ - if (!useTabs) { - return m_activeTextColor; - } - if (focused) { - return m_activeFocusedTextColor; - } else { - return m_activeUnfocusedTextColor; - } -} - -QColor ThemeConfig::inactiveTextColor(bool useTabs, bool focused) const -{ - if (!useTabs) { - return m_inactiveTextColor; - } - if (focused) { - return m_inactiveFocusedTextColor; - } else { - return m_inactiveUnfocusedTextColor; - } -} - -} //namespace diff --git a/kwin/clients/aurorae/src/lib/themeconfig.h b/kwin/clients/aurorae/src/lib/themeconfig.h deleted file mode 100644 index caeac446..00000000 --- a/kwin/clients/aurorae/src/lib/themeconfig.h +++ /dev/null @@ -1,414 +0,0 @@ -/******************************************************************** -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef THEMECONFIG_H -#define THEMECONFIG_H -// This class encapsulates all theme config values -// it's a separate class as it's needed by both deco and config dialog - -#include -#include - -class KConfig; - -namespace Aurorae -{ -class ThemeConfig -{ -public: - ThemeConfig(); - void load(const KConfig &conf); - ~ThemeConfig() {}; - // active window - QColor activeTextColor(bool useTabs = false, bool focused = true) const; - // inactive window - QColor inactiveTextColor(bool useTabs = false, bool focused = true) const; - QColor activeTextShadowColor() const { - return m_activeTextShadowColor; - } - QColor inactiveTextShadowColor() const { - return m_inactiveTextShadowColor; - } - int textShadowOffsetX() const { - return m_textShadowOffsetX; - } - int textShadowOffsetY() const { - return m_textShadowOffsetY; - } - bool useTextShadow() const { - return m_useTextShadow; - } - bool haloActive() const { - return m_haloActive; - } - bool haloInactive() const { - return m_haloInactive; - } - // Alignment - Qt::Alignment alignment() const { - return m_alignment; - }; - Qt::Alignment verticalAlignment() const { - return m_verticalAlignment; - } - int animationTime() const { - return m_animationTime; - } - // Borders - int borderLeft() const { - return m_borderLeft; - } - int borderRight() const { - return m_borderRight; - } - int borderBottom() const { - return m_borderBottom; - } - int borderTop() const { - return m_borderTop; - } - - int titleEdgeTop() const { - return m_titleEdgeTop; - } - int titleEdgeBottom() const { - return m_titleEdgeBottom; - } - int titleEdgeLeft() const { - return m_titleEdgeLeft; - } - int titleEdgeRight() const { - return m_titleEdgeRight; - } - int titleEdgeTopMaximized() const { - return m_titleEdgeTopMaximized; - } - int titleEdgeBottomMaximized() const { - return m_titleEdgeBottomMaximized; - } - int titleEdgeLeftMaximized() const { - return m_titleEdgeLeftMaximized; - } - int titleEdgeRightMaximized() const { - return m_titleEdgeRightMaximized; - } - int titleBorderLeft() const { - return m_titleBorderLeft; - } - int titleBorderRight() const { - return m_titleBorderRight; - } - int titleHeight() const { - return m_titleHeight; - } - - int buttonWidth() const { - return m_buttonWidth; - } - int buttonWidthMinimize() const { - return m_buttonWidthMinimize; - } - int buttonWidthMaximizeRestore() const { - return m_buttonWidthMaximizeRestore; - } - int buttonWidthClose() const { - return m_buttonWidthClose; - } - int buttonWidthAllDesktops() const { - return m_buttonWidthAllDesktops; - } - int buttonWidthKeepAbove() const { - return m_buttonWidthKeepAbove; - } - int buttonWidthKeepBelow() const { - return m_buttonWidthKeepBelow; - } - int buttonWidthShade() const { - return m_buttonWidthShade; - } - int buttonWidthHelp() const { - return m_buttonWidthHelp; - } - int buttonWidthMenu() const { - return m_buttonWidthMenu; - } - int buttonHeight() const { - return m_buttonHeight; - } - int buttonSpacing() const { - return m_buttonSpacing; - } - int buttonMarginTop() const { - return m_buttonMarginTop; - } - int explicitButtonSpacer() const { - return m_explicitButtonSpacer; - } - - int paddingLeft() const { - return m_paddingLeft; - } - int paddingRight() const { - return m_paddingRight; - } - int paddingTop() const { - return m_paddingTop; - } - int paddingBottom() const { - return m_paddingBottom; - } - - QString defaultButtonsLeft() const { - return m_defaultButtonsLeft; - } - QString defaultButtonsRight() const { - return m_defaultButtonsRight; - } - bool shadow() const { - return m_shadow; - } - - int decorationPosition() const { - return m_decorationPosition; - } - - static QColor defaultActiveTextColor() { - return QColor(Qt::black); - } - static QColor defaultActiveFocusedTextColor() { - return QColor(Qt::black); - } - static QColor defaultActiveUnfocusedTextColor() { - return QColor(Qt::black); - } - static QColor defaultInactiveTextColor() { - return QColor(Qt::black); - } - static QColor defaultInactiveFocusedTextColor() { - return QColor(Qt::black); - } - static QColor defaultInactiveUnfocusedTextColor() { - return QColor(Qt::black); - } - static QColor defaultActiveTextShadowColor() { - return QColor(Qt::white); - } - static QColor defaultInactiveTextShadowColor() { - return QColor(Qt::white); - } - static int defaultTextShadowOffsetX() { - return 0; - } - static int defaultTextShadowOffsetY() { - return 0; - } - static bool defaultUseTextShadow() { - return false; - } - static bool defaultHaloActive() { - return false; - } - static bool defaultHaloInactive() { - return false; - } - static Qt::Alignment defaultAlignment() { - return Qt::AlignLeft; - } - static Qt::Alignment defaultVerticalAlignment() { - return Qt::AlignVCenter; - } - // borders - static int defaultBorderLeft() { - return 5; - } - static int defaultBorderRight() { - return 5; - } - static int defaultBorderBottom() { - return 5; - } - static int defaultBorderTop() { - return 0; - } - // title - static int defaultTitleEdgeTop() { - return 5; - } - static int defaultTitleEdgeBottom() { - return 5; - } - static int defaultTitleEdgeLeft() { - return 5; - } - static int defaultTitleEdgeRight() { - return 5; - } - static int defaultTitleEdgeTopMaximized() { - return 0; - } - static int defaultTitleEdgeBottomMaximized() { - return 0; - } - static int defaultTitleEdgeLeftMaximized() { - return 0; - } - static int defaultTitleEdgeRightMaximized() { - return 0; - } - static int defaultTitleBorderLeft() { - return 5; - } - static int defaultTitleBorderRight() { - return 5; - } - static int defaultTitleHeight() { - return 20; - } - // buttons - static int defaultButtonWidth() { - return 20; - } - static int defaultButtonWidthMinimize() { - return defaultButtonWidth(); - } - static int defaultButtonWidthMaximizeRestore() { - return defaultButtonWidth(); - } - static int defaultButtonWidthClose() { - return defaultButtonWidth(); - } - static int defaultButtonWidthAllDesktops() { - return defaultButtonWidth(); - } - static int defaultButtonWidthKeepAbove() { - return defaultButtonWidth(); - } - static int defaultButtonWidthKeepBelow() { - return defaultButtonWidth(); - } - static int defaultButtonWidthShade() { - return defaultButtonWidth(); - } - static int defaultButtonWidthHelp() { - return defaultButtonWidth(); - } - static int defaultButtonWidthMenu() { - return defaultButtonWidth(); - } - static int defaultButtonHeight() { - return 20; - } - static int defaultButtonSpacing() { - return 5; - } - static int defaultButtonMarginTop() { - return 0; - } - static int defaultExplicitButtonSpacer() { - return 10; - } - // padding - static int defaultPaddingLeft() { - return 0; - } - static int defaultPaddingRight() { - return 0; - } - static int defaultPaddingTop() { - return 0; - } - static int defaultPaddingBottom() { - return 0; - } - static int defaultAnimationTime() { - return 0; - } - static bool defaultShadow() { - return true; - } - static int defaultDecorationPosition() { - return 0; - } - -private: - QColor m_activeTextColor; - QColor m_activeFocusedTextColor; - QColor m_activeUnfocusedTextColor; - QColor m_inactiveTextColor; - QColor m_inactiveFocusedTextColor; - QColor m_inactiveUnfocusedTextColor; - QColor m_activeTextShadowColor; - QColor m_inactiveTextShadowColor; - int m_textShadowOffsetX; - int m_textShadowOffsetY; - bool m_useTextShadow; - bool m_haloActive; - bool m_haloInactive; - Qt::Alignment m_alignment; - Qt::Alignment m_verticalAlignment; - // borders - int m_borderLeft; - int m_borderRight; - int m_borderBottom; - int m_borderTop; - - // title - int m_titleEdgeTop; - int m_titleEdgeBottom; - int m_titleEdgeLeft; - int m_titleEdgeRight; - int m_titleEdgeTopMaximized; - int m_titleEdgeBottomMaximized; - int m_titleEdgeLeftMaximized; - int m_titleEdgeRightMaximized; - int m_titleBorderLeft; - int m_titleBorderRight; - int m_titleHeight; - - // buttons - int m_buttonWidth; - int m_buttonWidthMinimize; - int m_buttonWidthMaximizeRestore; - int m_buttonWidthClose; - int m_buttonWidthAllDesktops; - int m_buttonWidthKeepAbove; - int m_buttonWidthKeepBelow; - int m_buttonWidthShade; - int m_buttonWidthHelp; - int m_buttonWidthMenu; - int m_buttonHeight; - int m_buttonSpacing; - int m_buttonMarginTop; - int m_explicitButtonSpacer; - - // padding - int m_paddingLeft; - int m_paddingRight; - int m_paddingTop; - int m_paddingBottom; - - int m_animationTime; - - QString m_defaultButtonsLeft; - QString m_defaultButtonsRight; - bool m_shadow; - - int m_decorationPosition; -}; - -} - -#endif diff --git a/kwin/clients/aurorae/src/qml/AuroraeButton.qml b/kwin/clients/aurorae/src/qml/AuroraeButton.qml deleted file mode 100644 index 18d5caae..00000000 --- a/kwin/clients/aurorae/src/qml/AuroraeButton.qml +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore - -DecorationButton { - function widthForButton() { - switch (buttonType) { - case "M": - // menu - return auroraeTheme.buttonWidthMenu; - case "S": - // all desktops - return auroraeTheme.buttonWidthAllDesktops; - case "H": - // help - return auroraeTheme.buttonWidthHelp; - case "I": - // minimize - return auroraeTheme.buttonWidthMinimize; - case "A": - // maximize - return auroraeTheme.buttonWidthMaximizeRestore; - case "X": - // close - return auroraeTheme.buttonWidthClose; - case "F": - // keep above - return auroraeTheme.buttonWidthKeepAbove; - case "B": - // keep below - return auroraeTheme.buttonWidthKeepBelow; - case "L": - // shade - return auroraeTheme.buttonWidthShade; - default: - return auroraeTheme.buttonWidth; - } - } - function pathForButton() { - switch (buttonType) { - case "S": - // all desktops - return auroraeTheme.allDesktopsButtonPath; - case "H": - // help - return auroraeTheme.helpButtonPath; - case "I": - // minimize - return auroraeTheme.minimizeButtonPath; - case "A": - // maximize - return auroraeTheme.maximizeButtonPath; - case "R": - // maximize - return auroraeTheme.restoreButtonPath; - case "X": - // close - return auroraeTheme.closeButtonPath; - case "F": - // keep above - return auroraeTheme.keepAboveButtonPath; - case "B": - // keep below - return auroraeTheme.keepBelowButtonPath; - case "L": - // shade - return auroraeTheme.shadeButtonPath; - default: - return ""; - } - } - width: widthForButton() * auroraeTheme.buttonSizeFactor - height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor - PlasmaCore.FrameSvg { - property bool supportsHover: hasElementPrefix("hover") - property bool supportsPressed: hasElementPrefix("pressed") - property bool supportsDeactivated: hasElementPrefix("deactivated") - property bool supportsInactive: hasElementPrefix("inactive") - property bool supportsInactiveHover: hasElementPrefix("hover-inactive") - property bool supportsInactivePressed: hasElementPrefix("pressed-inactive") - property bool supportsInactiveDeactivated: hasElementPrefix("deactivated-inactive") - id: buttonSvg - imagePath: pathForButton() - } - PlasmaCore.FrameSvgItem { - id: buttonActive - property bool shown: (decoration.active || !buttonSvg.supportsInactive) && ((!pressed && !toggled) || !buttonSvg.supportsPressed) && (!hovered || !buttonSvg.supportsHover) && (enabled || !buttonSvg.supportsDeactivated) - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "active" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonActiveHover - property bool shown: hovered && !pressed && !toggled && buttonSvg.supportsHover && (decoration.active || !buttonSvg.supportsInactiveHover) - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "hover" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonActivePressed - property bool shown: (toggled || pressed) && buttonSvg.supportsPressed && (decoration.active || !buttonSvg.supportsInactivePressed) - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "pressed" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonActiveDeactivated - property bool shown: !enabled && buttonSvg.supportsDeactivated && (decoration.active || !buttonSvg.supportsInactiveDeactivated) - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "deactivated" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonInactive - property bool shown: !decoration.active && buttonSvg.supportsInactive && !hovered && !pressed && !toggled && enabled - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "inactive" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonInactiveHover - property bool shown: !decoration.active && hovered && !pressed && !toggled && buttonSvg.supportsInactiveHover - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "hover-inactive" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonInactivePressed - property bool shown: !decoration.active && (toggled || pressed) && buttonSvg.supportsInactivePressed - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "pressed-inactive" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: buttonInactiveDeactivated - property bool shown: !decoration.active && !enabled && buttonSvg.supportsInactiveDeactivated - anchors.fill: parent - imagePath: buttonSvg.imagePath - prefix: "deactivated-inactive" - opacity: shown ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - Component.onCompleted: { - if (buttonType == "H" && !decoration.providesContextHelp) { - visible = false; - } else { - visible = buttonSvg.imagePath != ""; - } - } -} diff --git a/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml b/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml deleted file mode 100644 index 7bf11dc6..00000000 --- a/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - function createButtons() { - var component = Qt.createComponent("AuroraeButton.qml"); - for (var i=0; i - -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, see . -*********************************************************************/ -import QtQuick 1.1 - -Item { - id: button - width: auroraeTheme.buttonWidthMaximizeRestore * auroraeTheme.buttonSizeFactor - height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor - AuroraeButton { - id: maximizeButton - anchors.fill: parent - buttonType: "A" - opacity: (!decoration.maximized || auroraeTheme.restoreButtonPath == "") ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - AuroraeButton { - id: restoreButton - anchors.fill: parent - buttonType: "R" - opacity: (decoration.maximized && auroraeTheme.restoreButtonPath != "") ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } -} diff --git a/kwin/clients/aurorae/src/qml/ButtonGroup.qml b/kwin/clients/aurorae/src/qml/ButtonGroup.qml deleted file mode 100644 index be2156de..00000000 --- a/kwin/clients/aurorae/src/qml/ButtonGroup.qml +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 - -Item { - function createButtons() { - for (var i=0; i - -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, see . -*********************************************************************/ -import QtQuick 1.1 - -Item { - signal alphaChanged() - property QtObject borders: Borders { - objectName: "borders" - } - property QtObject maximizedBorders: Borders { - objectName: "maximizedBorders" - } - property QtObject extendedBorders: Borders { - objectName: "extendedBorders" - } - property QtObject padding: Borders { - objectName: "padding" - } - property bool alpha: true - onAlphaChanged: alphaChanged() - - MouseArea { - anchors.fill: parent - hoverEnabled: true - onPositionChanged: decoration.titleMouseMoved(mouse.button, mouse.buttons) - onPressed: decoration.titlePressed(mouse.button, mouse.buttons) - onReleased: decoration.titleReleased(mouse.button, mouse.buttons) - } -} diff --git a/kwin/clients/aurorae/src/qml/DecorationButton.qml b/kwin/clients/aurorae/src/qml/DecorationButton.qml deleted file mode 100644 index d61dcc9f..00000000 --- a/kwin/clients/aurorae/src/qml/DecorationButton.qml +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 - -Item { - id: button - property string buttonType : "" - property bool hovered: false - property bool pressed: false - property bool toggled: false - enabled: { - switch (button.buttonType) { - case "X": - return decoration.closeable; - case "A": - case "R": - return decoration.maximizeable; - case "I": - return decoration.minimizeable; - case "_": - return false; - default: - return true; - } - } - MouseArea { - anchors.fill: parent - acceptedButtons: { - switch (button.buttonType) { - case "M": - return Qt.LeftButton | Qt.RightButton; - case "A": - case "R": - return Qt.LeftButton | Qt.RightButton | Qt.MiddleButton; - default: - return Qt.LeftButton; - } - } - hoverEnabled: true - onEntered: button.hovered = true - onPositionChanged: decoration.titleMouseMoved(mouse.button, mouse.buttons) - onExited: button.hovered = false - onPressed: button.pressed = true - onReleased: button.pressed = false - onClicked: { - switch (button.buttonType) { - case "M": - // menu - decoration.menuClicked(); - break; - case "S": - // all desktops - decoration.toggleOnAllDesktops(); - break; - case "H": - // help - decoration.showContextHelp(); - break; - case "I": - // minimize - decoration.minimize(); - break; - case "A": - case "R": - // maximize - decoration.maximize(mouse.button); - break; - case "X": - // close - decoration.closeWindow(); - break; - case "F": - // keep above - decoration.toggleKeepAbove(); - break; - case "B": - // keep below - decoration.toggleKeepBelow(); - break; - case "L": - // shade - decoration.toggleShade(); - break; - } - } - onDoubleClicked: { - if (button.buttonType == "M") { - decoration.closeWindow(); - } - } - Component.onCompleted: { - switch (button.buttonType) { - case "S": - // all desktops - button.toggled = decoration.onAllDesktops; - break; - case "F": - button.toggled = decoration.keepAbove; - break; - case "B": - button.toggled = decoration.keepBelow; - break; - case "L": - button.toggled = decoration.shade; - break; - } - } - Connections { - target: decoration - onShadeChanged: { - if (button.buttonType != "L") { - return; - } - button.toggled = decoration.shade; - } - onKeepBelowChanged: { - if (button.buttonType != "B") { - return; - } - button.toggled = decoration.keepBelow; - } - onKeepAboveChanged: { - if (button.buttonType != "F") { - return; - } - button.toggled = decoration.keepAbove; - } - onDesktopChanged: { - if (button.buttonType != "S") { - return; - } - button.toggled = decoration.onAllDesktops; - } - } - } -} diff --git a/kwin/clients/aurorae/src/qml/MenuButton.qml b/kwin/clients/aurorae/src/qml/MenuButton.qml deleted file mode 100644 index 4b8401d2..00000000 --- a/kwin/clients/aurorae/src/qml/MenuButton.qml +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.qtextracomponents 0.1 as QtExtra - -DecorationButton { - property bool closeOnDoubleClick: true - id: menuButton - buttonType: "M" - QtExtra.QIconItem { - icon: decoration.icon - anchors.fill: parent - } - Timer { - id: timer - interval: 150 - repeat: false - onTriggered: decoration.menuClicked() - } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { - parent.pressed = true; - // we need a timer to figure out whether there is a double click in progress or not - // if we have a "normal" click we want to open the context menu. This would eat our - // second click of the double click. To properly get the double click we have to wait - // the double click delay to ensure that it was only a single click. - if (timer.running) { - timer.stop(); - } else if (menuButton.closeOnDoubleClick) { - timer.start(); - } - } - onReleased: { - parent.pressed = false; - timer.stop(); - } - onExited: { - if (!parent.pressed) { - return; - } - if (timer.running) { - timer.stop(); - } - parent.pressed = false; - } - onClicked: { - // for right clicks we show the menu instantly - // and if the option is disabled we always show menu directly - if (!menuButton.closeOnDoubleClick || mouse.button == Qt.RightButton) { - decoration.menuClicked(); - timer.stop(); - } - } - onDoubleClicked: { - if (menuButton.closeOnDoubleClick) { - decoration.closeWindow(); - } - } - } - Component.onCompleted: { - menuButton.closeOnDoubleClick = decoration.readConfig("CloseOnDoubleClickMenuButton", true); - } - Connections { - target: decoration - onConfigChanged: { - menuButton.closeOnDoubleClick = decoration.readConfig("CloseOnDoubleClickMenuButton", true); - } - } -} diff --git a/kwin/clients/aurorae/src/qml/aurorae.qml b/kwin/clients/aurorae/src/qml/aurorae.qml deleted file mode 100644 index 6a4e3fb7..00000000 --- a/kwin/clients/aurorae/src/qml/aurorae.qml +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.kwin.decoration 0.1 -import org.kde.plasma.core 0.1 as PlasmaCore - -Decoration { - id: root - property bool animate: false - Component.onCompleted: { - borders.left = Math.max(0, auroraeTheme.borderLeft); - borders.right = Math.max(0, auroraeTheme.borderRight); - borders.top = Math.max(0, auroraeTheme.borderTop); - borders.bottom = Math.max(0, auroraeTheme.borderBottom); - maximizedBorders.left = Math.max(0, auroraeTheme.borderLeftMaximized); - maximizedBorders.right = Math.max(0, auroraeTheme.borderRightMaximized); - maximizedBorders.bottom = Math.max(0, auroraeTheme.borderBottomMaximized); - maximizedBorders.top = Math.max(0, auroraeTheme.borderTopMaximized); - padding.left = auroraeTheme.paddingLeft; - padding.right = auroraeTheme.paddingRight; - padding.bottom = auroraeTheme.paddingBottom; - padding.top = auroraeTheme.paddingTop; - root.animate = true; - } - DecorationOptions { - id: options - deco: decoration - } - PlasmaCore.FrameSvg { - property bool supportsInactive: hasElementPrefix("decoration-inactive") - property bool supportsMaximized: hasElementPrefix("decoration-maximized") - property bool supportsMaximizedInactive: hasElementPrefix("decoration-maximized-inactive") - property bool supportsInnerBorder: hasElementPrefix("innerborder") - property bool supportsInnerBorderInactive: hasElementPrefix("innerborder-inactive") - id: backgroundSvg - imagePath: auroraeTheme.decorationPath - } - PlasmaCore.FrameSvgItem { - id: decorationActive - property bool shown: (!decoration.maxized || !backgroundSvg.supportsMaximized) && (decoration.active || !backgroundSvg.supportsInactive) - anchors.fill: parent - imagePath: backgroundSvg.imagePath - prefix: "decoration" - opacity: shown ? 1 : 0 - enabledBorders: decoration.maximized ? PlasmaCore.FrameSvg.NoBorder : PlasmaCore.FrameSvg.TopBorder | PlasmaCore.FrameSvg.BottomBorder | PlasmaCore.FrameSvg.LeftBorder | PlasmaCore.FrameSvg.RightBorder - Behavior on opacity { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: decorationInactive - anchors.fill: parent - imagePath: backgroundSvg.imagePath - prefix: "decoration-inactive" - opacity: (!decoration.active && backgroundSvg.supportsInactive) ? 1 : 0 - enabledBorders: decoration.maximized ? PlasmaCore.FrameSvg.NoBorder : PlasmaCore.FrameSvg.TopBorder | PlasmaCore.FrameSvg.BottomBorder | PlasmaCore.FrameSvg.LeftBorder | PlasmaCore.FrameSvg.RightBorder - Behavior on opacity { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: decorationMaximized - property bool shown: decoration.maximized && backgroundSvg.supportsMaximized && (decoration.active || !backgroundSvg.supportsMaximizedInactive) - anchors { - left: parent.left - right: parent.right - top: parent.top - leftMargin: 0 - rightMargin: 0 - topMargin: 0 - } - imagePath: backgroundSvg.imagePath - prefix: "decoration-maximized" - height: parent.borderTopMaximized - opacity: shown ? 1 : 0 - enabledBorders: PlasmaCore.FrameSvg.NoBorder - Behavior on opacity { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: decorationMaximizedInactive - anchors { - left: parent.left - right: parent.right - top: parent.top - leftMargin: 0 - rightMargin: 0 - topMargin: 0 - } - imagePath: backgroundSvg.imagePath - prefix: "decoration-maximized-inactive" - height: parent.maximizedBorders.top - opacity: (!decoration.active && decoration.maximized && backgroundSvg.supportsMaximizedInactive) ? 1 : 0 - enabledBorders: PlasmaCore.FrameSvg.NoBorder - Behavior on opacity { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - AuroraeButtonGroup { - id: leftButtonGroup - buttons: options.titleButtonsLeft - width: childrenRect.width - animate: root.animate - anchors { - left: parent.left - leftMargin: decoration.maximized ? auroraeTheme.titleEdgeLeftMaximized : (auroraeTheme.titleEdgeLeft + root.padding.left) - } - Behavior on anchors.leftMargin { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - AuroraeButtonGroup { - id: rightButtonGroup - buttons: options.titleButtonsRight - width: childrenRect.width - animate: root.animate - anchors { - right: parent.right - rightMargin: decoration.maximized ? auroraeTheme.titleEdgeRightMaximized : (auroraeTheme.titleEdgeRight + root.padding.right) - } - Behavior on anchors.rightMargin { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - Text { - id: caption - text: decoration.caption - textFormat: Text.PlainText - horizontalAlignment: auroraeTheme.horizontalAlignment - verticalAlignment: auroraeTheme.verticalAlignment - elide: Text.ElideRight - height: Math.max(auroraeTheme.titleHeight, auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor) - color: decoration.active ? auroraeTheme.activeTextColor : auroraeTheme.inactiveTextColor - font: options.titleFont - anchors { - left: leftButtonGroup.right - right: rightButtonGroup.left - top: root.top - topMargin: decoration.maximized ? auroraeTheme.titleEdgeTopMaximized : (auroraeTheme.titleEdgeTop + root.padding.top) - leftMargin: auroraeTheme.titleBorderLeft - rightMargin: auroraeTheme.titleBorderRight - } - MouseArea { - acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - anchors.fill: parent - onDoubleClicked: decoration.titlebarDblClickOperation() - onPressed: { - if (mouse.button == Qt.LeftButton) { - mouse.accepted = false; - } else { - decoration.titlePressed(mouse.button, mouse.buttons); - } - } - onReleased: decoration.titleReleased(mouse.button, mouse.buttons) - } - Behavior on color { - enabled: root.animate - ColorAnimation { - duration: auroraeTheme.animationTime - } - } - Behavior on anchors.topMargin { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: innerBorder - anchors { - fill: parent - leftMargin: parent.padding.left + parent.borders.left - margins.left - rightMargin: parent.padding.right + parent.borders.right - margins.right - topMargin: parent.padding.top + parent.borders.top - margins.top - bottomMargin: parent.padding.bottom + parent.borders.bottom - margins.bottom - } - imagePath: backgroundSvg.imagePath - prefix: "innerborder" - opacity: (decoration.active && !decoration.maximized && backgroundSvg.supportsInnerBorder) ? 1 : 0 - Behavior on opacity { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } - PlasmaCore.FrameSvgItem { - id: innerBorderInactive - anchors { - fill: parent - leftMargin: parent.padding.left + parent.borders.left - margins.left - rightMargin: parent.padding.right + parent.borders.right - margins.right - topMargin: parent.padding.top + parent.borders.top - margins.top - bottomMargin: parent.padding.bottom + parent.borders.bottom - margins.bottom - } - imagePath: backgroundSvg.imagePath - prefix: "innerborder-inactive" - opacity: (!decoration.active && !decoration.maximized && backgroundSvg.supportsInnerBorderInactive) ? 1 : 0 - Behavior on opacity { - enabled: root.animate - NumberAnimation { - duration: auroraeTheme.animationTime - } - } - } -} diff --git a/kwin/clients/aurorae/src/qml/qmldir b/kwin/clients/aurorae/src/qml/qmldir deleted file mode 100644 index a509471b..00000000 --- a/kwin/clients/aurorae/src/qml/qmldir +++ /dev/null @@ -1,6 +0,0 @@ -plugin decorationplugin - -Decoration 0.1 Decoration.qml -DecorationButton 0.1 DecorationButton.qml -MenuButton 0.1 MenuButton.qml -ButtonGroup 0.1 ButtonGroup.qml diff --git a/kwin/clients/aurorae/theme-description b/kwin/clients/aurorae/theme-description deleted file mode 100644 index 53f7c1fc..00000000 --- a/kwin/clients/aurorae/theme-description +++ /dev/null @@ -1,162 +0,0 @@ -DESCRIPTION OF AURORAE -====================== - -Aurorae is a theme engine for KWin window decorations. It is built against the unstable API of KWin -in KDE 4.3. Aurorae uses SVG to render the decoration and buttons and there is a simple config file -for configuring the theme details. - -This theme engine uses Plasma technologie to render the window decoration. Every detail can be -themed by the usage of SVG. The theme engine uses Plasma's FrameSvg, so you can provide SVG files -containing borders. - -The theme consists of one folder containing svgz files for decoration and buttons, one KConfig file -for the theme details and one metadata.desktop file which you can use to name your theme, author -information, etc. - -Although the engine uses Plasma technology, it isn't Plasma. So it does not know anything about -Plasmoids and you will never be able to put Plasmoids into the decoration. That is out of scope of -this engine. - -Aurorae uses the features provided by KWin 4.3. So the themes can provide their own decoration -shadows and it is recommended that your themes provide those. The engine supports ARGB decoration -which is enabled by default. If you provide a theme using translucency, please make sure, that it -works without compositing as well. - -Window Decoration -================= -The window decoration has to be provided in file "decoration.svgz". This svg has to contain all the -elements required for a Plasma theme background. The decoration has to use the element prefix -"decoration". - -If you want to provide a different style for inactive windows you can add it to the same svg. The -inactive elements must have the element prefix "decoration-inactive". The theme engine tests for -this prefix and if not provided inactive windows will be rendered with the same style as active -windows. - -You have to provide a special decoration for opaque mode, that is when compositing is not active. -This opaque decoration is used for generating the window mask. The element prefix is -"decoration-opaque" for active and "decoration-opaque-inactive" for inactive windows. The mask is -generated from the active window. - -Maximized Windows ------------------ -In order to better support maximized windows there exists a special frame svg called -"decoration-maximized". In the same way as for the general decoration you can specify a version for -inactive, opaque and inactive-opaque. This results in the following names: - * decoration-maximized - * decoration-maximized-inactive - * decoration-maximized-opaque - * decoration-maximized-opaque-inactive - -In all cases only the center element will be used. There is no need to specify borders. Please note -that in case of a window with translucent widgets the center element will be stretched to the size -of the complete window. - -The following fallback strategy is used: if inactive is not present it falls back to the active. -If opaque is not present it falls back to the translucent. If none of the maximized elements are -present the center element of the decoration is used! - -In order to support Fitts' Law all TitleEdge Settings are set to 0. So the buttons will be directly -next to the screen edges. You have the possibility to overwrite these settins (see below). - -Buttons -======= -You have to provide a svgz file for each button your theme should contain. If you do not provide a -file for a button type the engine will not include that button, so your decoration will miss it. -There is no fallback to a default theme. The buttons are rendered using Plasma's FrameSvg as well. -So you have to provide the "center" element. Borders are not supported - -You can provide the following buttons: - * close - * minimize - * maximize - * restore - * alldesktops - * keepabove - * keepbelow - * shade - * resize - * help - -Each button can have different states. So a button could be hovered, pressed, deactivated and you -might want to provide different styles for active and inactive windows. You can use the following -element prefix to provide styles for the buttons: - * active (normal button for active window) - * inactive (normal button for inactive window) - * hover (hover state for active window) - * hover-inactive (hover state for inactive window) - * pressed (button is pressed) - * pressed-inactive (pressed inactive button) - * deactivated (button cannot be clicked, e.g. window cannot be closed) - * deactivated-inactive (same for inactive windows) - -You have at least to provide the active element. All other elements are optional and the active -element is always used as a fallback. If you provide the inactive element, this is used as a -fallback for the inactive window. That is, if you provide a hover element, but none for inactive, -the inactive window will not have a hover effect. Same is true for pressed and deactivated. -Reasonable that means if you provide a deactivated and an inactive element you want to provide a -deactivated-inactive element as well. - -Configuration file -================== -The configuration file is a normal KConfig file. You have to give it the name of your decoration -with suffix "rc". So if your theme has the name "deco", your config file will be named "decorc". -The following section shows the possible options with their default values. - -[General] -TitleAlignment=Left # vorizontal alignment of window title -TitleVerticalAlignment=Center # vertical alignment of window title -Animation=0 # animation duration in msec when hovering a button and on active/inactive change -ActiveTextColor=0,0,0,255 # title text color of active window -InactiveTextColor=0,0,0,255 # title text color of inactive window -UseTextShadow=false # Draw Shadow behind title text -ActiveTextShadowColor=255,255,255,255 # Shadow text color of active window -InactiveTextShadowColor=255,255,255,255 # Shadow text color of active window -TextShadowOffsetX=0 # Offset of shadow in x direction -TextShadowOffsetY=0 # Offset of shadow in y direction -HaloActive=false # Draw halo behing title of active window (since 4.5) -HaloInactive=false # Draw halo behing title of inactive window (since 4.5) -LeftButtons=MS # buttons in left button group -RightButtons=HIAX # buttons in right button group -Shadow=true # decoration provides shadows: you have to add padding - -[Layout] # uses Layout Manager -BorderLeft=5 -BorderRight=5 -BorderBottom=5 -TitleEdgeTop=5 -TitleEdgeBottom=5 -TitleEdgeLeft=5 -TitleEdgeRight=5 -TitleEdgeTopMaximized=0 -TitleEdgeBottomMaximized=0 -TitleEdgeLeftMaximized=0 -TitleEdgeRightMaximized=0 -TitleBorderLeft=5 -TitleBorderRight=5 -TitleHeight=20 -ButtonWidth=20 -ButtonWidthMinimize=? # optional - default depends on ButtonWidth -ButtonWidthMaximizeRestore=? # optional - default depends on ButtonWidth -ButtonWidthClose=? # optional - default depends on ButtonWidth -ButtonWidthAlldesktops=? # optional - default depends on ButtonWidth -ButtonWidthKeepabove=? # optional - default depends on ButtonWidth -ButtonWidthKeepbelow=? # optional - default depends on ButtonWidth -ButtonWidthShade=? # optional - default depends on ButtonWidth -ButtonWidthHelp=? # optional - default depends on ButtonWidth -ButtonWidthMenu=? # optional - default depends on ButtonWidth -ButtonHeight=20 -ButtonSpacing=5 -ButtonMarginTop=0 -ExplicitButtonSpacer=10 -PaddingTop=0 # Padding added to provide shadows -PaddingBottom=0 # Padding added to provide shadows -PaddingRight=0 # Padding added to provide shadows -PaddingLeft=0 # Padding added to provide shadows - -Packaging -========= -All theme files (decoration, buttons, metadata.desktop and configuration file) have to be stored in -one directory with the name of the theme (this has to be identical to the one used for the config -file). You have to create a tar.gz archive from that directory. This archive is the theme, which -can be installed in the kcm for window decorations. diff --git a/kwin/clients/aurorae/themes/CMakeLists.txt b/kwin/clients/aurorae/themes/CMakeLists.txt deleted file mode 100644 index 286310f0..00000000 --- a/kwin/clients/aurorae/themes/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(plastik) diff --git a/kwin/clients/aurorae/themes/plastik/CMakeLists.txt b/kwin/clients/aurorae/themes/plastik/CMakeLists.txt deleted file mode 100644 index 2d343cd3..00000000 --- a/kwin/clients/aurorae/themes/plastik/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_subdirectory(code) - -install(DIRECTORY package/ - DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/decorations/kwin4_decoration_qml_plastik) - -install(FILES package/metadata.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin - RENAME kwin4_decoration_qml_plastik.desktop) diff --git a/kwin/clients/aurorae/themes/plastik/code/CMakeLists.txt b/kwin/clients/aurorae/themes/plastik/code/CMakeLists.txt deleted file mode 100644 index e43c1e15..00000000 --- a/kwin/clients/aurorae/themes/plastik/code/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(plastik_plugin_SRCS - plastikbutton.cpp - plastikplugin.cpp -) - -add_library(plastikplugin SHARED ${plastik_plugin_SRCS}) -target_link_libraries(plastikplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} KDE4::kdeui kdecorations) -install(TARGETS plastikplugin DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/kwin/decorations/plastik) -install(FILES qmldir DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/kwin/decorations/plastik) diff --git a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp b/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp deleted file mode 100644 index db08e2a4..00000000 --- a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin -Copyright (C) 2003-2005 Sandro Giessl - -based on the window decoration "Web": -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, see . -*********************************************************************/ -#include "plastikbutton.h" -#include -#include -#include - -namespace KWin -{ - -PlastikButtonProvider::PlastikButtonProvider() - : QDeclarativeImageProvider(Pixmap) -{ -} - -QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - int origSize = requestedSize.isValid() ? qMin(requestedSize.width(), requestedSize.height()) : 10; - if (size) { - *size = QSize(origSize, origSize); - } - QStringList idParts = id.split('/'); - if (idParts.isEmpty()) { - // incorrect id - return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize); - } - bool active = false; - bool toggled = false; - bool shadow = false; - if (idParts.length() > 1 && idParts.at(1) == "true") { - active = true; - } - if (idParts.length() > 2 && idParts.at(2) == "true") { - toggled = true; - } - if (idParts.length() > 3 && idParts.at(3) == "true") { - shadow = true; - } - ButtonIcon button; - if (idParts[0] == "X") { - button = CloseIcon; - } else if (idParts[0] == "A") { - if (toggled) { - button = MaxRestoreIcon; - } else { - button = MaxIcon; - } - } else if (idParts[0] == "I") { - button = MinIcon; - } else if (idParts[0] == "H") { - button = HelpIcon; - } else if (idParts[0] == "S") { - if (toggled) { - button = NotOnAllDesktopsIcon; - } else { - button = OnAllDesktopsIcon; - } - } else if (idParts[0] == "F") { - if (toggled) { - button = NoKeepAboveIcon; - } else { - button = KeepAboveIcon; - } - } else if (idParts[0] == "B") { - if (toggled) { - button = NoKeepBelowIcon; - } else { - button = KeepBelowIcon; - } - } else if (idParts[0] == "L") { - if (toggled) { - button = UnShadeIcon; - } else { - button = ShadeIcon; - } - } else { - // not recognized icon - return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize); - } - return icon(button, origSize, active, shadow); -} - -QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool shadow) -{ - if (size%2 == 0) - --size; - - QPixmap image(size, size); - image.fill(Qt::transparent); - QPainter p(&image); - const QColor color = KDecoration::options()->color(KDecoration::ColorFont, active); - - if (shadow) { - p.setPen(KColorScheme::shade(color, KColorScheme::ShadowShade)); - } else { - p.setPen(color); - } - - const QRect r = image.rect(); - - // line widths - int lwTitleBar = 1; - if (r.width() > 16) { - lwTitleBar = 4; - } else if (r.width() > 4) { - lwTitleBar = 2; - } - int lwArrow = 1; - if (r.width() > 16) { - lwArrow = 4; - } else if (r.width() > 7) { - lwArrow = 2; - } - - switch(icon) { - case CloseIcon: - { - int lineWidth = 1; - if (r.width() > 16) { - lineWidth = 3; - } else if (r.width() > 4) { - lineWidth = 2; - } - - drawObject(p, DiagonalLine, r.x(), r.y(), r.width(), lineWidth); - drawObject(p, CrossDiagonalLine, r.x(), r.bottom(), r.width(), lineWidth); - - break; - } - - case MaxIcon: - { - int lineWidth2 = 1; // frame - if (r.width() > 16) { - lineWidth2 = 2; - } else if (r.width() > 4) { - lineWidth2 = 1; - } - - drawObject(p, HorizontalLine, r.x(), r.top(), r.width(), lwTitleBar); - drawObject(p, HorizontalLine, r.x(), r.bottom()-(lineWidth2-1), r.width(), lineWidth2); - drawObject(p, VerticalLine, r.x(), r.top(), r.height(), lineWidth2); - drawObject(p, VerticalLine, r.right()-(lineWidth2-1), r.top(), r.height(), lineWidth2); - - break; - } - - case MaxRestoreIcon: - { - int lineWidth2 = 1; // frame - if (r.width() > 16) { - lineWidth2 = 2; - } else if (r.width() > 4) { - lineWidth2 = 1; - } - - int margin1, margin2; - margin1 = margin2 = lineWidth2*2; - if (r.width() < 8) - margin1 = 1; - - // background window - drawObject(p, HorizontalLine, r.x()+margin1, r.top(), r.width()-margin1, lineWidth2); - drawObject(p, HorizontalLine, r.right()-margin2, r.bottom()-(lineWidth2-1)-margin1, margin2, lineWidth2); - drawObject(p, VerticalLine, r.x()+margin1, r.top(), margin2, lineWidth2); - drawObject(p, VerticalLine, r.right()-(lineWidth2-1), r.top(), r.height()-margin1, lineWidth2); - - // foreground window - drawObject(p, HorizontalLine, r.x(), r.top()+margin2, r.width()-margin2, lwTitleBar); - drawObject(p, HorizontalLine, r.x(), r.bottom()-(lineWidth2-1), r.width()-margin2, lineWidth2); - drawObject(p, VerticalLine, r.x(), r.top()+margin2, r.height(), lineWidth2); - drawObject(p, VerticalLine, r.right()-(lineWidth2-1)-margin2, r.top()+margin2, r.height(), lineWidth2); - - break; - } - - case MinIcon: - { - drawObject(p, HorizontalLine, r.x(), r.bottom()-(lwTitleBar-1), r.width(), lwTitleBar); - - break; - } - - case HelpIcon: - { - int center = r.x()+r.width()/2 -1; - int side = r.width()/4; - - // paint a question mark... code is quite messy, to be cleaned up later...! :o - - if (r.width() > 16) { - int lineWidth = 3; - - // top bar - drawObject(p, HorizontalLine, center-side+3, r.y(), 2*side-3-1, lineWidth); - // top bar rounding - drawObject(p, CrossDiagonalLine, center-side-1, r.y()+5, 6, lineWidth); - drawObject(p, DiagonalLine, center+side-3, r.y(), 5, lineWidth); - // right bar - drawObject(p, VerticalLine, center+side+2-lineWidth, r.y()+3, r.height()-(2*lineWidth+side+2+1), lineWidth); - // bottom bar - drawObject(p, CrossDiagonalLine, center, r.bottom()-2*lineWidth, side+2, lineWidth); - drawObject(p, HorizontalLine, center, r.bottom()-3*lineWidth+2, lineWidth, lineWidth); - // the dot - drawObject(p, HorizontalLine, center, r.bottom()-(lineWidth-1), lineWidth, lineWidth); - } else if (r.width() > 8) { - int lineWidth = 2; - - // top bar - drawObject(p, HorizontalLine, center-(side-1), r.y(), 2*side-1, lineWidth); - // top bar rounding - if (r.width() > 9) { - drawObject(p, CrossDiagonalLine, center-side-1, r.y()+3, 3, lineWidth); - } else { - drawObject(p, CrossDiagonalLine, center-side-1, r.y()+2, 3, lineWidth); - } - drawObject(p, DiagonalLine, center+side-1, r.y(), 3, lineWidth); - // right bar - drawObject(p, VerticalLine, center+side+2-lineWidth, r.y()+2, r.height()-(2*lineWidth+side+1), lineWidth); - // bottom bar - drawObject(p, CrossDiagonalLine, center, r.bottom()-2*lineWidth+1, side+2, lineWidth); - // the dot - drawObject(p, HorizontalLine, center, r.bottom()-(lineWidth-1), lineWidth, lineWidth); - } else { - int lineWidth = 1; - - // top bar - drawObject(p, HorizontalLine, center-(side-1), r.y(), 2*side, lineWidth); - // top bar rounding - drawObject(p, CrossDiagonalLine, center-side-1, r.y()+1, 2, lineWidth); - // right bar - drawObject(p, VerticalLine, center+side+1, r.y(), r.height()-(side+2+1), lineWidth); - // bottom bar - drawObject(p, CrossDiagonalLine, center, r.bottom()-2, side+2, lineWidth); - // the dot - drawObject(p, HorizontalLine, center, r.bottom(), 1, 1); - } - - break; - } - - case NotOnAllDesktopsIcon: - { - int lwMark = r.width()-lwTitleBar*2-2; - if (lwMark < 1) - lwMark = 3; - - drawObject(p, HorizontalLine, r.x()+(r.width()-lwMark)/2, r.y()+(r.height()-lwMark)/2, lwMark, lwMark); - - // Fall through to OnAllDesktopsIcon intended! - } - case OnAllDesktopsIcon: - { - // horizontal bars - drawObject(p, HorizontalLine, r.x()+lwTitleBar, r.y(), r.width()-2*lwTitleBar, lwTitleBar); - drawObject(p, HorizontalLine, r.x()+lwTitleBar, r.bottom()-(lwTitleBar-1), r.width()-2*lwTitleBar, lwTitleBar); - // vertical bars - drawObject(p, VerticalLine, r.x(), r.y()+lwTitleBar, r.height()-2*lwTitleBar, lwTitleBar); - drawObject(p, VerticalLine, r.right()-(lwTitleBar-1), r.y()+lwTitleBar, r.height()-2*lwTitleBar, lwTitleBar); - - - break; - } - - case NoKeepAboveIcon: - { - int center = r.x()+r.width()/2; - - // arrow - drawObject(p, CrossDiagonalLine, r.x(), center+2*lwArrow, center-r.x(), lwArrow); - drawObject(p, DiagonalLine, r.x()+center, r.y()+1+2*lwArrow, center-r.x(), lwArrow); - if (lwArrow>1) - drawObject(p, HorizontalLine, center-(lwArrow-2), r.y()+2*lwArrow, (lwArrow-2)*2, lwArrow); - - // Fall through to KeepAboveIcon intended! - } - case KeepAboveIcon: - { - int center = r.x()+r.width()/2; - - // arrow - drawObject(p, CrossDiagonalLine, r.x(), center, center-r.x(), lwArrow); - drawObject(p, DiagonalLine, r.x()+center, r.y()+1, center-r.x(), lwArrow); - if (lwArrow>1) - drawObject(p, HorizontalLine, center-(lwArrow-2), r.y(), (lwArrow-2)*2, lwArrow); - - break; - } - - case NoKeepBelowIcon: - { - int center = r.x()+r.width()/2; - - // arrow - drawObject(p, DiagonalLine, r.x(), center-2*lwArrow, center-r.x(), lwArrow); - drawObject(p, CrossDiagonalLine, r.x()+center, r.bottom()-1-2*lwArrow, center-r.x(), lwArrow); - if (lwArrow>1) - drawObject(p, HorizontalLine, center-(lwArrow-2), r.bottom()-(lwArrow-1)-2*lwArrow, (lwArrow-2)*2, lwArrow); - - // Fall through to KeepBelowIcon intended! - } - case KeepBelowIcon: - { - int center = r.x()+r.width()/2; - - // arrow - drawObject(p, DiagonalLine, r.x(), center, center-r.x(), lwArrow); - drawObject(p, CrossDiagonalLine, r.x()+center, r.bottom()-1, center-r.x(), lwArrow); - if (lwArrow>1) - drawObject(p, HorizontalLine, center-(lwArrow-2), r.bottom()-(lwArrow-1), (lwArrow-2)*2, lwArrow); - - break; - } - - case ShadeIcon: - { - drawObject(p, HorizontalLine, r.x(), r.y(), r.width(), lwTitleBar); - - break; - } - - case UnShadeIcon: - { - int lw1 = 1; - int lw2 = 1; - if (r.width() > 16) { - lw1 = 4; - lw2 = 2; - } else if (r.width() > 7) { - lw1 = 2; - lw2 = 1; - } - - int h = qMax( (r.width()/2), (lw1+2*lw2) ); - - // horizontal bars - drawObject(p, HorizontalLine, r.x(), r.y(), r.width(), lw1); - drawObject(p, HorizontalLine, r.x(), r.x()+h-(lw2-1), r.width(), lw2); - // vertical bars - drawObject(p, VerticalLine, r.x(), r.y(), h, lw2); - drawObject(p, VerticalLine, r.right()-(lw2-1), r.y(), h, lw2); - - break; - } - - default: - break; - } - - p.end(); - - return image; -} - -void PlastikButtonProvider::drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth) -{ - switch(object) { - case DiagonalLine: - if (lineWidth <= 1) { - for (int i = 0; i < length; ++i) { - p.drawPoint(x+i,y+i); - } - } else if (lineWidth <= 2) { - for (int i = 0; i < length; ++i) { - p.drawPoint(x+i,y+i); - } - for (int i = 0; i < (length-1); ++i) { - p.drawPoint(x+1+i,y+i); - p.drawPoint(x+i,y+1+i); - } - } else { - for (int i = 1; i < (length-1); ++i) { - p.drawPoint(x+i,y+i); - } - for (int i = 0; i < (length-1); ++i) { - p.drawPoint(x+1+i,y+i); - p.drawPoint(x+i,y+1+i); - } - for (int i = 0; i < (length-2); ++i) { - p.drawPoint(x+2+i,y+i); - p.drawPoint(x+i,y+2+i); - } - } - break; - case CrossDiagonalLine: - if (lineWidth <= 1) { - for (int i = 0; i < length; ++i) { - p.drawPoint(x+i,y-i); - } - } else if (lineWidth <= 2) { - for (int i = 0; i < length; ++i) { - p.drawPoint(x+i,y-i); - } - for (int i = 0; i < (length-1); ++i) { - p.drawPoint(x+1+i,y-i); - p.drawPoint(x+i,y-1-i); - } - } else { - for (int i = 1; i < (length-1); ++i) { - p.drawPoint(x+i,y-i); - } - for (int i = 0; i < (length-1); ++i) { - p.drawPoint(x+1+i,y-i); - p.drawPoint(x+i,y-1-i); - } - for (int i = 0; i < (length-2); ++i) { - p.drawPoint(x+2+i,y-i); - p.drawPoint(x+i,y-2-i); - } - } - break; - case HorizontalLine: - for (int i = 0; i < lineWidth; ++i) { - p.drawLine(x,y+i, x+length-1, y+i); - } - break; - case VerticalLine: - for (int i = 0; i < lineWidth; ++i) { - p.drawLine(x+i,y, x+i, y+length-1); - } - break; - default: - break; - } -} - -} // namespace diff --git a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h b/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h deleted file mode 100644 index 0daa5fd2..00000000 --- a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_PLASTIK_BUTTON_H -#define KWIN_PLASTIK_BUTTON_H - -#include -#include - -namespace KWin -{ - -class PlastikButtonProvider : public QDeclarativeImageProvider -{ -public: - explicit PlastikButtonProvider(); - virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); - -private: - enum ButtonIcon { - CloseIcon = 0, - MaxIcon, - MaxRestoreIcon, - MinIcon, - HelpIcon, - OnAllDesktopsIcon, - NotOnAllDesktopsIcon, - KeepAboveIcon, - NoKeepAboveIcon, - KeepBelowIcon, - NoKeepBelowIcon, - ShadeIcon, - UnShadeIcon, - NumButtonIcons - }; - enum Object { - HorizontalLine, - VerticalLine, - DiagonalLine, - CrossDiagonalLine - }; - QPixmap icon(ButtonIcon icon, int size, bool active, bool shadow); - void drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth); -}; - -} // namespace - -#endif // KWIN_PLASTIK_BUTTON_H diff --git a/kwin/clients/aurorae/themes/plastik/code/plastikplugin.cpp b/kwin/clients/aurorae/themes/plastik/code/plastikplugin.cpp deleted file mode 100644 index d7cdbfee..00000000 --- a/kwin/clients/aurorae/themes/plastik/code/plastikplugin.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "plastikplugin.h" -#include "plastikbutton.h" -#include - -Q_EXPORT_PLUGIN(PlastikPlugin) - -void PlastikPlugin::registerTypes(const char *uri) -{ - Q_UNUSED(uri) -} - -void PlastikPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.kwin.decorations.plastik")); - engine->addImageProvider(QLatin1String("plastik"), new KWin::PlastikButtonProvider()); - QDeclarativeExtensionPlugin::initializeEngine(engine, uri); -} - -#include "moc_plastikplugin.cpp" diff --git a/kwin/clients/aurorae/themes/plastik/code/plastikplugin.h b/kwin/clients/aurorae/themes/plastik/code/plastikplugin.h deleted file mode 100644 index 354dfc5b..00000000 --- a/kwin/clients/aurorae/themes/plastik/code/plastikplugin.h +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef PLASTIK_PLUGIN_H -#define PLASTIK_PLUGIN_H - -#include - -class PlastikPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri); - virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri); -}; - -#endif // PLASTIK_PLUGIN_H diff --git a/kwin/clients/aurorae/themes/plastik/code/qmldir b/kwin/clients/aurorae/themes/plastik/code/qmldir deleted file mode 100644 index 7a9ebf1b..00000000 --- a/kwin/clients/aurorae/themes/plastik/code/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -plugin plastikplugin - -# we need to have at least one element of Qt is not able to find the plugin *shrug* -Foo 1.0 Foo.qml diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/config/main.xml b/kwin/clients/aurorae/themes/plastik/package/contents/config/main.xml deleted file mode 100644 index 99f11265..00000000 --- a/kwin/clients/aurorae/themes/plastik/package/contents/config/main.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - true - - - false - - - false - - - true - - - true - - - true - - - diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml b/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml deleted file mode 100644 index 6a065463..00000000 --- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.kwin.decoration 0.1 -import org.kde.kwin.decorations.plastik 1.0 - -DecorationButton { - id: button - function colorize() { - var highlightColor = null; - if (button.pressed) { - if (button.buttonType == "X") { - highlightColor = colorHelper.foreground(decoration.active, ColorHelper.NegativeText); - } else { - highlightColor = options.titleBarColor; - } - highlightColor = colorHelper.shade(highlightColor, ColorHelper.ShadowShade); - highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.3); - } else if (button.hovered) { - if (button.buttonType == "X") { - highlightColor = colorHelper.foreground(decoration.active, ColorHelper.NegativeText); - } else { - highlightColor = options.titleBarColor; - } - highlightColor = colorHelper.shade(highlightColor, ColorHelper.LightShade, Math.min(1.0, colorHelper.contrast + 0.4)); - highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.6); - } - if (highlightColor) { - button.surfaceTop = Qt.tint(button.baseSurfaceTop, highlightColor); - button.surfaceBottom = Qt.tint(button.baseSurfaceBottom, highlightColor); - highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.4); - button.conturTop = Qt.tint(button.baseConturTop, highlightColor); - button.conturBottom = Qt.tint(button.baseConturBottom, highlightColor); - } else { - button.conturTop = button.baseConturTop; - button.conturBottom = button.baseConturBottom; - button.surfaceTop = button.baseSurfaceTop; - button.surfaceBottom = button.baseSurfaceBottom; - } - } - property real size - property color conturTop - property color conturBottom - property color surfaceTop - property color surfaceBottom - property color baseConturTop: colorHelper.shade(options.titleBarColor, ColorHelper.DarkShade, colorHelper.contrast - 0.4) - property color baseConturBottom: colorHelper.shade(options.titleBarColor, ColorHelper.MidShade) - property color baseSurfaceTop: colorHelper.shade(options.titleBarColor, ColorHelper.MidlightShade, colorHelper.contrast - 0.4) - property color baseSurfaceBottom: colorHelper.shade(options.titleBarColor, ColorHelper.LightShade, colorHelper.contrast - 0.4) - Behavior on conturTop { - ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } - } - Behavior on conturBottom { - ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } - } - Behavior on surfaceTop { - ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } - } - Behavior on surfaceBottom { - ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 } - } - width: size - height: size - Rectangle { - radius: 2 - smooth: true - anchors.fill: parent - gradient: Gradient { - GradientStop { - position: 0.0 - color: button.conturTop - } - GradientStop { - position: 1.0 - color: button.conturBottom - } - } - Rectangle { - radius: 2 - smooth: true - anchors { - fill: parent - leftMargin: 1 - rightMargin: 1 - topMargin: 1 - bottomMargin: 1 - } - gradient: Gradient { - GradientStop { - position: 0.0 - color: button.surfaceTop - } - GradientStop { - position: 1.0 - color: button.surfaceBottom - } - } - } - } - Item { - property int imageWidth: button.width > 14 ? button.width - 2 * Math.floor(button.width/3.5) : button.width - 6 - property int imageHeight: button.height > 14 ? button.height - 2 * Math.floor(button.height/3.5) : button.height - 6 - property string source: "image://plastik/" + button.buttonType + "/" + decoration.active + "/" + ((buttonType == "A") ? decoration.maximized : button.toggled) - anchors.fill: parent - Image { - id: shadowImage - x: button.x + button.width / 2 - width / 2 + 1 - y: button.y + button.height / 2 - height / 2 + 1 - source: parent.source + "/true" - width: parent.imageWidth - height: parent.imageHeight - sourceSize.width: width - sourceSize.height: height - visible: !button.pressed - } - Image { - id: image - x: button.x + button.width / 2 - width / 2 - y: button.y + button.height / 2 - height / 2 + (button.pressed ? 1 : 0) - source: parent.source - width: parent.imageWidth - height: parent.imageHeight - sourceSize.width: width - sourceSize.height: height - } - } - Component.onCompleted: { - colorize(); - if (buttonType == "H") { - visible = decoration.providesContextHelp; - } - } - onHoveredChanged: colorize() - onPressedChanged: colorize() - Connections { - target: decoration - onActiveChanged: button.colorize() - } -} diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/config.ui b/kwin/clients/aurorae/themes/plastik/package/contents/ui/config.ui deleted file mode 100644 index e15bb13d..00000000 --- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/config.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - PlastikConfigDialog - - - - 0 - 0 - 541 - 176 - - - - Config Dialog - - - - 0 - - - - - Title &Alignment - - - - - - Left - - - - - - - Center - - - - - - - Right - - - - - - - - - - Check this option if the window border should be painted in the titlebar color. Otherwise it will be painted in the background color. - - - Colored window border - - - - - - - - - - Check this option if you want the titlebar text to have a 3D look with a shadow behind it. - - - Use shadowed &text - - - - - - - Check this option if you want the buttons to fade in when the mouse pointer hovers over them and fade out again when it moves away. - - - Animate buttons - - - - - - - - KButtonGroup - QGroupBox -
kbuttongroup.h
- 1 -
-
- - kcfg_animateButtons - kcfg_titleShadow - - -
diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml deleted file mode 100644 index bc2cd929..00000000 --- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml +++ /dev/null @@ -1,420 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.kwin.decoration 0.1 -import org.kde.kwin.decorations.plastik 1.0 - -Decoration { - function readConfig() { - switch (decoration.readConfig("BorderSize", DecorationOptions.BorderNormal)) { - case DecorationOptions.BorderTiny: - borders.setBorders(3); - extendedBorders.setAllBorders(0); - break; - case DecorationOptions.BorderLarge: - borders.setBorders(8); - extendedBorders.setAllBorders(0); - break; - case DecorationOptions.BorderVeryLarge: - borders.setBorders(12); - extendedBorders.setAllBorders(0); - break; - case DecorationOptions.BorderHuge: - borders.setBorders(18); - extendedBorders.setAllBorders(0); - break; - case DecorationOptions.BorderVeryHuge: - borders.setBorders(27); - extendedBorders.setAllBorders(0); - break; - case DecorationOptions.BorderOversized: - borders.setBorders(40); - extendedBorders.setAllBorders(0); - break; - case DecorationOptions.BorderNoSides: - borders.setBorders(4); - borders.setSideBorders(1); - extendedBorders.setSideBorders(3); - break; - case DecorationOptions.BorderNone: - borders.setBorders(1); - extendedBorders.setBorders(3); - break; - case DecorationOptions.BorderNormal: // fall through to default - default: - borders.setBorders(4); - extendedBorders.setAllBorders(0); - break; - } - var titleAlignLeft = decoration.readConfig("titleAlignLeft", true); - var titleAlignCenter = decoration.readConfig("titleAlignCenter", false); - var titleAlignRight = decoration.readConfig("titleAlignRight", false); - if (titleAlignRight) { - root.titleAlignment = Text.AlignRight; - } else if (titleAlignCenter) { - root.titleAlignment = Text.AlignHCenter; - } else { - if (!titleAlignLeft) { - console.log("Error reading title alignment: all alignment options are false"); - } - root.titleAlignment = Text.AlignLeft; - } - root.animateButtons = decoration.readConfig("animateButtons", true); - root.titleShadow = decoration.readConfig("titleShadow", true); - if (decoration.animationsSupported) { - root.animationDuration = 150; - root.animateButtons = false; - } - } - ColorHelper { - id: colorHelper - } - DecorationOptions { - id: options - deco: decoration - } - property alias buttonSize: titleRow.captionHeight - property alias titleAlignment: caption.horizontalAlignment - property color titleBarColor: options.titleBarColor - // set by readConfig after Component completed, ensures that buttons do not flicker - property int animationDuration: 0 - property bool animateButtons: true - property bool titleShadow: true - Behavior on titleBarColor { - ColorAnimation { - duration: root.animationDuration - } - } - id: root - alpha: false - Rectangle { - color: root.titleBarColor - anchors { - fill: parent - } - border { - width: decoration.maximized ? 0 : 2 - color: colorHelper.shade(root.titleBarColor, ColorHelper.DarkShade) - } - Rectangle { - id: borderLeft - anchors { - left: parent.left - top: parent.top - bottom: parent.bottom - leftMargin: 1 - bottomMargin: 1 - topMargin: 1 - } - visible: !decoration.maximized - width: root.borders.left - color: root.titleBarColor - Rectangle { - width: 1 - anchors { - left: parent.left - top: parent.top - bottom: parent.bottom - } - color: colorHelper.shade(root.titleBarColor, ColorHelper.LightShade, colorHelper.contrast - (decoration.active ? 0.4 : 0.8)) - } - } - Rectangle { - id: borderRight - anchors { - right: parent.right - top: parent.top - bottom: parent.bottom - rightMargin: 1 - bottomMargin: 1 - topMargin: 1 - } - visible: !decoration.maximzied - width: root.borders.right -1 - color: root.titleBarColor - Rectangle { - width: 1 - anchors { - bottom: parent.bottom - top: parent.top - } - x: parent.x + parent.width - 1 - color: colorHelper.shade(root.titleBarColor, ColorHelper.DarkShade, colorHelper.contrast - (decoration.active ? 0.4 : 0.8)) - } - } - Rectangle { - id: borderBottom - anchors { - left: parent.right - right: parent.left - bottom: parent.bottom - leftMargin: 1 - rightMargin: 1 - } - height: root.borders.bottom - visible: !decoration.maximzied - color: root.titleBarColor - Rectangle { - height: 1 - anchors { - left: parent.left - right: parent.right - } - y: parent.y + parent.height - 1 - color: colorHelper.shade(root.titleBarColor, ColorHelper.DarkShade, colorHelper.contrast - (decoration.active ? 0.4 : 0.8)) - } - } - - Rectangle { - id: top - property int topMargin: 1 - property real normalHeight: titleRow.normalHeight + topMargin + 1 - property real maximizedHeight: titleRow.maximizedHeight + 1 - height: decoration.maximized ? maximizedHeight : normalHeight - anchors { - left: parent.left - right: parent.right - top: parent.top - topMargin: decoration.maximized ? 0 : top.topMargin - leftMargin: decoration.maximized ? 0 : 2 - rightMargin: decoration.maximized ? 0 : 2 - } - gradient: Gradient { - id: topGradient - GradientStop { - position: 0.0 - color: colorHelper.shade(root.titleBarColor, ColorHelper.MidlightShade, colorHelper.contrast - 0.4) - } - GradientStop { - id: middleGradientStop - position: 4.0/(decoration.maximized ? top.maximizedHeight : top.normalHeight) - color: colorHelper.shade(root.titleBarColor, ColorHelper.MidShade, colorHelper.contrast - 0.4) - } - GradientStop { - position: 1.0 - color: root.titleBarColor - } - } - Rectangle { - height: 1 - anchors { - top: top.top - left: top.left - right: top.right - } - visible: !decoration.maximized - color: colorHelper.shade(root.titleBarColor, ColorHelper.LightShade, colorHelper.contrast - (decoration.active ? 0.4 : 0.8)) - } - MouseArea { - acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - anchors.fill: parent - onDoubleClicked: decoration.titlebarDblClickOperation() - onPressed: { - if (mouse.button == Qt.LeftButton) { - mouse.accepted = false; - } else { - decoration.titlePressed(mouse.button, mouse.buttons); - } - } - onReleased: decoration.titleReleased(mouse.button, mouse.buttons) - } - - Item { - id: titleRow - property real captionHeight: caption.implicitHeight + 4 - property int topMargin: 3 - property int bottomMargin: 1 - property real normalHeight: captionHeight + bottomMargin + topMargin - property real maximizedHeight: captionHeight + bottomMargin - anchors { - left: parent.left - right: parent.right - top: parent.top - topMargin: decoration.maximized ? 0 : titleRow.topMargin - leftMargin: decoration.maximized ? 0 : 3 - rightMargin: decoration.maximized ? 0 : 3 - bottomMargin: titleRow.bottomMargin - } - ButtonGroup { - id: leftButtonGroup - spacing: 1 - explicitSpacer: root.buttonSize - menuButton: menuButtonComponent - minimizeButton: minimizeButtonComponent - maximizeButton: maximizeButtonComponent - keepBelowButton: keepBelowButtonComponent - keepAboveButton: keepAboveButtonComponent - helpButton: helpButtonComponent - shadeButton: shadeButtonComponent - allDesktopsButton: stickyButtonComponent - closeButton: closeButtonComponent - buttons: options.titleButtonsLeft - anchors { - top: parent.top - left: parent.left - } - } - Text { - id: caption - textFormat: Text.PlainText - anchors { - top: parent.top - left: leftButtonGroup.right - right: rightButtonGroup.left - rightMargin: 5 - leftMargin: 5 - topMargin: 3 - } - color: options.fontColor - Behavior on color { - ColorAnimation { duration: root.animationDuration } - } - text: decoration.caption - font: options.titleFont - style: root.titleShadow ? Text.Raised : Text.Normal - styleColor: colorHelper.shade(color, ColorHelper.ShadowShade) - elide: Text.ElideMiddle - } - ButtonGroup { - id: rightButtonGroup - spacing: 1 - explicitSpacer: root.buttonSize - menuButton: menuButtonComponent - minimizeButton: minimizeButtonComponent - maximizeButton: maximizeButtonComponent - keepBelowButton: keepBelowButtonComponent - keepAboveButton: keepAboveButtonComponent - helpButton: helpButtonComponent - shadeButton: shadeButtonComponent - allDesktopsButton: stickyButtonComponent - closeButton: closeButtonComponent - buttons: options.titleButtonsRight - anchors { - top: parent.top - right: parent.right - } - } - } - } - - Item { - id: innerBorder - anchors.fill: parent - - Rectangle { - anchors { - left: parent.left - right: parent.right - } - height: 1 - y: top.height - 1 - visible: decoration.maximized - color: colorHelper.shade(root.titleBarColor, ColorHelper.MidShade) - } - - Rectangle { - anchors { - fill: parent - leftMargin: root.borders.left - 1 - rightMargin: root.borders.right - topMargin: root.borders.top - 1 - bottomMargin: root.borders.bottom - } - border { - width: 1 - color: colorHelper.shade(root.titleBarColor, ColorHelper.MidShade) - } - visible: !decoration.maximized - color: root.titleBarColor - } - } - } - - Component { - id: maximizeButtonComponent - PlastikButton { - buttonType: "A" - size: root.buttonSize - } - } - Component { - id: keepBelowButtonComponent - PlastikButton { - buttonType: "B" - size: root.buttonSize - } - } - Component { - id: keepAboveButtonComponent - PlastikButton { - buttonType: "F" - size: root.buttonSize - } - } - Component { - id: helpButtonComponent - PlastikButton { - buttonType: "H" - size: root.buttonSize - } - } - Component { - id: minimizeButtonComponent - PlastikButton { - buttonType: "I" - size: root.buttonSize - } - } - Component { - id: shadeButtonComponent - PlastikButton { - buttonType: "L" - size: root.buttonSize - } - } - Component { - id: stickyButtonComponent - PlastikButton { - buttonType: "S" - size: root.buttonSize - } - } - Component { - id: closeButtonComponent - PlastikButton { - buttonType: "X" - size: root.buttonSize - } - } - Component { - id: menuButtonComponent - MenuButton { - width: root.buttonSize - height: root.buttonSize - } - } - Component.onCompleted: { - borders.setBorders(4); - borders.setTitle(top.normalHeight); - maximizedBorders.setTitle(top.maximizedHeight); - readConfig(); - } - Connections { - target: decoration - onConfigChanged: readConfig() - } -} diff --git a/kwin/clients/aurorae/themes/plastik/package/metadata.desktop b/kwin/clients/aurorae/themes/plastik/package/metadata.desktop deleted file mode 100644 index ab520431..00000000 --- a/kwin/clients/aurorae/themes/plastik/package/metadata.desktop +++ /dev/null @@ -1,145 +0,0 @@ -[Desktop Entry] -Name=Plastik -Name[af]=Plastiek -Name[ar]=بلاستك -Name[ast]=Plastik -Name[be]=Plastik -Name[be@latin]=Plastik -Name[bg]=Пластик -Name[bn]=প্লাস্টিক -Name[bn_IN]=Plastik (প্লাস্টিক) -Name[br]=Plastik -Name[bs]=Plastika -Name[ca]=Plastik -Name[ca@valencia]=Plastik -Name[cs]=Plastik -Name[csb]=Plastik -Name[cy]=Plastik -Name[da]=Plastik -Name[de]=Plastik -Name[el]=Plastik -Name[en_GB]=Plastik -Name[eo]=Plastik -Name[es]=Plastik -Name[et]=Plastik -Name[eu]=Plastik -Name[fa]=پلاستیک -Name[fi]=Plastik -Name[fr]=Plastik -Name[fy]=Plastyk -Name[ga]=Plastik -Name[gl]=Plastik -Name[gu]=પ્લાસ્ટિક -Name[he]=Plastik -Name[hi]=प्लास्टिक -Name[hne]=प्लास्टिक -Name[hr]=Plastika -Name[hsb]=Plastik -Name[hu]=Plastik -Name[ia]=Plastik -Name[id]=Plastik -Name[is]=Plastik -Name[it]=Plastica -Name[ja]=Plastik -Name[ka]=Пластик -Name[kk]=Пластик -Name[km]=ប្ល៉ាស្ទិក -Name[kn]=ಪ್ಲಾಸ್ಟಿಕ್ -Name[ko]=Plastik -Name[ku]=Plastik -Name[lt]=Plastikinis QML -Name[lv]=Plastik -Name[mai]=प्लास्टिक -Name[mk]=Пластик -Name[ml]=പ്ലാസ്റ്റിക് -Name[mr]=प्लास्टिक -Name[ms]=Plastik -Name[nb]=Plastik -Name[nds]=Plastik -Name[ne]=प्लास्टिक -Name[nl]=Plastik -Name[nn]=Plast -Name[pa]=ਪਲਾਸਟਿਕ -Name[pl]=Plastik -Name[pt]=Plastik -Name[pt_BR]=Plastik -Name[ro]=Plastik -Name[ru]=Пластик -Name[se]=Plastihkka -Name[si]=ප්ලාස්ටික් -Name[sk]=Plastik -Name[sl]=Plastik -Name[sr]=Пластика -Name[sr@ijekavian]=Пластика -Name[sr@ijekavianlatin]=Plastika -Name[sr@latin]=Plastika -Name[sv]=Plastik -Name[ta]=திட்டம் -Name[te]=ప్లాస్టిక్ -Name[tg]=Пластик -Name[th]=รูปแบบพลาสติก -Name[tr]=Plastik -Name[ug]=پىلاستىك -Name[uk]=Пластик -Name[uz]=Plastik -Name[uz@cyrillic]=Пластик -Name[vi]=Chất dẻo -Name[wa]=Plastike -Name[x-test]=xxPlastikxx -Name[zh_CN]=Plastik -Name[zh_TW]=Plastik -Comment=The classic theme known from KDE 3 -Comment[bs]=Klasična tema iz KDE 3 -Comment[ca]=El tema clàssic conegut des del KDE 3 -Comment[ca@valencia]=El tema clàssic conegut des del KDE 3 -Comment[cs]=Klasický motiv známý z KDE 3 -Comment[da]=Det klassiske tema som er kendt fra KDE 3 -Comment[de]=Das klassische Design aus KDE 3 -Comment[el]=Το γνωστό κλασικό θέμα από το KDE 3 -Comment[en_GB]=The classic theme known from KDE 3 -Comment[es]=El tema clásico conocido desde KDE 3 -Comment[et]=Klassikaline KDE 3 ajast tuntud teema -Comment[eu]=KDE 3gatik ezaguna den gai klasikoa -Comment[fi]=KDE 3:sta tuttu klassinen teema -Comment[fr]=Le thème classique connu depuis KDE 3 -Comment[gl]=O tema clásico de KDE 3 -Comment[he]=הערכה הקלאסית של KDE 3 -Comment[hu]=A KDE 3-ból ismert klasszikus téma -Comment[ia]=Le thema classic cognoscite ex KDE 3 -Comment[it]=Il tema classico conosciuto da KDE 3 -Comment[kk]=KDE3-тің классикалық нақышы -Comment[ko]=KDE 3의 고전 테마 -Comment[lt]=Klasikinė tema žinoma iš KDE 3 -Comment[mr]=केडीई 3 मधील क्लासिक शैली -Comment[nb]=Det klassiske temaet kjent fra KDE 3 -Comment[nds]=Dat klass'sche Muster ut KDE 3 -Comment[nl]=Het klassieke thema bekend van KDE 3 -Comment[pl]=Klasyczny wystój znany z KDE 3 -Comment[pt]=O tema clássico conhecido do KDE 3 -Comment[pt_BR]=Tema clássico do KDE 3 -Comment[ro]=Tema clasică cunoscută din KDE 3 -Comment[ru]=Классическая тема, известная со времён KDE 3. -Comment[sk]=Klasická téma známa z KDE 3 -Comment[sl]=Klasična tema, znana iz KDE 3 -Comment[sr]=Класична тема позната из КДЕ‑а 3 -Comment[sr@ijekavian]=Класична тема позната из КДЕ‑а 3 -Comment[sr@ijekavianlatin]=Klasična tema poznata iz KDE‑a 3 -Comment[sr@latin]=Klasična tema poznata iz KDE‑a 3 -Comment[sv]=Det klassiska temat känt från KDE 3 -Comment[tr]=KDE 3'ten bilinen alışılmış tema -Comment[uk]=Класична тема, відома з часів KDE 3 -Comment[x-test]=xxThe classic theme known from KDE 3xx -Comment[zh_CN]=KDE 3 时代的经典主题 -Comment[zh_TW]=從 KDE3 以來的傳統主題 - -X-Plasma-MainScript=ui/main.qml -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=kwin4_decoration_qml_plastik -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/Decoration -Type=Service - diff --git a/kwin/config-kwin.h.cmake b/kwin/config-kwin.h.cmake index fe60650c..fe1f4378 100644 --- a/kwin/config-kwin.h.cmake +++ b/kwin/config-kwin.h.cmake @@ -1,5 +1,3 @@ -#cmakedefine KWIN_BUILD_TABBOX 1 #cmakedefine KWIN_BUILD_SCREENEDGES 1 -#cmakedefine KWIN_BUILD_OXYGEN 1 #cmakedefine KWIN_BUILD_COMPOSITE 1 #define KWIN_VERSION_STRING "${KDE_VERSION_STRING}" diff --git a/kwin/decorations.cpp b/kwin/decorations.cpp index 8fd8fd97..8c2358f2 100644 --- a/kwin/decorations.cpp +++ b/kwin/decorations.cpp @@ -39,9 +39,6 @@ DecorationPlugin::DecorationPlugin(QObject *parent) , m_disabled(false) { defaultPlugin = "kwin3_oxygen"; -#ifndef KWIN_BUILD_OXYGEN - defaultPlugin = "kwin3_aurorae"; -#endif loadPlugin(""); // load the plugin specified in cfg file } diff --git a/kwin/effects.cpp b/kwin/effects.cpp index eb66309e..89049704 100644 --- a/kwin/effects.cpp +++ b/kwin/effects.cpp @@ -31,14 +31,10 @@ along with this program. If not, see . #include "group.h" #include "scene_xrender.h" #include "unmanaged.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif #ifdef KWIN_BUILD_SCREENEDGES #include "screenedge.h" #endif #include "screens.h" -#include "thumbnailitem.h" #include "virtualdesktops.h" #include "workspace.h" #include "composite.h" @@ -68,9 +64,9 @@ along with this program. If not, see . #include "effects/zoom/zoom.h" #include "effects/startupfeedback/startupfeedback.h" -#include +#include #include -#include +#include #include #include @@ -218,13 +214,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); connect(ws, SIGNAL(propertyNotify(long)), this, SLOT(slotPropertyNotify(long))); connect(ws, SIGNAL(stackingOrderChanged()), SIGNAL(stackingOrderChanged())); -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox *tabBox = TabBox::TabBox::self(); - connect(tabBox, SIGNAL(tabBoxAdded(int)), SIGNAL(tabBoxAdded(int))); - connect(tabBox, SIGNAL(tabBoxUpdated()), SIGNAL(tabBoxUpdated())); - connect(tabBox, SIGNAL(tabBoxClosed()), SIGNAL(tabBoxClosed())); - connect(tabBox, SIGNAL(tabBoxKeyEvent(QKeyEvent*)), SIGNAL(tabBoxKeyEvent(QKeyEvent*))); -#endif #ifdef KWIN_BUILD_SCREENEDGES connect(ScreenEdges::self(), SIGNAL(approaching(ElectricBorder,qreal,QRect)), SIGNAL(screenEdgeApproaching(ElectricBorder,qreal,QRect))); #endif @@ -571,21 +560,6 @@ void EffectsHandlerImpl::slotClientModalityChanged() emit windowModalityChanged(static_cast(sender())->effectWindow()); } -void EffectsHandlerImpl::slotCurrentTabAboutToChange(EffectWindow *from, EffectWindow *to) -{ - emit currentTabAboutToChange(from, to); -} - -void EffectsHandlerImpl::slotTabAdded(EffectWindow* w, EffectWindow* to) -{ - emit tabAdded(w, to); -} - -void EffectsHandlerImpl::slotTabRemoved(EffectWindow *w, EffectWindow* leaderOfFormerGroup) -{ - emit tabRemoved(w, leaderOfFormerGroup); -} - void EffectsHandlerImpl::slotDesktopChanged(int old, Client *c) { const int newDesktop = VirtualDesktopManager::self()->current(); @@ -1015,87 +989,6 @@ void EffectsHandlerImpl::setElevatedWindow(EffectWindow* w, bool set) elevated_windows.append(w); } -void EffectsHandlerImpl::setTabBoxWindow(EffectWindow* w) -{ -#ifdef KWIN_BUILD_TABBOX - if (Client* c = qobject_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window())) { - TabBox::TabBox::self()->setCurrentClient(c); - } -#else - Q_UNUSED(w) -#endif -} - -void EffectsHandlerImpl::setTabBoxDesktop(int desktop) -{ -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox::self()->setCurrentDesktop(desktop); -#else - Q_UNUSED(desktop) -#endif -} - -EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const -{ -#ifdef KWIN_BUILD_TABBOX - EffectWindowList ret; - ClientList clients; - clients = TabBox::TabBox::self()->currentClientList(); - foreach (Client *client, clients) { - ret.append(client->effectWindow()); - } - return ret; -#else - return EffectWindowList(); -#endif -} - -void EffectsHandlerImpl::refTabBox() -{ -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox::self()->reference(); -#endif -} - -void EffectsHandlerImpl::unrefTabBox() -{ -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox::self()->unreference(); -#endif -} - -void EffectsHandlerImpl::closeTabBox() -{ -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox::self()->close(); -#endif -} - -QList< int > EffectsHandlerImpl::currentTabBoxDesktopList() const -{ -#ifdef KWIN_BUILD_TABBOX - return TabBox::TabBox::self()->currentDesktopList(); -#endif - return QList< int >(); -} - -int EffectsHandlerImpl::currentTabBoxDesktop() const -{ -#ifdef KWIN_BUILD_TABBOX - return TabBox::TabBox::self()->currentDesktop(); -#endif - return -1; -} - -EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const -{ -#ifdef KWIN_BUILD_TABBOX - if (Client* c = TabBox::TabBox::self()->currentClient()) - return c->effectWindow(); -#endif - return NULL; -} - void EffectsHandlerImpl::addRepaintFull() { m_compositor->addRepaintFull(); @@ -1663,47 +1556,6 @@ void EffectWindowImpl::elevate(bool elevate) effects->setElevatedWindow(this, elevate); } -void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item) -{ - if (WindowThumbnailItem *thumb = qobject_cast(item)) { - insertThumbnail(thumb); - connect(thumb, SIGNAL(destroyed(QObject*)), SLOT(thumbnailDestroyed(QObject*))); - connect(thumb, SIGNAL(wIdChanged(qulonglong)), SLOT(thumbnailTargetChanged())); - } else if (DesktopThumbnailItem *desktopThumb = qobject_cast(item)) { - m_desktopThumbnails.append(desktopThumb); - connect(desktopThumb, SIGNAL(destroyed(QObject*)), SLOT(desktopThumbnailDestroyed(QObject*))); - } -} - -void EffectWindowImpl::thumbnailDestroyed(QObject *object) -{ - // we know it is a ThumbnailItem - m_thumbnails.remove(static_cast(object)); -} - -void EffectWindowImpl::thumbnailTargetChanged() -{ - if (WindowThumbnailItem *item = qobject_cast(sender())) { - insertThumbnail(item); - } -} - -void EffectWindowImpl::insertThumbnail(WindowThumbnailItem *item) -{ - EffectWindow *w = effects->findWindow(item->wId()); - if (w) { - m_thumbnails.insert(item, QWeakPointer(static_cast(w))); - } else { - m_thumbnails.insert(item, QWeakPointer()); - } -} - -void EffectWindowImpl::desktopThumbnailDestroyed(QObject *object) -{ - // we know it is a DesktopThumbnailItem - m_desktopThumbnails.removeAll(static_cast(object)); -} - void EffectWindowImpl::referencePreviousWindowPixmap() { if (sw) { diff --git a/kwin/effects.h b/kwin/effects.h index 2cfe2b7b..d4aa7aea 100644 --- a/kwin/effects.h +++ b/kwin/effects.h @@ -23,26 +23,20 @@ along with this program. If not, see . #define KWIN_EFFECTSIMPL_H #include "kwineffects.h" - #include "scene.h" #include "xcbutils.h" #include #include - #include #include + class KService; class OrgFreedesktopScreenSaverInterface; - namespace KWin { -class AbstractThumbnailItem; -class DesktopThumbnailItem; -class WindowThumbnailItem; - class Client; class Compositor; class Deleted; @@ -118,16 +112,6 @@ public: virtual EffectWindowList stackingOrder() const; virtual void setElevatedWindow(EffectWindow* w, bool set); - virtual void setTabBoxWindow(EffectWindow*); - virtual void setTabBoxDesktop(int); - virtual EffectWindowList currentTabBoxWindowList() const; - virtual void refTabBox(); - virtual void unrefTabBox(); - virtual void closeTabBox(); - virtual QList< int > currentTabBoxDesktopList() const; - virtual int currentTabBoxDesktop() const; - virtual EffectWindow* currentTabBoxWindow() const; - virtual void setActiveFullScreenEffect(Effect* e); virtual Effect* activeFullScreenEffect() const; @@ -193,10 +177,6 @@ public: } public Q_SLOTS: - void slotCurrentTabAboutToChange(EffectWindow* from, EffectWindow* to); - void slotTabAdded(EffectWindow* from, EffectWindow* to); - void slotTabRemoved(EffectWindow* c, EffectWindow* newActiveWindow); - // slots for D-Bus interface Q_SCRIPTABLE void reconfigureEffect(const QString& name); Q_SCRIPTABLE bool loadEffect(const QString& name, bool checkDefault = false); @@ -304,24 +284,10 @@ public: void setData(int role, const QVariant &data); QVariant data(int role) const; - void registerThumbnail(AbstractThumbnailItem *item); - QHash > const &thumbnails() const { - return m_thumbnails; - } - QList const &desktopThumbnails() const { - return m_desktopThumbnails; - } -private Q_SLOTS: - void thumbnailDestroyed(QObject *object); - void thumbnailTargetChanged(); - void desktopThumbnailDestroyed(QObject *object); private: - void insertThumbnail(WindowThumbnailItem *item); Toplevel* toplevel; Scene::Window* sw; // This one is used only during paint pass. QHash dataMap; - QHash > m_thumbnails; - QList m_desktopThumbnails; }; class EffectWindowGroupImpl diff --git a/kwin/effects/presentwindows/CMakeLists.txt b/kwin/effects/presentwindows/CMakeLists.txt index 021c54dd..b13f8e76 100644 --- a/kwin/effects/presentwindows/CMakeLists.txt +++ b/kwin/effects/presentwindows/CMakeLists.txt @@ -12,7 +12,6 @@ kde4_add_kcfg_files(kwin4_effect_builtins_sources effects/presentwindows/present # .desktop files install(FILES effects/presentwindows/presentwindows.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin) -install(FILES effects/presentwindows/main.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/effects/presentwindows) ####################################### # Config diff --git a/kwin/effects/presentwindows/main.qml b/kwin/effects/presentwindows/main.qml deleted file mode 100644 index 762d8043..00000000 --- a/kwin/effects/presentwindows/main.qml +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as Plasma - -Item { - Plasma.Button { - id: closeButton - objectName: "closeButton" - width: 32 - height: 32 - iconSource: "window-close" - } -} diff --git a/kwin/effects/presentwindows/presentwindows.cpp b/kwin/effects/presentwindows/presentwindows.cpp index 8bfa43c7..c1657b9d 100755 --- a/kwin/effects/presentwindows/presentwindows.cpp +++ b/kwin/effects/presentwindows/presentwindows.cpp @@ -26,25 +26,22 @@ along with this program. If not, see . #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 namespace KWin { @@ -60,8 +57,6 @@ PresentWindowsEffect::PresentWindowsEffect() , m_needInitialSelection(false) , m_highlightedWindow(NULL) , m_filterFrame(NULL) - , m_closeView(NULL) - , m_closeWindow(NULL) , m_dragInProgress(false) , m_dragWindow(NULL) , m_highlightedDropTarget(NULL) @@ -73,19 +68,19 @@ PresentWindowsEffect::PresentWindowsEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a = (KAction*)actionCollection->addAction("Expose"); a->setText(i18n("Toggle Present Windows (Current desktop)")); - a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9)); + a->setGlobalShortcut(KShortcut(Qt::ALT + Qt::Key_Tab)); shortcut = a->globalShortcut(); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActive())); connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence))); KAction* b = (KAction*)actionCollection->addAction("ExposeAll"); b->setText(i18n("Toggle Present Windows (All desktops)")); - b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10)); + // b->setGlobalShortcut(KShortcut(Qt::ALT + Qt::CTRL + Qt::Key_Tab)); shortcutAll = b->globalShortcut(); connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops())); connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence))); KAction* c = (KAction*)actionCollection->addAction("ExposeClass"); c->setText(i18n("Toggle Present Windows (Window class)")); - c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7)); + c->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_Tab)); connect(c, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass())); connect(c, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedClass(QKeySequence))); shortcutClass = c->globalShortcut(); @@ -102,7 +97,6 @@ PresentWindowsEffect::PresentWindowsEffect() PresentWindowsEffect::~PresentWindowsEffect() { delete m_filterFrame; - delete m_closeView; } void PresentWindowsEffect::reconfigure(ReconfigureFlags) @@ -131,7 +125,6 @@ void PresentWindowsEffect::reconfigure(ReconfigureFlags) m_layoutMode = PresentWindowsConfig::layoutMode(); m_showCaptions = PresentWindowsConfig::drawWindowCaptions(); m_showIcons = PresentWindowsConfig::drawWindowIcons(); - m_doNotCloseWindows = !PresentWindowsConfig::allowClosingWindows(); m_ignoreMinimized = PresentWindowsConfig::ignoreMinimized(); m_accuracy = PresentWindowsConfig::accuracy() * 20; m_fillGaps = PresentWindowsConfig::fillGaps(); @@ -198,7 +191,7 @@ void PresentWindowsEffect::postPaintScreen() { if (m_motionManager.areWindowsMoving()) effects->addRepaintFull(); - else if (!m_activated && m_motionManager.managingWindows() && !m_closeWindow) { + else if (!m_activated && m_motionManager.managingWindows()) { // We have finished moving them back, stop processing m_motionManager.unmanageAll(); @@ -246,7 +239,7 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d { // TODO: We should also check to see if any windows are fading just in case fading takes longer // than moving the windows when the effect is deactivated. - if (m_activated || m_motionManager.areWindowsMoving() || m_closeWindow) { + if (m_activated || m_motionManager.areWindowsMoving()) { DataHash::iterator winData = m_windowData.find(w); if (winData == m_windowData.end()) { effects->prePaintWindow(w, data, time); @@ -276,7 +269,7 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d const bool isInMotion = m_motionManager.isManaging(w); // Calculate window's brightness - if (w == m_highlightedWindow || w == m_closeWindow || !m_activated) + if (w == m_highlightedWindow || !m_activated) winData->highlight = qMin(1.0, winData->highlight + time / m_fadeDuration); else if (!isInMotion && w->isDesktop()) winData->highlight = 0.3; @@ -291,9 +284,6 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d // we have to keep the window in the list to prevent flickering winData->referenced = false; w->unrefWindow(); - if (w == m_closeWindow) { - m_closeWindow = NULL; - } } else w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); } @@ -416,21 +406,6 @@ void PresentWindowsEffect::slotWindowAdded(EffectWindow *w) m_motionManager.manage(w); rearrangeWindows(); } - if (m_closeView && w == effects->findWindow(m_closeView->winId())) { - if (m_closeWindow != w) { - DataHash::iterator winDataIt = m_windowData.find(m_closeWindow); - if (winDataIt != m_windowData.end()) { - if (winDataIt->referenced) { - m_closeWindow->unrefWindow(); - } - m_windowData.erase(winDataIt); - } - } - winData->visible = true; - winData->highlight = 1.0; - m_closeWindow = w; - w->setData(WindowForceBlurRole, QVariant(true)); - } } void PresentWindowsEffect::slotWindowClosed(EffectWindow *w) @@ -447,9 +422,6 @@ void PresentWindowsEffect::slotWindowClosed(EffectWindow *w) } if (m_highlightedWindow == w) setHighlightedWindow(findFirstWindow()); - if (m_closeWindow == w) { - return; // don't rearrange, get's nulled when unref'd - } rearrangeWindows(); foreach (EffectWindow *w, m_motionManager.managedWindows()) { @@ -509,18 +481,6 @@ bool PresentWindowsEffect::borderActivated(ElectricBorder border) void PresentWindowsEffect::windowInputMouseEvent(QEvent *e) { QMouseEvent* me = static_cast< QMouseEvent* >(e); - if (m_closeView && m_closeView->geometry().contains(me->pos())) { - if (!m_closeView->isVisible()) { - updateCloseWindow(); - } - if (m_closeView->isVisible()) { - const QPoint widgetPos = m_closeView->mapFromGlobal(me->pos()); -// const QPointF scenePos = m_closeView->mapToScene(widgetPos); - QMouseEvent event(me->type(), widgetPos, me->pos(), me->button(), me->buttons(), me->modifiers()); - m_closeView->windowInputMouseEvent(&event); - return; - } - } // Which window are we hovering over? Always trigger as we don't always get move events before clicking // We cannot use m_motionManager.windowAtPoint() as the window might not be visible EffectWindowList windows = m_motionManager.managedWindows(); @@ -540,10 +500,6 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e) } if (!hovering) setHighlightedWindow(NULL); - if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(me->pos())) - updateCloseWindow(); - else if (m_closeView) - m_closeView->hide(); if (e->type() == QEvent::MouseButtonRelease) { if (highlightCandidate) @@ -868,8 +824,6 @@ void PresentWindowsEffect::rearrangeWindows() return; effects->addRepaintFull(); // Trigger the first repaint - if (m_closeView) - m_closeView->hide(); // Work out which windows are on which screens EffectWindowList windowlist; @@ -1470,16 +1424,10 @@ void PresentWindowsEffect::setActive(bool active) m_activated = active; if (m_activated) { m_needInitialSelection = true; - m_closeButtonCorner = (Qt::Corner)effects->kwinOption(KWin::CloseButtonCorner).toInt(); m_decalOpacity = 0.0; m_highlightedWindow = NULL; m_windowFilter.clear(); - if (!m_doNotCloseWindows) { - m_closeView = new CloseWindowView(); - connect(m_closeView, SIGNAL(close()), SLOT(closeWindow())); - } - // Add every single window to m_windowData (Just calling [w] creates it) foreach (EffectWindow * w, effects->stackingOrder()) { DataHash::iterator winData; @@ -1558,8 +1506,6 @@ void PresentWindowsEffect::setActive(bool active) winData->visible = (w->isOnDesktop(desktop) || w->isOnAllDesktops()) && !w->isMinimized() && (w->isCurrentTab() || winData->visible); } - delete m_closeView; - m_closeView = 0; while (!m_dropTargets.empty()) { delete m_dropTargets.takeFirst(); } @@ -1622,8 +1568,6 @@ bool PresentWindowsEffect::isSelectableWindow(EffectWindow *w) return false; if (w->isSkipSwitcher()) return false; - if (m_closeView && w == effects->findWindow(m_closeView->winId())) - return false; if (m_ignoreMinimized && w->isMinimized()) return false; switch(m_mode) { @@ -1653,8 +1597,6 @@ void PresentWindowsEffect::setHighlightedWindow(EffectWindow *w) if (w == m_highlightedWindow || (w != NULL && !m_motionManager.isManaging(w))) return; - if (m_closeView) - m_closeView->hide(); if (m_highlightedWindow) { effects->setElevatedWindow(m_highlightedWindow, false); m_highlightedWindow->addRepaintFull(); // Trigger the first repaint @@ -1664,64 +1606,6 @@ void PresentWindowsEffect::setHighlightedWindow(EffectWindow *w) effects->setElevatedWindow(m_highlightedWindow, true); m_highlightedWindow->addRepaintFull(); // Trigger the first repaint } - - updateCloseWindow(); -} - -void PresentWindowsEffect::elevateCloseWindow() -{ - if (!m_closeView) - return; - if (EffectWindow *cw = effects->findWindow(m_closeView->winId())) - effects->setElevatedWindow(cw, true); -} - -void PresentWindowsEffect::updateCloseWindow() -{ - if (!m_closeView || m_doNotCloseWindows) - return; - if (!m_highlightedWindow || m_highlightedWindow->isDesktop()) { - m_closeView->hide(); - return; - } - if (m_closeView->isVisible()) - return; - - const QRectF rect(m_motionManager.targetGeometry(m_highlightedWindow)); - if (2*m_closeView->sceneRect().width() > rect.width() && 2*m_closeView->sceneRect().height() > rect.height()) { - // not for tiny windows (eg. with many windows) - they might become unselectable - m_closeView->hide(); - return; - } - QRect cvr(QPoint(0,0), m_closeView->sceneRect().size().toSize()); - switch (m_closeButtonCorner) - { - case Qt::TopLeftCorner: - default: - cvr.moveTopLeft(rect.topLeft().toPoint()); break; - case Qt::TopRightCorner: - cvr.moveTopRight(rect.topRight().toPoint()); break; - case Qt::BottomLeftCorner: - cvr.moveBottomLeft(rect.bottomLeft().toPoint()); break; - case Qt::BottomRightCorner: - cvr.moveBottomRight(rect.bottomRight().toPoint()); break; - } - m_closeView->setGeometry(cvr); - if (rect.contains(effects->cursorPos())) { - m_closeView->show(); - m_closeView->disarm(); - // to wait for the next event cycle (or more if the show takes more time) - // TODO: make the closeWindow a graphicsviewitem? why should there be an extra scene to be used in an exiting scene?? - QTimer::singleShot(50, this, SLOT(elevateCloseWindow())); - } - else - m_closeView->hide(); -} - -void PresentWindowsEffect::closeWindow() -{ - if (m_highlightedWindow) - m_highlightedWindow->closeWindow(); } EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const @@ -1935,64 +1819,6 @@ void PresentWindowsEffect::screenCountChanged() rearrangeWindows(); } -/************************************************ -* CloseWindowView -************************************************/ -CloseWindowView::CloseWindowView(QWidget *parent) - : QDeclarativeView(parent) - , m_armTimer(new QTimer(this)) -{ - setWindowFlags(Qt::X11BypassWindowManagerHint); - setAttribute(Qt::WA_TranslucentBackground); - QPalette pal = palette(); - pal.setColor(backgroundRole(), Qt::transparent); - setPalette(pal); - foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) { - engine()->addImportPath(importPath); - } - KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(engine()); - kdeclarative.initialize(); - kdeclarative.setupBindings(); - - setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/presentwindows/main.qml")))); - if (QObject *item = rootObject()->findChild("closeButton")) { - connect(item, SIGNAL(clicked()), SIGNAL(close())); - } - - // setup the timer - attempt to prevent accidental clicks - m_armTimer->setSingleShot(true); - m_armTimer->setInterval(350); // 50ms until the window is elevated (seen!) and 300ms more to be "realized" by the user. -} - -void CloseWindowView::windowInputMouseEvent(QMouseEvent *e) -{ - if (e->type() == QEvent::MouseMove) { - mouseMoveEvent(e); - } else if (m_armTimer->isActive()) { - return; - } else if (e->type() == QEvent::MouseButtonPress) { - mousePressEvent(e); - } else if (e->type() == QEvent::MouseButtonDblClick) { - mouseDoubleClickEvent(e); - } else if (e->type() == QEvent::MouseButtonRelease) { - mouseReleaseEvent(e); - } -} - -void CloseWindowView::disarm() -{ - m_armTimer->start(); -} - -void CloseWindowView::hideEvent(QHideEvent *event) -{ - const QPoint globalPos = mapToGlobal(QPoint(-1,-1)); - QMouseEvent me(QEvent::MouseMove, QPoint(-1,-1), globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); - mouseMoveEvent(&me); - QDeclarativeView::hideEvent(event); -} - } // namespace #include "moc_presentwindows.cpp" diff --git a/kwin/effects/presentwindows/presentwindows.h b/kwin/effects/presentwindows/presentwindows.h index c8bc5a80..cbd1d71b 100644 --- a/kwin/effects/presentwindows/presentwindows.h +++ b/kwin/effects/presentwindows/presentwindows.h @@ -26,29 +26,11 @@ along with this program. If not, see . #include #include -#include - #include +#include namespace KWin { -class CloseWindowView : public QDeclarativeView -{ - Q_OBJECT -public: - explicit CloseWindowView(QWidget *parent = 0); - void windowInputMouseEvent(QMouseEvent* e); - void disarm(); - -Q_SIGNALS: - void close(); - -protected: - void hideEvent(QHideEvent *event); - -private: - QTimer* m_armTimer; -}; /** * Expose-like effect which shows all windows on current desktop side-by-side, @@ -61,7 +43,6 @@ class PresentWindowsEffect Q_PROPERTY(int layoutMode READ layoutMode) Q_PROPERTY(bool showCaptions READ isShowCaptions) Q_PROPERTY(bool showIcons READ isShowIcons) - Q_PROPERTY(bool doNotCloseWindows READ isDoNotCloseWindows) Q_PROPERTY(bool ignoreMinimized READ isIgnoreMinimized) Q_PROPERTY(int accuracy READ accuracy) Q_PROPERTY(bool fillGaps READ isFillGaps) @@ -147,9 +128,6 @@ public: bool isShowIcons() const { return m_showIcons; } - bool isDoNotCloseWindows() const { - return m_doNotCloseWindows; - } bool isIgnoreMinimized() const { return m_ignoreMinimized; } @@ -212,8 +190,6 @@ public slots: void slotPropertyNotify(KWin::EffectWindow* w, long atom); private slots: - void closeWindow(); - void elevateCloseWindow(); void screenCountChanged(); protected: @@ -249,7 +225,6 @@ protected: void setHighlightedWindow(EffectWindow *w); EffectWindow* relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const; EffectWindow* findFirstWindow() const; - void updateCloseWindow(); // Helper functions for mouse actions void mouseActionWindow(WindowMouseAction& action); @@ -266,7 +241,6 @@ private: int m_layoutMode; bool m_showCaptions; bool m_showIcons; - bool m_doNotCloseWindows; int m_accuracy; bool m_fillGaps; double m_fadeDuration; @@ -316,10 +290,6 @@ private: DesktopMouseAction m_middleButtonDesktop; DesktopMouseAction m_rightButtonDesktop; - CloseWindowView* m_closeView; - EffectWindow* m_closeWindow; - Qt::Corner m_closeButtonCorner; - // drag to close QPoint m_dragStart; bool m_dragInProgress; diff --git a/kwin/effects/presentwindows/presentwindows.kcfg b/kwin/effects/presentwindows/presentwindows.kcfg index bf424a4a..59b6b8a0 100644 --- a/kwin/effects/presentwindows/presentwindows.kcfg +++ b/kwin/effects/presentwindows/presentwindows.kcfg @@ -6,7 +6,7 @@ - 0 + 1 true @@ -14,9 +14,6 @@ true - - true - false diff --git a/kwin/effects/presentwindows/presentwindows_config.ui b/kwin/effects/presentwindows/presentwindows_config.ui index 19562a1a..5170ced7 100644 --- a/kwin/effects/presentwindows/presentwindows_config.ui +++ b/kwin/effects/presentwindows/presentwindows_config.ui @@ -440,13 +440,6 @@ - - - - Provide buttons to close the windows - - - @@ -469,7 +462,6 @@ kcfg_LayoutMode kcfg_DrawWindowCaptions kcfg_DrawWindowIcons - kcfg_AllowClosingWindows kcfg_IgnoreMinimized kcfg_Accuracy kcfg_FillGaps diff --git a/kwin/effects/slideback/slideback.cpp b/kwin/effects/slideback/slideback.cpp index 003ae29c..b87eb7c1 100644 --- a/kwin/effects/slideback/slideback.cpp +++ b/kwin/effects/slideback/slideback.cpp @@ -25,14 +25,11 @@ namespace KWin SlideBackEffect::SlideBackEffect() { - m_tabboxActive = 0; m_justMapped = m_upmostWindow = NULL; connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), SLOT(slotWindowAdded(KWin::EffectWindow*))); connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), SLOT(slotWindowDeleted(KWin::EffectWindow*))); connect(effects, SIGNAL(windowUnminimized(KWin::EffectWindow*)), SLOT(slotWindowUnminimized(KWin::EffectWindow*))); - connect(effects, SIGNAL(tabBoxAdded(int)), SLOT(slotTabBoxAdded())); connect(effects, SIGNAL(stackingOrderChanged()), SLOT(slotStackingOrderChanged())); - connect(effects, SIGNAL(tabBoxClosed()), SLOT(slotTabBoxClosed())); } static inline bool windowsShareDesktop(EffectWindow *w1, EffectWindow *w2) @@ -43,7 +40,7 @@ static inline bool windowsShareDesktop(EffectWindow *w1, EffectWindow *w2) void SlideBackEffect::slotStackingOrderChanged() { - if (effects->activeFullScreenEffect() || m_tabboxActive) { + if (effects->activeFullScreenEffect()) { oldStackingOrder = effects->stackingOrder(); usableOldStackingOrder = usableWindows(oldStackingOrder); return; @@ -278,16 +275,6 @@ void SlideBackEffect::slotWindowUnminimized(EffectWindow* w) m_justMapped = w; } -void SlideBackEffect::slotTabBoxAdded() -{ - ++m_tabboxActive; -} - -void SlideBackEffect::slotTabBoxClosed() -{ - m_tabboxActive = qMax(m_tabboxActive-1, 0); -} - bool SlideBackEffect::isWindowUsable(EffectWindow* w) { return w && (w->isNormalWindow() || w->isDialog()) && !w->keepAbove() && !w->isDeleted() && !w->isMinimized() diff --git a/kwin/effects/slideback/slideback.h b/kwin/effects/slideback/slideback.h index 2bed4a07..ccc6861e 100644 --- a/kwin/effects/slideback/slideback.h +++ b/kwin/effects/slideback/slideback.h @@ -47,8 +47,6 @@ public Q_SLOTS: void slotWindowDeleted(KWin::EffectWindow *w); void slotWindowUnminimized(KWin::EffectWindow *w); void slotStackingOrderChanged(); - void slotTabBoxAdded(); - void slotTabBoxClosed(); private: @@ -59,7 +57,6 @@ private: EffectWindowList elevatedList; EffectWindow *m_justMapped, *m_upmostWindow; QHash destinationList; - int m_tabboxActive; QList clippedRegions; QRect getSlideDestination(const QRect &windowUnderGeometry, const QRect &windowOverGeometry); diff --git a/kwin/events.cpp b/kwin/events.cpp index ea7c94fe..9fc7205f 100644 --- a/kwin/events.cpp +++ b/kwin/events.cpp @@ -34,9 +34,6 @@ along with this program. If not, see . #include "netinfo.h" #include "workspace.h" #include "atoms.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif #include "group.h" #include "overlaywindow.h" #include "rules.h" @@ -96,14 +93,6 @@ bool Workspace::workspaceEvent(XEvent * e) was_user_interaction = true; // fallthrough case MotionNotify: -#ifdef KWIN_BUILD_TABBOX - if (TabBox::TabBox::self()->isGrabbed()) { -#ifdef KWIN_BUILD_SCREENEDGES - ScreenEdges::self()->check(QPoint(e->xbutton.x_root, e->xbutton.y_root), QDateTime::fromMSecsSinceEpoch(xTime()), true); -#endif - return TabBox::TabBox::self()->handleMouseEvent(e); - } -#endif if (effects && static_cast(effects)->checkInputWindowEvent(e)) { return true; } @@ -122,22 +111,10 @@ bool Workspace::workspaceEvent(XEvent * e) movingClient->keyPressEvent(keyQt); return true; } -#ifdef KWIN_BUILD_TABBOX - if (TabBox::TabBox::self()->isGrabbed()) { - TabBox::TabBox::self()->keyPress(keyQt); - return true; - } -#endif break; } case KeyRelease: was_user_interaction = true; -#ifdef KWIN_BUILD_TABBOX - if (TabBox::TabBox::self()->isGrabbed()) { - TabBox::TabBox::self()->keyRelease(e->xkey); - return true; - } -#endif break; case ConfigureNotify: if (e->xconfigure.event == rootWindow()) @@ -715,8 +692,6 @@ void Client::propertyNotifyEvent(XPropertyEvent* e) getSyncCounter(); else if (e->atom == atoms->kde_net_wm_block_compositing) updateCompositeBlocking(true); - else if (e->atom == atoms->kde_first_in_window_list) - updateFirstInTabBox(); break; } } @@ -865,7 +840,7 @@ void Client::updateMouseGrab() grabButton(None); return; } - if (isActive() && !workspace()->forcedGlobalMouseGrab()) { // see Workspace::establishTabBoxGrab() + if (isActive() && !workspace()->forcedGlobalMouseGrab()) { // first grab all modifier combinations XGrabButton(display(), AnyButton, AnyModifier, wrapperId(), false, ButtonPressMask, diff --git a/kwin/focuschain.h b/kwin/focuschain.h index 3eed84eb..43f404c8 100644 --- a/kwin/focuschain.h +++ b/kwin/focuschain.h @@ -36,9 +36,9 @@ class Client; * A focus chain is a list of Clients containing information on which Client should be activated. * * Internally this FocusChain holds multiple independent chains. There is one chain of most recently - * used Clients which is primarily used by TabBox to build up the list of Clients for navigation. - * The chains are organized as a normal QList of Clients with the most recently used Client being the - * last item of the list, that is a LIFO like structure. + * used Clients which is primarily used to build up the list of Clients for navigation. The chains + * are organized as a normal QList of Clients with the most recently used Client being the last item + * of the list, that is a LIFO like structure. * * In addition there is one chain for each virtual desktop which is used to determine which Client * should get activated when the user switches to another virtual desktop. diff --git a/kwin/kcmkwin/CMakeLists.txt b/kwin/kcmkwin/CMakeLists.txt index f3891057..21ab2e8c 100644 --- a/kwin/kcmkwin/CMakeLists.txt +++ b/kwin/kcmkwin/CMakeLists.txt @@ -1,12 +1,7 @@ add_subdirectory( kwinoptions ) -add_subdirectory( kwindecoration ) add_subdirectory( kwinrules ) add_subdirectory( kwincompositing ) if(KWIN_BUILD_SCREENEDGES) add_subdirectory( kwinscreenedges ) endif() add_subdirectory( kwindesktop ) - -if( KWIN_BUILD_TABBOX ) - add_subdirectory( kwintabbox ) -endif() diff --git a/kwin/kcmkwin/kwindecoration/CMakeLists.txt b/kwin/kcmkwin/kwindecoration/CMakeLists.txt deleted file mode 100644 index bc142db5..00000000 --- a/kwin/kcmkwin/kwindecoration/CMakeLists.txt +++ /dev/null @@ -1,66 +0,0 @@ -# need a header file from Aurorae sources -include_directories( - ${CMAKE_SOURCE_DIR}/kwin/clients/aurorae/src/lib -) - -set(AURORAE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/kwin/clients/aurorae/src/lib/) - -set(kcm_kwindecoration_PART_SRCS - kwindecoration.cpp - buttons.cpp - buttonsconfigdialog.cpp - configdialog.cpp - preview.cpp - decorationmodel.cpp - ${AURORAE_SOURCE_DIR}/auroraetheme.cpp - ${AURORAE_SOURCE_DIR}/themeconfig.cpp - auroraeconfig.ui - buttons.ui - config.ui - decoration.ui -) - -kde4_add_plugin(kcm_kwindecoration ${kcm_kwindecoration_PART_SRCS}) -target_link_libraries(kcm_kwindecoration - KDE4::plasma - ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTUITOOLS_LIBRARY} - ${X11_LIBRARIES} - kdecorations -) - -install( - TARGETS kcm_kwindecoration - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -########### install files ############### - -install( - FILES kwindecoration.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) -install( - FILES - qml/main.qml - qml/AuroraeDecoration.qml - qml/AuroraePreview.qml - qml/DecorationPreview.qml - DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/kcm_kwindecoration -) - -install( - FILES - buttons/close.png - buttons/help.png - buttons/keepaboveothers.png - buttons/keepbelowothers.png - buttons/maximize.png - buttons/menu.png - buttons/minimize.png - buttons/onalldesktops.png - buttons/resize.png - buttons/shade.png - buttons/spacer.png - DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/kcm_kwindecoration/buttons -) diff --git a/kwin/kcmkwin/kwindecoration/Messages.sh b/kwin/kcmkwin/kwindecoration/Messages.sh deleted file mode 100644 index cdaa6e82..00000000 --- a/kwin/kcmkwin/kwindecoration/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11 -$XGETTEXT *.cpp -o $podir/kcmkwindecoration.pot -rm -f rc.cpp diff --git a/kwin/kcmkwin/kwindecoration/auroraeconfig.ui b/kwin/kcmkwin/kwindecoration/auroraeconfig.ui deleted file mode 100644 index 1648eb05..00000000 --- a/kwin/kcmkwin/kwindecoration/auroraeconfig.ui +++ /dev/null @@ -1,136 +0,0 @@ - - - KWinAuroraeConfigForm - - - - 0 - 0 - 384 - 95 - - - - - - - - - Border size: - - - borderSizesCombo - - - - - - - - Tiny - - - - - Normal - - - - - Large - - - - - Very Large - - - - - Huge - - - - - Very Huge - - - - - Oversized - - - - - - - - Button size: - - - buttonSizesCombo - - - - - - - - Tiny - - - - - Normal - - - - - Large - - - - - Very Large - - - - - Huge - - - - - Very Huge - - - - - Oversized - - - - - - - - - - - - - Close windows by double clicking the menu button - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- -
diff --git a/kwin/kcmkwin/kwindecoration/buttons.cpp b/kwin/kcmkwin/kwindecoration/buttons.cpp deleted file mode 100644 index 2eb929c1..00000000 --- a/kwin/kcmkwin/kwindecoration/buttons.cpp +++ /dev/null @@ -1,809 +0,0 @@ -/* - This is the new kwindecoration kcontrol module - - Copyright (c) 2009, Urs Wolfer - Copyright (c) 2004, Sandro Giessl - Copyright (c) 2001 - Karol Szwed - http://gallium.n3.net/ - - Supports new kwin configuration plugins, and titlebar button position - modification via dnd interface. - - Based on original "kwintheme" (Window Borders) - 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 - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -*/ - -#include "buttons.h" -#include "config-kwin.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define BUTTONDRAGMIMETYPE "application/x-kde_kwindecoration_buttons" - -namespace KWin -{ - -// helper functions to deal with the Button's bitmaps more easily... -static QBitmap buttonBitmap(const char* const bitmapname) -{ - QByteArray bitmapnamebytes("kwin/kcm_kwindecoration/buttons/"); - bitmapnamebytes.append(bitmapname); - bitmapnamebytes.append(".png"); - const QString bitmapfilepath = KGlobal::dirs()->findResource("data", bitmapnamebytes.constData()); - if (bitmapfilepath.isEmpty()) { - kWarning() << "No button image for" << bitmapname; - return QBitmap(); - } - - const QImage image(bitmapfilepath); - QBitmap bmp = QBitmap::fromImage(image); - bmp.createMaskFromColor(Qt::white); - return bmp; -} - -static QPixmap bitmapPixmap(const QBitmap& bm, const QColor& color) -{ - QPixmap pm(bm.size()); - pm.fill(Qt::white); - QPainter p(&pm); - p.setPen(color); - p.drawPixmap(0, 0, bm); - p.end(); - pm.setMask(pm.createMaskFromColor(Qt::white)); - return pm; -} - - -ButtonDrag::ButtonDrag(Button btn) - : QMimeData() -{ - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - stream << btn.name; - stream << btn.icon; - stream << btn.type.unicode(); - stream << (int) btn.duplicate; - stream << (int) btn.supported; - setData(BUTTONDRAGMIMETYPE, data); -} - - -bool ButtonDrag::canDecode(QDropEvent* e) -{ - return e->mimeData()->hasFormat(BUTTONDRAGMIMETYPE); -} - -bool ButtonDrag::decode(QDropEvent* e, Button& btn) -{ - QByteArray data = e->mimeData()->data(BUTTONDRAGMIMETYPE); - if (data.size()) { - e->accept(); - QDataStream stream(data); - stream >> btn.name; - stream >> btn.icon; - ushort type; - stream >> type; - btn.type = QChar(type); - int duplicate; - stream >> duplicate; - btn.duplicate = duplicate; - int supported; - stream >> supported; - btn.supported = supported; - return true; - } - return false; -} - - -Button::Button() -{ -} - -Button::Button(const QString& n, const QBitmap& i, QChar t, bool d, bool s) - : name(n), - icon(i), - type(t), - duplicate(d), - supported(s) -{ -} - -Button::~Button() -{ -} - -ButtonSource::ButtonSource(QWidget *parent) - : QListWidget(parent) -{ - setDragEnabled(true); - setAcceptDrops(true); - setDropIndicatorShown(false); - setSortingEnabled(true); -} - -ButtonSource::~ButtonSource() -{ -} - -QSize ButtonSource::sizeHint() const -{ - // make the sizeHint height a bit smaller than the one of QListView... - - ensurePolished(); - - QSize s; - if (verticalScrollBar()->isVisible()) - s.setWidth(s.width() + style()->pixelMetric(QStyle::PM_ScrollBarExtent)); - s += QSize(frameWidth() * 2, frameWidth() * 2); - - // size hint: 4 lines of text... - s.setHeight(s.height() + fontMetrics().lineSpacing() * 3); - - return s; -} - -void ButtonSource::hideAllButtons() -{ - for (int i = 0; i < count(); i++) { - item(i)->setHidden(true); - } -} - -void ButtonSource::showAllButtons() -{ - for (int i = 0; i < count(); i++) { - item(i)->setHidden(false); - } -} - -void ButtonSource::showButton(QChar btn) -{ - for (int i = 0; i < count(); i++) { - ButtonSourceItem *buttonItem = dynamic_cast(item(i)); - if (buttonItem && buttonItem->button().type == btn) { - item(i)->setHidden(false); - return; - } - } -} - -void ButtonSource::hideButton(QChar btn) -{ - for (int i = 0; i < count(); i++) { - ButtonSourceItem *buttonItem = dynamic_cast(item(i)); - if (buttonItem && buttonItem->button().type == btn && !buttonItem->button().duplicate) { - item(i)->setHidden(true); - return; - } - } -} - -void ButtonSource::dragMoveEvent(QDragMoveEvent *e) -{ - e->setAccepted(ButtonDrag::canDecode(e)); -} - -void ButtonSource::dragEnterEvent(QDragEnterEvent *e) -{ - e->setAccepted(ButtonDrag::canDecode(e)); -} - -void ButtonSource::dropEvent(QDropEvent *e) -{ - if (ButtonDrag::canDecode(e)) { - emit dropped(); - e->accept(); - } else { - e->ignore(); - } -} - -void ButtonSource::mousePressEvent(QMouseEvent *e) -{ - ButtonSourceItem *i = dynamic_cast(itemAt(e->pos())); - - if (i) { - ButtonDrag *bd = new ButtonDrag(i->button()); - QDrag *drag = new QDrag(this); - drag->setMimeData(bd); - drag->setPixmap(bitmapPixmap(i->button().icon, palette().color(QPalette::WindowText))); - drag->exec(); - } -} - -ButtonDropSiteItem::ButtonDropSiteItem(const Button& btn) - : m_button(btn) -{ -} - -ButtonDropSiteItem::~ButtonDropSiteItem() -{ -} - -Button ButtonDropSiteItem::button() -{ - return m_button; -} - -int ButtonDropSiteItem::width() -{ -// return m_button.icon.width(); - return 20; -} - -int ButtonDropSiteItem::height() -{ -// return m_button.icon.height(); - return 20; -} - -void ButtonDropSiteItem::draw(QPainter *p, const QPalette& cg, const QRect &r) -{ - if (m_button.supported) - p->setPen(cg.color(QPalette::WindowText)); - else - p->setPen(cg.color(QPalette::Disabled, QPalette::WindowText)); - QBitmap &i = m_button.icon; - p->drawPixmap(r.left() + (r.width() - i.width()) / 2, r.top() + (r.height() - i.height()) / 2, i); -} - - -ButtonDropSite::ButtonDropSite(QWidget* parent) - : QFrame(parent), - m_selected(0) -{ - setAcceptDrops(true); - setFrameShape(WinPanel); - setFrameShadow(Raised); - setMinimumHeight(26); - setMaximumHeight(26); - setMinimumWidth(250); // Ensure buttons will fit - setCursor(Qt::OpenHandCursor); -} - -ButtonDropSite::~ButtonDropSite() -{ - clearLeft(); - clearRight(); -} - -void ButtonDropSite::clearLeft() -{ - while (!buttonsLeft.isEmpty()) { - ButtonDropSiteItem *item = buttonsLeft.first(); - if (removeButton(item)) { - emit buttonRemoved(item->button().type); - delete item; - } - } -} - -void ButtonDropSite::clearRight() -{ - while (!buttonsRight.isEmpty()) { - ButtonDropSiteItem *item = buttonsRight.first(); - if (removeButton(item)) { - emit buttonRemoved(item->button().type); - delete item; - } - } -} - -void ButtonDropSite::dragMoveEvent(QDragMoveEvent* e) -{ - QPoint p = e->pos(); - if (leftDropArea().contains(p) || rightDropArea().contains(p) || buttonAt(p)) { - e->accept(); - - // 2 pixel wide drop visualizer... - QRect r = contentsRect(); - int x = -1; - if (leftDropArea().contains(p)) { - x = leftDropArea().left(); - } else if (rightDropArea().contains(p)) { - x = rightDropArea().right() + 1; - } else { - ButtonDropSiteItem *item = buttonAt(p); - if (item) { - if (p.x() < item->rect.left() + item->rect.width() / 2) { - x = item->rect.left(); - } else { - x = item->rect.right() + 1; - } - } - } - if (x != -1) { - QRect tmpRect(x, r.y(), 2, r.height()); - if (tmpRect != m_oldDropVisualizer) { - cleanDropVisualizer(); - m_oldDropVisualizer = tmpRect; - update(tmpRect); - } - } - - } else { - e->ignore(); - - cleanDropVisualizer(); - } -} - -void ButtonDropSite::cleanDropVisualizer() -{ - if (m_oldDropVisualizer.isValid()) { - QRect rect = m_oldDropVisualizer; - m_oldDropVisualizer = QRect(); // rect is invalid - update(rect); - } -} - -void ButtonDropSite::dragEnterEvent(QDragEnterEvent* e) -{ - if (ButtonDrag::canDecode(e)) - e->accept(); -} - -void ButtonDropSite::dragLeaveEvent(QDragLeaveEvent* /* e */) -{ - cleanDropVisualizer(); -} - -void ButtonDropSite::dropEvent(QDropEvent* e) -{ - cleanDropVisualizer(); - - QPoint p = e->pos(); - - // collect information where to insert the dropped button - ButtonList *buttonList = 0; - int buttonPosition; - - if (leftDropArea().contains(p)) { - buttonList = &buttonsLeft; - buttonPosition = buttonsLeft.size(); - } else if (rightDropArea().contains(p)) { - buttonList = &buttonsRight; - buttonPosition = 0; - } else { - ButtonDropSiteItem *aboveItem = buttonAt(p); - if (!aboveItem) - return; // invalid drop. hasn't occurred _over_ a button (or left/right dropArea), return... - - int pos; - if (!getItemPos(aboveItem, buttonList, pos)) { - // didn't find the aboveItem. unlikely to happen since buttonAt() already seems to have found - // something valid. anyway... - return; - } - - // got the list and the aboveItem position. now determine if the item should be inserted - // before aboveItem or after aboveItem. - QRect aboveItemRect = aboveItem->rect; - if (!aboveItemRect.isValid()) - return; - - if (p.x() < aboveItemRect.left() + aboveItemRect.width() / 2) { - // insert before the item - buttonPosition = pos; - } else { - buttonPosition = pos + 1; - } - } - - // know where to insert the button. now see if we can use an existing item (drag within the widget = move) - // orneed to create a new one - ButtonDropSiteItem *buttonItem = 0; - if (e->source() == this && m_selected) { - ButtonList *oldList = 0; - int oldPos; - if (getItemPos(m_selected, oldList, oldPos)) { - if (oldPos == buttonPosition && oldList == buttonList) - return; // button didn't change its position during the drag... - - oldList->removeAt(oldPos); - buttonItem = m_selected; - - // If we're inserting to the right of oldPos, in the same list, - // better adjust the index.. - if (buttonList == oldList && buttonPosition > oldPos) - --buttonPosition; - } else { - return; // m_selected not found, return... - } - } else { - // create new button from the drop object... - Button btn; - if (ButtonDrag::decode(e, btn)) { - buttonItem = new ButtonDropSiteItem(btn); - } else { - return; // something has gone wrong while we were trying to decode the drop event - } - } - - // now the item can actually be inserted into the list! :) - (*buttonList).insert(buttonPosition, buttonItem); - emit buttonAdded(buttonItem->button().type); - emit changed(); - recalcItemGeometry(); - update(); -} - -bool ButtonDropSite::getItemPos(ButtonDropSiteItem *item, ButtonList* &list, int &pos) -{ - if (!item) - return false; - - pos = buttonsLeft.indexOf(item); // try the left list first... - if (pos >= 0) { - list = &buttonsLeft; - return true; - } - - pos = buttonsRight.indexOf(item); // try the right list... - if (pos >= 0) { - list = &buttonsRight; - return true; - } - - list = 0; - pos = -1; - return false; -} - -QRect ButtonDropSite::leftDropArea() -{ - // return a 10 pixel drop area... - QRect r = contentsRect(); - - int leftButtonsWidth = calcButtonListWidth(buttonsLeft); - return QRect(r.left() + leftButtonsWidth, r.top(), 10, r.height()); -} - -QRect ButtonDropSite::rightDropArea() -{ - // return a 10 pixel drop area... - QRect r = contentsRect(); - - int rightButtonsWidth = calcButtonListWidth(buttonsRight); - return QRect(r.right() - rightButtonsWidth - 10, r.top(), 10, r.height()); -} - -void ButtonDropSite::mousePressEvent(QMouseEvent* e) -{ - QDrag *drag = new QDrag(this); - m_selected = buttonAt(e->pos()); - if (m_selected) { - ButtonDrag *bd = new ButtonDrag(m_selected->button()); - drag->setMimeData(bd); - drag->setPixmap(bitmapPixmap(m_selected->button().icon, palette().color(QPalette::WindowText))); - drag->exec(); - } -} - -void ButtonDropSite::resizeEvent(QResizeEvent*) -{ - recalcItemGeometry(); -} - -void ButtonDropSite::recalcItemGeometry() -{ - QRect r = contentsRect(); - - // update the geometry of the items in the left button list - int offset = r.left(); - for (ButtonList::const_iterator it = buttonsLeft.constBegin(); it != buttonsLeft.constEnd(); ++it) { - int w = (*it)->width(); - (*it)->rect = QRect(offset, r.top(), w, (*it)->height()); - offset += w; - } - - // the right button list... - offset = r.right() - calcButtonListWidth(buttonsRight); - for (ButtonList::const_iterator it = buttonsRight.constBegin(); it != buttonsRight.constEnd(); ++it) { - int w = (*it)->width(); - (*it)->rect = QRect(offset, r.top(), w, (*it)->height()); - offset += w; - } -} - -ButtonDropSiteItem *ButtonDropSite::buttonAt(QPoint p) -{ - // try to find the item in the left button list - for (ButtonList::const_iterator it = buttonsLeft.constBegin(); it != buttonsLeft.constEnd(); ++it) { - if ((*it)->rect.contains(p)) { - return *it; - } - } - - // try to find the item in the right button list - for (ButtonList::const_iterator it = buttonsRight.constBegin(); it != buttonsRight.constEnd(); ++it) { - if ((*it)->rect.contains(p)) { - return *it; - } - } - - return 0; -} - -bool ButtonDropSite::removeButton(ButtonDropSiteItem *item) -{ - if (!item) - return false; - - // try to remove the item from the left button list - if (buttonsLeft.removeAll(item) >= 1) { - return true; - } - - // try to remove the item from the right button list - if (buttonsRight.removeAll(item) >= 1) { - return true; - } - - return false; -} - -int ButtonDropSite::calcButtonListWidth(const ButtonList& btns) -{ - int w = 0; - for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) { - w += (*it)->width(); - } - - return w; -} - -bool ButtonDropSite::removeSelectedButton() -{ - bool succ = removeButton(m_selected); - if (succ) { - emit buttonRemoved(m_selected->button().type); - emit changed(); - delete m_selected; - m_selected = 0; - recalcItemGeometry(); - update(); // repaint... - } - - return succ; -} - -void ButtonDropSite::drawButtonList(QPainter *p, const ButtonList& btns, int offset) -{ - for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) { - QRect itemRect = (*it)->rect; - if (itemRect.isValid()) { - (*it)->draw(p, palette(), itemRect); - } - offset += (*it)->width(); - } -} - -void ButtonDropSite::paintEvent(QPaintEvent* /*pe*/) -{ - QPainter p(this); - int leftoffset = calcButtonListWidth(buttonsLeft); - int rightoffset = calcButtonListWidth(buttonsRight); - int offset = 3; - - QRect r = contentsRect(); - - // Shrink by 1 - r.translate(1 + leftoffset, 1); - r.setWidth(r.width() - 2 - leftoffset - rightoffset); - r.setHeight(r.height() - 2); - - drawButtonList(&p, buttonsLeft, offset); - - QColor c1(palette().color(QPalette::Mid)); - p.fillRect(r, c1); - p.setPen(palette().color(QPalette::WindowText)); - p.setFont(KGlobalSettings::windowTitleFont()); - p.drawText(r.adjusted(4, 0, -4, 0), Qt::AlignLeft | Qt::AlignVCenter, i18n("KDE")); - - offset = geometry().width() - 3 - rightoffset; - drawButtonList(&p, buttonsRight, offset); - - if (m_oldDropVisualizer.isValid()) { - p.fillRect(m_oldDropVisualizer, Qt::Dense4Pattern); - } -} - -ButtonSourceItem::ButtonSourceItem(QListWidget * parent, const Button& btn) - : QListWidgetItem(parent), - m_button(btn) -{ - setButton(btn); -} - -ButtonSourceItem::~ButtonSourceItem() -{ -} - -void ButtonSourceItem::setButton(const Button& btn) -{ - m_button = btn; - if (btn.supported) { - setText(btn.name); - setIcon(bitmapPixmap(btn.icon, QApplication::palette().color(QPalette::Text))); - setForeground(QApplication::palette().brush(QPalette::Text)); - } else { - setText(i18n("%1 (unavailable)", btn.name)); - setIcon(bitmapPixmap(btn.icon, QApplication::palette().color(QPalette::Disabled, QPalette::Text))); - setForeground(QApplication::palette().brush(QPalette::Disabled, QPalette::Text)); - } -} - -Button ButtonSourceItem::button() const -{ - return m_button; -} - - -ButtonPositionWidget::ButtonPositionWidget(QWidget *parent) - : QWidget(parent), - m_factory(0) -{ - QVBoxLayout *layout = new QVBoxLayout(this); - layout->setMargin(0); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - QLabel* label = new QLabel(this); - m_dropSite = new ButtonDropSite(this); - label->setWordWrap(true); - label->setText(i18n("To add or remove titlebar buttons, simply drag items " - "between the available item list and the titlebar preview. Similarly, " - "drag items within the titlebar preview to re-position them.")); - m_buttonSource = new ButtonSource(this); - m_buttonSource->setObjectName(QLatin1String("button_source")); - - layout->addWidget(label); - layout->addWidget(m_dropSite); - layout->addWidget(m_buttonSource); - - connect(m_dropSite, SIGNAL(buttonAdded(QChar)), m_buttonSource, SLOT(hideButton(QChar))); - connect(m_dropSite, SIGNAL(buttonRemoved(QChar)), m_buttonSource, SLOT(showButton(QChar))); - connect(m_buttonSource, SIGNAL(dropped()), m_dropSite, SLOT(removeSelectedButton())); - - connect(m_dropSite, SIGNAL(changed()), SIGNAL(changed())); - - // insert all possible buttons into the source (backwards to keep the preferred order...) - bool dummy; - - m_supportedButtons = "MSHIAX_FBLR"; - - new ButtonSourceItem(m_buttonSource, getButton('R', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('L', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('B', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('F', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('X', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('A', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('I', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('H', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('S', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('M', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('_', dummy)); -} - -ButtonPositionWidget::~ButtonPositionWidget() -{ -} - -Button ButtonPositionWidget::getButton(QChar type, bool& success) -{ - success = true; - - if (type == 'R') { - return Button(i18n("Resize"), buttonBitmap("resize"), 'R', false, m_supportedButtons.contains('R')); - } else if (type == 'L') { - return Button(i18n("Shade"), buttonBitmap("shade"), 'L', false, m_supportedButtons.contains('L')); - } else if (type == 'B') { - return Button(i18n("Keep Below Others"), buttonBitmap("keepbelowothers"), 'B', false, m_supportedButtons.contains('B')); - } else if (type == 'F') { - return Button(i18n("Keep Above Others"), buttonBitmap("keepaboveothers"), 'F', false, m_supportedButtons.contains('F')); - } else if (type == 'X') { - return Button(i18n("Close"), buttonBitmap("close"), 'X', false, m_supportedButtons.contains('X')); - } else if (type == 'A') { - return Button(i18n("Maximize"), buttonBitmap("maximize"), 'A', false, m_supportedButtons.contains('A')); - } else if (type == 'I') { - return Button(i18n("Minimize"), buttonBitmap("minimize"), 'I', false, m_supportedButtons.contains('I')); - } else if (type == 'H') { - return Button(i18n("Help"), buttonBitmap("help"), 'H', false, m_supportedButtons.contains('H')); - } else if (type == 'S') { - return Button(i18n("On All Desktops"), buttonBitmap("onalldesktops"), 'S', false, m_supportedButtons.contains('S')); - } else if (type == 'M') { - return Button(i18nc("Button showing window actions menu", "Window Menu"), buttonBitmap("menu"), 'M', false, m_supportedButtons.contains('M')); - } else if (type == '_') { - return Button(i18n("--- spacer ---"), buttonBitmap("spacer"), '_', true, m_supportedButtons.contains('_')); - } else { - success = false; - return Button(); - } -} - -QString ButtonPositionWidget::buttonsLeft() const -{ - ButtonList btns = m_dropSite->buttonsLeft; - QString btnString = ""; - for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) { - btnString.append((*it)->button().type); - } - return btnString; -} - -QString ButtonPositionWidget::buttonsRight() const -{ - ButtonList btns = m_dropSite->buttonsRight; - QString btnString = ""; - for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) { - btnString.append((*it)->button().type); - } - return btnString; -} - -void ButtonPositionWidget::setButtonsLeft(const QString &buttons) -{ - // to keep the button lists consistent, first remove all left buttons, then add buttons again... - m_dropSite->clearLeft(); - - for (int i = 0; i < buttons.length(); ++i) { - bool succ = false; - Button btn = getButton(buttons[i], succ); - if (succ) { - m_dropSite->buttonsLeft.append(new ButtonDropSiteItem(btn)); - m_buttonSource->hideButton(btn.type); - } - } - m_dropSite->recalcItemGeometry(); - m_dropSite->update(); -} - -void ButtonPositionWidget::setButtonsRight(const QString &buttons) -{ - // to keep the button lists consistent, first remove all left buttons, then add buttons again... - m_dropSite->clearRight(); - - for (int i = 0; i < buttons.length(); ++i) { - bool succ = false; - Button btn = getButton(buttons[i], succ); - if (succ) { - m_dropSite->buttonsRight.append(new ButtonDropSiteItem(btn)); - m_buttonSource->hideButton(btn.type); - } - } - m_dropSite->recalcItemGeometry(); - m_dropSite->update(); -} - -} // namespace KWin - -#include "moc_buttons.cpp" diff --git a/kwin/kcmkwin/kwindecoration/buttons.h b/kwin/kcmkwin/kwindecoration/buttons.h deleted file mode 100644 index f81490c1..00000000 --- a/kwin/kcmkwin/kwindecoration/buttons.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - This is the new kwindecoration kcontrol module - - Copyright (c) 2009, Urs Wolfer - Copyright (c) 2004, Sandro Giessl - Copyright (c) 2001 - Karol Szwed - http://gallium.n3.net/ - - Supports new kwin configuration plugins, and titlebar button position - modification via dnd interface. - - Based on original "kwintheme" (Window Borders) - 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 - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -*/ - -#ifndef BUTTONS_H -#define BUTTONS_H - -#include -#include -#include - -class KDecorationFactory; - -namespace KWin -{ - -/** - * This class holds the button data. - */ -class Button -{ -public: - Button(); - Button(const QString& name, const QBitmap& icon, QChar type, bool duplicate, bool supported); - virtual ~Button(); - - QString name; - QBitmap icon; - QChar type; - bool duplicate; - bool supported; -}; - -class ButtonDrag : public QMimeData -{ -public: - explicit ButtonDrag(Button btn); - ~ButtonDrag() {} - - static bool canDecode(QDropEvent* e); - static bool decode(QDropEvent* e, Button& btn); -}; - -/** - * This is plugged into ButtonDropSite - */ -class ButtonDropSiteItem -{ -public: - explicit ButtonDropSiteItem(const Button& btn); - ~ButtonDropSiteItem(); - - Button button(); - - QRect rect; - int width(); - int height(); - - void draw(QPainter *p, const QPalette& cg, const QRect &rect); - -private: - Button m_button; -}; - -/** - * This is plugged into ButtonSource - */ -class ButtonSourceItem : public QListWidgetItem -{ -public: - ButtonSourceItem(QListWidget * parent, const Button& btn); - virtual ~ButtonSourceItem(); - - void setButton(const Button& btn); - Button button() const; -private: - Button m_button; -}; - -/** - * Implements the button drag source list view - */ -class ButtonSource : public QListWidget -{ - Q_OBJECT - -public: - explicit ButtonSource(QWidget *parent = 0); - virtual ~ButtonSource(); - - QSize sizeHint() const; - - void hideAllButtons(); - void showAllButtons(); - - void dragMoveEvent(QDragMoveEvent *e); - void dragEnterEvent(QDragEnterEvent *e); - void dropEvent(QDropEvent *e); - void mousePressEvent(QMouseEvent *e); - -signals: - void dropped(); - -public slots: - void hideButton(QChar btn); - void showButton(QChar btn); -}; - -typedef QList ButtonList; - -/** - * This class renders and handles the demo titlebar dropsite - */ -class ButtonDropSite: public QFrame -{ - Q_OBJECT - -public: - explicit ButtonDropSite(QWidget* parent = 0); - ~ButtonDropSite(); - - // Allow external classes access our buttons - ensure buttons are - // not duplicated however. - ButtonList buttonsLeft; - ButtonList buttonsRight; - void clearLeft(); - void clearRight(); - - void resizeEvent(QResizeEvent* e); - void dragEnterEvent(QDragEnterEvent* e); - void dragMoveEvent(QDragMoveEvent* e); - void dragLeaveEvent(QDragLeaveEvent* e); - void dropEvent(QDropEvent* e); - void mousePressEvent(QMouseEvent* e); ///< Starts dragging a button... - void paintEvent(QPaintEvent* p); - -signals: - void buttonAdded(QChar btn); - void buttonRemoved(QChar btn); - void changed(); - -public slots: - bool removeSelectedButton(); ///< This slot is called after we drop on the item listbox... - void recalcItemGeometry(); ///< Call this whenever the item list changes... updates the items' rect property - -protected: - ButtonDropSiteItem *buttonAt(QPoint p); - bool removeButton(ButtonDropSiteItem *item); - int calcButtonListWidth(const ButtonList& buttons); ///< Computes the total space the buttons will take in the titlebar - void drawButtonList(QPainter *p, const ButtonList& buttons, int offset); - - QRect leftDropArea(); - QRect rightDropArea(); - -private: - /** - * Try to find the item. If found, set its list and index and return true, else return false - */ - bool getItemPos(ButtonDropSiteItem *item, ButtonList* &list, int &pos); - - void cleanDropVisualizer(); - QRect m_oldDropVisualizer; - - ButtonDropSiteItem *m_selected; -}; - -class ButtonPositionWidget : public QWidget -{ - Q_OBJECT - -public: - explicit ButtonPositionWidget(QWidget *parent = 0); - ~ButtonPositionWidget(); - - QString buttonsLeft() const; - QString buttonsRight() const; - void setButtonsLeft(const QString &buttons); - void setButtonsRight(const QString &buttons); - -signals: - void changed(); - -private: - void clearButtonList(const ButtonList& btns); - Button getButton(QChar type, bool& success); - - ButtonDropSite* m_dropSite; - ButtonSource *m_buttonSource; - - KDecorationFactory *m_factory; - QString m_supportedButtons; -}; - -} // namespace KWin - -#endif -// vim: ts=4 -// kate: space-indent off; tab-width 4; diff --git a/kwin/kcmkwin/kwindecoration/buttons.ui b/kwin/kcmkwin/kwindecoration/buttons.ui deleted file mode 100644 index e26819bf..00000000 --- a/kwin/kcmkwin/kwindecoration/buttons.ui +++ /dev/null @@ -1,72 +0,0 @@ - - - KWinDecorationButtonsConfigForm - - - - 0 - 0 - 400 - 300 - - - - - 0 - - - - - Enabling this checkbox will show window button tooltips. If this checkbox is off, no window button tooltips will be shown. - - - &Show window button tooltips - - - - - - - Please note that this option is not available on all styles yet. - - - Use custom titlebar button &positions - - - - - - - false - - - - - - - - KWin::ButtonPositionWidget - QWidget -
buttons.h
- 1 -
-
- - - useCustomButtonPositionsCheckBox - clicked(bool) - buttonPositionWidget - setEnabled(bool) - - - 205 - 39 - - - 231 - 90 - - - - -
diff --git a/kwin/kcmkwin/kwindecoration/buttons/close.png b/kwin/kcmkwin/kwindecoration/buttons/close.png deleted file mode 100644 index b6e828af..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/close.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/help.png b/kwin/kcmkwin/kwindecoration/buttons/help.png deleted file mode 100644 index a813458e..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/help.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/keepaboveothers.png b/kwin/kcmkwin/kwindecoration/buttons/keepaboveothers.png deleted file mode 100644 index c67af0e4..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/keepaboveothers.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/keepbelowothers.png b/kwin/kcmkwin/kwindecoration/buttons/keepbelowothers.png deleted file mode 100644 index bbc4b35a..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/keepbelowothers.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/maximize.png b/kwin/kcmkwin/kwindecoration/buttons/maximize.png deleted file mode 100644 index fbbc6d34..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/maximize.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/menu.png b/kwin/kcmkwin/kwindecoration/buttons/menu.png deleted file mode 100644 index 2206d31e..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/menu.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/minimize.png b/kwin/kcmkwin/kwindecoration/buttons/minimize.png deleted file mode 100644 index 9c45dde3..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/minimize.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/onalldesktops.png b/kwin/kcmkwin/kwindecoration/buttons/onalldesktops.png deleted file mode 100644 index 29738723..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/onalldesktops.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/resize.png b/kwin/kcmkwin/kwindecoration/buttons/resize.png deleted file mode 100644 index 87e2e804..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/resize.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/shade.png b/kwin/kcmkwin/kwindecoration/buttons/shade.png deleted file mode 100644 index 93a3bb08..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/shade.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttons/spacer.png b/kwin/kcmkwin/kwindecoration/buttons/spacer.png deleted file mode 100644 index 5a8e1231..00000000 Binary files a/kwin/kcmkwin/kwindecoration/buttons/spacer.png and /dev/null differ diff --git a/kwin/kcmkwin/kwindecoration/buttonsconfigdialog.cpp b/kwin/kcmkwin/kwindecoration/buttonsconfigdialog.cpp deleted file mode 100644 index 6ee3337c..00000000 --- a/kwin/kcmkwin/kwindecoration/buttonsconfigdialog.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "buttonsconfigdialog.h" -#include "kwindecoration.h" - -#include - -#include -#include - -namespace KWin -{ - -KWinDecorationButtonsConfigForm::KWinDecorationButtonsConfigForm(QWidget* parent) - : QWidget(parent) -{ - setupUi(this); -} - -KWinDecorationButtonsConfigDialog::KWinDecorationButtonsConfigDialog(DecorationButtons const *buttons, bool showTooltips, QWidget* parent, Qt::WFlags flags) - : KDialog(parent, flags) - , m_showTooltip(showTooltips) - , m_buttons(buttons) -{ - m_ui = new KWinDecorationButtonsConfigForm(this); - setWindowTitle(i18n("Buttons")); - setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Default | KDialog::Reset); - enableButton(KDialog::Reset, false); - QVBoxLayout* layout = new QVBoxLayout; - layout->addWidget(m_ui); - m_ui->buttonPositionWidget->setEnabled(buttons->customPositions()); - - QWidget* main = new QWidget(this); - main->setLayout(layout); - setMainWidget(main); - - connect(m_ui->buttonPositionWidget, SIGNAL(changed()), this, SLOT(changed())); - connect(m_ui->showToolTipsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->useCustomButtonPositionsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(this, SIGNAL(defaultClicked()), this, SLOT(slotDefaultClicked())); - connect(this, SIGNAL(resetClicked()), this, SLOT(slotResetClicked())); - - slotResetClicked(); -} - -KWinDecorationButtonsConfigDialog::~KWinDecorationButtonsConfigDialog() -{ -} - -bool KWinDecorationButtonsConfigDialog::customPositions() const -{ - return m_ui->useCustomButtonPositionsCheckBox->isChecked(); -} - -bool KWinDecorationButtonsConfigDialog::showTooltips() const -{ - return m_ui->showToolTipsCheckBox->isChecked(); -} - -QString KWinDecorationButtonsConfigDialog::buttonsLeft() const -{ - return m_ui->buttonPositionWidget->buttonsLeft(); -} - -QString KWinDecorationButtonsConfigDialog::buttonsRight() const -{ - return m_ui->buttonPositionWidget->buttonsRight(); -} - -void KWinDecorationButtonsConfigDialog::changed() -{ - enableButton(KDialog::Reset, true); -} - -void KWinDecorationButtonsConfigDialog::slotDefaultClicked() -{ - m_ui->useCustomButtonPositionsCheckBox->setChecked(false); - m_ui->showToolTipsCheckBox->setChecked(true); - m_ui->buttonPositionWidget->setButtonsLeft(KDecorationOptions::defaultTitleButtonsLeft()); - m_ui->buttonPositionWidget->setButtonsRight(KDecorationOptions::defaultTitleButtonsRight()); - changed(); -} - -void KWinDecorationButtonsConfigDialog::slotResetClicked() -{ - m_ui->useCustomButtonPositionsCheckBox->setChecked(m_buttons->customPositions()); - m_ui->showToolTipsCheckBox->setChecked(m_showTooltip); - m_ui->buttonPositionWidget->setButtonsLeft(m_buttons->leftButtons()); - m_ui->buttonPositionWidget->setButtonsRight(m_buttons->rightButtons()); - changed(); - enableButton(KDialog::Reset, false); -} - -} // namespace KWin - -#include "moc_buttonsconfigdialog.cpp" diff --git a/kwin/kcmkwin/kwindecoration/buttonsconfigdialog.h b/kwin/kcmkwin/kwindecoration/buttonsconfigdialog.h deleted file mode 100644 index 8612903b..00000000 --- a/kwin/kcmkwin/kwindecoration/buttonsconfigdialog.h +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWINDECORATIONBUTTONSCONFIGDIALOG_H -#define KWINDECORATIONBUTTONSCONFIGDIALOG_H - -#include -#include - -#include "ui_buttons.h" - -namespace KWin -{ - -class DecorationButtons; - -class KWinDecorationButtonsConfigForm : public QWidget, public Ui::KWinDecorationButtonsConfigForm -{ - Q_OBJECT - -public: - explicit KWinDecorationButtonsConfigForm(QWidget* parent); -}; - -class KWinDecorationButtonsConfigDialog : public KDialog -{ - Q_OBJECT -public: - KWinDecorationButtonsConfigDialog(DecorationButtons const *buttons, bool showTooltips, QWidget* parent = 0, Qt::WFlags flags = 0); - ~KWinDecorationButtonsConfigDialog(); - - bool customPositions() const; - bool showTooltips() const; - QString buttonsLeft() const; - QString buttonsRight() const; - -private slots: - void changed(); - void slotDefaultClicked(); - void slotResetClicked(); - -private: - KWinDecorationButtonsConfigForm* m_ui; - bool m_showTooltip; - DecorationButtons const *m_buttons; -}; - -} // namespace KWin - -#endif // KWINDECORATIONCONFIGBUTTONSDIALOG_H diff --git a/kwin/kcmkwin/kwindecoration/config.ui b/kwin/kcmkwin/kwindecoration/config.ui deleted file mode 100644 index de5f1a02..00000000 --- a/kwin/kcmkwin/kwindecoration/config.ui +++ /dev/null @@ -1,45 +0,0 @@ - - - KWinDecorationConfigForm - - - - 0 - 0 - 188 - 38 - - - - - - - - - B&order size: - - - bordersCombo - - - - - - - Use this combobox to change the border size of the decoration. - - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- -
diff --git a/kwin/kcmkwin/kwindecoration/configdialog.cpp b/kwin/kcmkwin/kwindecoration/configdialog.cpp deleted file mode 100644 index 78f49fc5..00000000 --- a/kwin/kcmkwin/kwindecoration/configdialog.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "configdialog.h" - -#include -#include - -#include -#include -#include - -namespace KWin -{ - -static const char* const border_names[ KDecorationDefines::BordersCount ] = { - I18N_NOOP2("@item:inlistbox Border size:", "Tiny"), - I18N_NOOP2("@item:inlistbox Border size:", "Normal"), - I18N_NOOP2("@item:inlistbox Border size:", "Large"), - I18N_NOOP2("@item:inlistbox Border size:", "Very Large"), - I18N_NOOP2("@item:inlistbox Border size:", "Huge"), - I18N_NOOP2("@item:inlistbox Border size:", "Very Huge"), - I18N_NOOP2("@item:inlistbox Border size:", "Oversized"), - I18N_NOOP2("@item:inlistbox Border size:", "No Side Border"), - I18N_NOOP2("@item:inlistbox Border size:", "No Border"), -}; - -KWinAuroraeConfigForm::KWinAuroraeConfigForm(QWidget* parent) - : QWidget(parent) -{ - setupUi(this); - connect(borderSizesCombo, SIGNAL(currentIndexChanged(int)), SIGNAL(changed())); - connect(buttonSizesCombo, SIGNAL(currentIndexChanged(int)), SIGNAL(changed())); - connect(closeWindowsDoubleClick, SIGNAL(clicked()), SIGNAL(changed())); -} - -void KWinAuroraeConfigForm::enableNoSideBorderSupport(bool enable) -{ - if (!enable) { - return; - } - borderSizesCombo->addItem(i18nc("@item:inlistbox Border size:", border_names[KDecorationDefines::BorderNoSides])); - borderSizesCombo->addItem(i18nc("@item:inlistbox Border size:", border_names[KDecorationDefines::BorderNone])); -} - -KWinDecorationConfigForm::KWinDecorationConfigForm(QWidget* parent) - : QWidget(parent) -{ - setupUi(this); -} - -KWinDecorationConfigDialog::KWinDecorationConfigDialog(QString deco, const QList& borderSizes, - KDecorationDefines::BorderSize size, - QWidget* parent, Qt::WFlags flags) - : KDialog(parent, flags) - , m_borderSizes(borderSizes) - , m_kwinConfig(KSharedConfig::openConfig("kwinrc")) - , m_pluginObject(0) - , m_pluginConfigWidget(0) -{ - m_ui = new KWinDecorationConfigForm(this); - setWindowTitle(i18n("Decoration Options")); - setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Default | KDialog::Reset); - enableButton(KDialog::Reset, false); - QVBoxLayout* layout = new QVBoxLayout; - layout->addWidget(m_ui); - - QLibrary library(styleToConfigLib(deco)); - if (library.load()) { - void *alloc_ptr = library.resolve("allocate_config"); - if (alloc_ptr != NULL) { - allocatePlugin = (QObject * (*)(KConfigGroup & conf, QWidget * parent))alloc_ptr; - KConfigGroup config(m_kwinConfig, "Style"); - m_pluginConfigWidget = new KVBox(this); - m_pluginObject = (QObject*)(allocatePlugin(config, m_pluginConfigWidget)); - - // connect required signals and slots together... - connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted())); - connect(m_pluginObject, SIGNAL(changed()), this, SLOT(slotSelectionChanged())); - connect(this, SIGNAL(pluginSave(KConfigGroup&)), m_pluginObject, SLOT(save(KConfigGroup&))); - connect(this, SIGNAL(defaultClicked()), m_pluginObject, SLOT(defaults())); - connect(this, SIGNAL(defaultClicked()), SLOT(slotDefault())); - } - } - - if (m_pluginConfigWidget) { - layout->addWidget(m_pluginConfigWidget); - } - - if (borderSizes.count() >= 2) { - foreach (const QVariant & borderSize, borderSizes) { - KDecorationDefines::BorderSize currentSize = - static_cast(borderSize.toInt()); - m_ui->bordersCombo->addItem(i18nc("@item:inlistbox Border size:", border_names[currentSize]), borderSizeToIndex(currentSize, borderSizes)); - } - m_ui->bordersCombo->setCurrentIndex(borderSizeToIndex(size, borderSizes)); - } else { - m_ui->bordersCombo->hide(); - m_ui->borderLabel->hide(); - } - - QWidget* main = new QWidget(this); - main->setLayout(layout); - setMainWidget(main); -} - -KWinDecorationConfigDialog::~KWinDecorationConfigDialog() -{ - delete m_pluginObject; -} - -KDecorationDefines::BorderSize KWinDecorationConfigDialog::borderSize() const -{ - if (m_borderSizes.count() >= 2) - return (KDecorationDefines::BorderSize)m_borderSizes.at(m_ui->bordersCombo->currentIndex()).toInt(); - return KDecorationDefines::BorderNormal; -} - -int KWinDecorationConfigDialog::borderSizeToIndex(KDecorationDefines::BorderSize size, const QList< QVariant >& sizes) -{ - int pos = 0; - for (QList< QVariant >::ConstIterator it = sizes.constBegin(); - it != sizes.constEnd(); - ++it, ++pos) - if (size <= (*it).toInt()) - break; - return pos; -} - -void KWinDecorationConfigDialog::slotAccepted() -{ - KConfigGroup config(m_kwinConfig, "Style"); - emit pluginSave(config); - config.sync(); -} - -void KWinDecorationConfigDialog::slotSelectionChanged() -{ - enableButton(KDialog::Reset, true); -} - -QString KWinDecorationConfigDialog::styleToConfigLib(const QString& styleLib) const -{ - if (styleLib.startsWith(QLatin1String("kwin3_"))) - return "kwin_" + styleLib.mid(6) + "_config"; - else - return styleLib + "_config"; -} - -void KWinDecorationConfigDialog::slotDefault() -{ - if (m_borderSizes.count() >= 2) - m_ui->bordersCombo->setCurrentIndex(borderSizeToIndex(BorderNormal, m_borderSizes)); -} - -} // namespace KWin - -#include "moc_configdialog.cpp" diff --git a/kwin/kcmkwin/kwindecoration/configdialog.h b/kwin/kcmkwin/kwindecoration/configdialog.h deleted file mode 100644 index 0f031517..00000000 --- a/kwin/kcmkwin/kwindecoration/configdialog.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWINDECORATIONCONFIGDIALOG_H -#define KWINDECORATIONCONFIGDIALOG_H -#include -#include -#include -#include "ui_config.h" -#include "ui_auroraeconfig.h" - -namespace KWin -{ - -class KWinAuroraeConfigForm : public QWidget, public Ui::KWinAuroraeConfigForm -{ - Q_OBJECT - -public: - explicit KWinAuroraeConfigForm(QWidget* parent); - void enableNoSideBorderSupport(bool enable); -Q_SIGNALS: - void changed(); -}; - -class KWinDecorationConfigForm : public QWidget, public Ui::KWinDecorationConfigForm -{ - Q_OBJECT - -public: - explicit KWinDecorationConfigForm(QWidget* parent); -}; - -class KWinDecorationConfigDialog : public KDialog, public KDecorationDefines -{ - Q_OBJECT -public: - KWinDecorationConfigDialog(QString decoLib, const QList& borderSizes, - KDecorationDefines::BorderSize size, QWidget* parent = 0, - Qt::WFlags flags = 0); - ~KWinDecorationConfigDialog(); - - KDecorationDefines::BorderSize borderSize() const; - -signals: - void pluginSave(KConfigGroup& group); - -private slots: - void slotSelectionChanged(); - void slotAccepted(); - void slotDefault(); - -private: - int borderSizeToIndex(KDecorationDefines::BorderSize size, const QList& sizes); - QString styleToConfigLib(const QString& styleLib) const; - -private: - KWinDecorationConfigForm* m_ui; - QList m_borderSizes; - KSharedConfigPtr m_kwinConfig; - - QObject*(*allocatePlugin)(KConfigGroup& conf, QWidget* parent); - QObject* m_pluginObject; - QWidget* m_pluginConfigWidget; -}; - -} // namespace KWin - -#endif // KWINDECORATIONCONFIGDIALOG_H diff --git a/kwin/kcmkwin/kwindecoration/decoration.ui b/kwin/kcmkwin/kwindecoration/decoration.ui deleted file mode 100644 index a4cd0071..00000000 --- a/kwin/kcmkwin/kwindecoration/decoration.ui +++ /dev/null @@ -1,97 +0,0 @@ - - - KWinDecorationForm - - - - 0 - 0 - 681 - 595 - - - - - - - Search - - - true - - - - - - - Select the window decoration. This is the look and feel of both the window borders and the window handle. - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAlwaysOn - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Configure Decoration... - - - - - - - Configure Buttons... - - - - - - - - - - QDeclarativeView - QGraphicsView -
QtDeclarative/QDeclarativeView
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - KPushButton - QPushButton -
kpushbutton.h
-
-
- - searchEdit - decorationList - configureDecorationButton - configureButtonsButton - - -
diff --git a/kwin/kcmkwin/kwindecoration/decorationmodel.cpp b/kwin/kcmkwin/kwindecoration/decorationmodel.cpp deleted file mode 100644 index 8e7caf74..00000000 --- a/kwin/kcmkwin/kwindecoration/decorationmodel.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "decorationmodel.h" -#include "preview.h" -// kwin -#include -// Qt -#include -#include -#include -#include -#include -#include -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include "kwindecoration.h" - -/* WARNING ------------------------------------------------------------------------- -* it is *ABSOLUTELY* mandatory to manage loadPlugin() and destroyPreviousPlugin() -* using disablePreview() -* -* loadPlugin() moves the present factory pointer to "old_fact" which is then deleted -* by the succeeding destroyPreviousPlugin() -* -* So if you loaded a new plugin and that changed the current factory, call disablePreview() -* BEFORE the following destroyPreviousPlugin() destroys the factory for the current m_preview->deco->factory -* (which is invoked on deco deconstruction) -* WARNING ------------------------------------------------------------------------ */ - -namespace KWin -{ - -DecorationModel::DecorationModel(KSharedConfigPtr config, QObject* parent) - : QAbstractListModel(parent) - , m_plugins(new KDecorationPreviewPlugins(config)) - , m_preview(new KDecorationPreview()) - , m_customButtons(false) - , m_leftButtons(QString()) - , m_rightButtons(QString()) -{ - QHash roleNames; - roleNames[Qt::DisplayRole] = "display"; - roleNames[DecorationModel::PixmapRole] = "preview"; - roleNames[TypeRole] = "type"; - roleNames[AuroraeNameRole] = "auroraeThemeName"; - roleNames[QmlMainScriptRole] = "mainScript"; - roleNames[BorderSizeRole] = "borderSize"; - roleNames[ButtonSizeRole] = "buttonSize"; - setRoleNames(roleNames); - m_config = KSharedConfig::openConfig("auroraerc"); - findDecorations(); -} - -DecorationModel::~DecorationModel() -{ - delete m_preview; - delete m_plugins; -} - -void DecorationModel::reload() -{ - m_decorations.clear(); - findDecorations(); -} - -// Find all theme desktop files in all 'data' dirs owned by kwin. -// And insert these into a DecorationInfo structure -void DecorationModel::findDecorations() -{ - beginResetModel(); - const QStringList dirList = KGlobal::dirs()->findDirs("data", "kwin"); - - foreach (const QString & dir, dirList) { - QDir d(dir); - if (d.exists()) { - foreach (const QFileInfo & fi, d.entryInfoList()) { - const QString filename(fi.absoluteFilePath()); - if (KDesktopFile::isDesktopFile(filename)) { - const KDesktopFile desktopFile(filename); - const QString libName = desktopFile.desktopGroup().readEntry("X-KDE-Library"); - - if (!libName.isEmpty() && libName.startsWith(QLatin1String("kwin3_"))) { - if (libName == "kwin3_aurorae") { - // read the Aurorae themes - findAuroraeThemes(); - continue; - } - if (!m_plugins->canLoad(libName)) - continue; - DecorationModelData data; - data.name = desktopFile.readName(); - data.libraryName = libName; - data.type = DecorationModelData::NativeDecoration; - data.borderSize = KDecorationDefines::BorderNormal; - data.closeDblClick = false; - metaData(data, desktopFile); - m_decorations.append(data); - } - } - } - } - } - const KService::List offers = KServiceTypeTrader::self()->query("KWin/Decoration"); - foreach (const KService::Ptr service, offers) { - DecorationModelData data; - data.name = service->name(); - data.libraryName = "kwin3_aurorae"; - data.type = DecorationModelData::QmlDecoration; - data.auroraeName = service->property("X-KDE-PluginInfo-Name").toString(); - QString scriptName = service->property("X-Plasma-MainScript").toString(); - data.qmlPath = KStandardDirs::locate("data", "kwin/decorations/" + data.auroraeName + "/contents/" + scriptName); - if (data.qmlPath.isEmpty()) { - // not a valid QML theme - continue; - } - KConfigGroup config(m_config, data.auroraeName); - data.borderSize = (KDecorationDefines::BorderSize)config.readEntry< int >("BorderSize", KDecorationDefines::BorderNormal); - data.buttonSize = (KDecorationDefines::BorderSize)config.readEntry< int >("ButtonSize", KDecorationDefines::BorderNormal); - data.closeDblClick = config.readEntry< bool >("CloseOnDoubleClickMenuButton", true); - data.comment = service->comment(); - KPluginInfo info(service); - data.author = info.author(); - data.email= info.email(); - data.version = info.version(); - data.license = info.license(); - data.website = info.website(); - m_decorations.append(data); - } - qSort(m_decorations.begin(), m_decorations.end(), DecorationModelData::less); - endResetModel(); -} - -void DecorationModel::findAuroraeThemes() -{ - // get all desktop themes - QStringList themes = KGlobal::dirs()->findAllResources("data", - "aurorae/themes/*/metadata.desktop", - KStandardDirs::NoDuplicates); - foreach (const QString & theme, themes) { - int themeSepIndex = theme.lastIndexOf('/', -1); - QString themeRoot = theme.left(themeSepIndex); - int themeNameSepIndex = themeRoot.lastIndexOf('/', -1); - QString packageName = themeRoot.right(themeRoot.length() - themeNameSepIndex - 1); - - KDesktopFile df(theme); - QString name = df.readName(); - if (name.isEmpty()) { - name = packageName; - } - - DecorationModelData data; - data.name = name; - data.libraryName = "kwin3_aurorae"; - data.type = DecorationModelData::AuroraeDecoration; - data.auroraeName = packageName; - KConfigGroup config(m_config, data.auroraeName); - data.borderSize = (KDecorationDefines::BorderSize)config.readEntry< int >("BorderSize", KDecorationDefines::BorderNormal); - data.buttonSize = (KDecorationDefines::BorderSize)config.readEntry< int >("ButtonSize", KDecorationDefines::BorderNormal); - data.closeDblClick = config.readEntry< bool >("CloseOnDoubleClickMenuButton", true); - metaData(data, df); - m_decorations.append(data); - } -} - -void DecorationModel::metaData(DecorationModelData& data, const KDesktopFile& df) -{ - data.comment = df.readComment(); - data.author = df.desktopGroup().readEntry("X-KDE-PluginInfo-Author", QString()); - data.email = df.desktopGroup().readEntry("X-KDE-PluginInfo-Email", QString()); - data.version = df.desktopGroup().readEntry("X-KDE-PluginInfo-Version", QString()); - data.license = df.desktopGroup().readEntry("X-KDE-PluginInfo-License", QString()); - data.website = df.desktopGroup().readEntry("X-KDE-PluginInfo-Website", QString()); -} - -int DecorationModel::rowCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent) - return m_decorations.count(); -} - -QVariant DecorationModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - switch(role) { - case Qt::DisplayRole: - case NameRole: - return m_decorations[ index.row()].name; - case LibraryNameRole: - return m_decorations[ index.row()].libraryName; - case PixmapRole: - return m_decorations[ index.row()].preview; - case TypeRole: - return m_decorations[ index.row()].type; - case AuroraeNameRole: - return m_decorations[ index.row()].auroraeName; - case PackageDescriptionRole: - return m_decorations[ index.row()].comment; - case PackageAuthorRole: - return m_decorations[ index.row()].author; - case PackageEmailRole: - return m_decorations[ index.row()].email; - case PackageWebsiteRole: - return m_decorations[ index.row()].website; - case PackageVersionRole: - return m_decorations[ index.row()].version; - case PackageLicenseRole: - return m_decorations[ index.row()].license; - case BorderSizeRole: - return static_cast< int >(m_decorations[ index.row()].borderSize); - case BorderSizesRole: { - QList< QVariant > sizes; - const bool mustDisablePreview = m_plugins->factory() && m_plugins->factory() == m_preview->factory(); - if (m_plugins->loadPlugin(m_decorations[index.row()].libraryName) && m_plugins->factory()) { - foreach (const KDecorationDefines::BorderSize size, m_plugins->factory()->borderSizes()) // krazy:exclude=foreach - sizes << int(size); - if (mustDisablePreview) // it's nuked with destroyPreviousPlugin() - m_preview->disablePreview(); // so we need to get rid of m_preview->deco first - m_plugins->destroyPreviousPlugin(); - } - return sizes; - } - case ButtonSizeRole: - if (m_decorations[ index.row()].type == DecorationModelData::AuroraeDecoration || - m_decorations[ index.row()].type == DecorationModelData::QmlDecoration) - return static_cast< int >(m_decorations[ index.row()].buttonSize); - else - return QVariant(); - case QmlMainScriptRole: - return m_decorations[ index.row()].qmlPath; - case CloseOnDblClickRole: - return m_decorations[index.row()].closeDblClick; - default: - return QVariant(); - } -} - -bool DecorationModel::setData(const QModelIndex& index, const QVariant& value, int role) -{ - if (!index.isValid() || (role != BorderSizeRole && role != ButtonSizeRole && role != CloseOnDblClickRole)) - return QAbstractItemModel::setData(index, value, role); - - const DecorationModelData::DecorationType type = m_decorations[ index.row()].type; - - if (role == BorderSizeRole) { - m_decorations[ index.row()].borderSize = (KDecorationDefines::BorderSize)value.toInt(); - if (type == DecorationModelData::AuroraeDecoration || type == DecorationModelData::QmlDecoration) { - KConfigGroup config(m_config, m_decorations[ index.row()].auroraeName); - config.writeEntry("BorderSize", value.toInt()); - config.sync(); - } - emit dataChanged(index, index); - emit configChanged(m_decorations[ index.row()].auroraeName); - regeneratePreview(index); - return true; - } - if (role == ButtonSizeRole && (type == DecorationModelData::AuroraeDecoration || type == DecorationModelData::QmlDecoration)) { - m_decorations[ index.row()].buttonSize = (KDecorationDefines::BorderSize)value.toInt(); - KConfigGroup config(m_config, m_decorations[ index.row()].auroraeName); - config.writeEntry("ButtonSize", value.toInt()); - config.sync(); - emit dataChanged(index, index); - emit configChanged(m_decorations[ index.row()].auroraeName); - regeneratePreview(index); - return true; - } - if (role == CloseOnDblClickRole && (type == DecorationModelData::AuroraeDecoration || type == DecorationModelData::QmlDecoration)) { - if (m_decorations[ index.row()].closeDblClick == value.toBool()) { - return false; - } - m_decorations[ index.row()].closeDblClick = value.toBool(); - KConfigGroup config(m_config, m_decorations[ index.row()].auroraeName); - config.writeEntry("CloseOnDoubleClickMenuButton", value.toBool()); - config.sync(); - emit dataChanged(index, index); - emit configChanged(m_decorations[ index.row()].auroraeName); - return true; - } - return QAbstractItemModel::setData(index, value, role); -} - - -void DecorationModel::changeButtons(const KWin::DecorationButtons *buttons) -{ - bool regenerate = (buttons->customPositions() != m_customButtons); - if (!regenerate && buttons->customPositions()) - regenerate = (buttons->leftButtons() != m_leftButtons) || (buttons->rightButtons() != m_rightButtons); - m_customButtons = buttons->customPositions(); - m_leftButtons = buttons->leftButtons(); - m_rightButtons = buttons->rightButtons(); - if (regenerate) - regeneratePreviews(); -} - -void DecorationModel::setButtons(bool custom, const QString& left, const QString& right) -{ - m_customButtons = custom; - m_leftButtons = left; - m_rightButtons = right; -} - -void DecorationModel::regenerateNextPreview() -{ - if (m_nextPreviewIndex < m_lastUpdateIndex && m_nextPreviewIndex < m_decorations.count()) - regeneratePreview(index(m_nextPreviewIndex), - QSize(qobject_cast(QObject::parent())->itemWidth(), 150)); - ++m_nextPreviewIndex; - if (m_nextPreviewIndex >= m_lastUpdateIndex && m_firstUpdateIndex > 0) { - // do the above ones - m_lastUpdateIndex = qMin(m_firstUpdateIndex, m_decorations.count()); - m_firstUpdateIndex = m_nextPreviewIndex = 0; - } - if (m_nextPreviewIndex < m_lastUpdateIndex) - QMetaObject::invokeMethod(this, "regenerateNextPreview", Qt::QueuedConnection); -} - -void DecorationModel::regeneratePreviews(int firstIndex) -{ - m_firstUpdateIndex = firstIndex; - m_lastUpdateIndex = m_decorations.count(); - m_nextPreviewIndex = firstIndex; - regenerateNextPreview(); -} - -void DecorationModel::stopPreviewGeneration() -{ - m_firstUpdateIndex = m_lastUpdateIndex = m_nextPreviewIndex = 0; -} - -void DecorationModel::regeneratePreview(const QModelIndex& index, const QSize& size) -{ - DecorationModelData& data = m_decorations[ index.row()]; - - switch(data.type) { - case DecorationModelData::NativeDecoration: { - bool enabled = false; - bool loaded; - // m_preview->deco management is not required - // either the deco loads and the following recreateDecoration will sanitize decos (on new factory) - // or the deco does not load and destroyPreviousPlugin() is not called - if ((loaded = m_plugins->loadPlugin(data.libraryName)) && m_preview->recreateDecoration(m_plugins)) { - enabled = true; - } else { - m_preview->disablePreview(); - } - if (loaded) - m_plugins->destroyPreviousPlugin(); - if (enabled) { - m_preview->resize(size); - m_preview->setTempButtons(m_plugins, m_customButtons, m_leftButtons, m_rightButtons); - m_preview->setTempBorderSize(m_plugins, data.borderSize); - data.preview = m_preview->preview(); - } else { - m_decorations.removeAt(index.row()); - } - break; - } - default: - // nothing - break; - } - emit dataChanged(index, index); -} - -void DecorationModel::regeneratePreview(const QModelIndex& index) -{ - regeneratePreview(index, m_decorations.at(index.row()).preview.size()); -} - -QModelIndex DecorationModel::indexOfLibrary(const QString& libraryName) const -{ - for (int i = 0; i < m_decorations.count(); i++) { - if (m_decorations.at(i).libraryName.compare(libraryName) == 0) - return index(i); - } - return QModelIndex(); -} - -QModelIndex DecorationModel::indexOfName(const QString& decoName) const -{ - for (int i = 0; i < m_decorations.count(); i++) { - if (m_decorations.at(i).name.compare(decoName) == 0) - return index(i); - } - return QModelIndex(); -} - -QModelIndex DecorationModel::indexOfAuroraeName(const QString &auroraeName, const QString &type) const -{ - for (int i = 0; i < m_decorations.count(); i++) { - const DecorationModelData& data = m_decorations.at(i); - if (type == "aurorae" && data.type == DecorationModelData::AuroraeDecoration && - data.auroraeName.compare(auroraeName) == 0) - return index(i); - if (type == "qml" && data.type == DecorationModelData::QmlDecoration && - data.auroraeName.compare(auroraeName) == 0) - return index(i); - } - return QModelIndex(); -} - -void DecorationModel::setBorderSize(const QModelIndex& index, KDecorationDefines::BorderSize size) -{ - if (!index.isValid() || m_decorations[ index.row()].type == DecorationModelData::AuroraeDecoration || m_decorations[ index.row()].type == DecorationModelData::QmlDecoration) - return; - m_decorations[ index.row()].borderSize = size; -} - -QVariant DecorationModel::readConfig(const QString &themeName, const QString &key, const QVariant &defaultValue) -{ - return m_config->group(themeName).readEntry(key, defaultValue); -} - -void DecorationModel::notifyConfigChanged(const QModelIndex &index) -{ - if (!index.isValid()) { - return; - } - emit configChanged(m_decorations[index.row()].auroraeName); -} - -} // namespace KWin diff --git a/kwin/kcmkwin/kwindecoration/decorationmodel.h b/kwin/kcmkwin/kwindecoration/decorationmodel.h deleted file mode 100644 index 217bddc4..00000000 --- a/kwin/kcmkwin/kwindecoration/decorationmodel.h +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef KWIN_DECORATIONMODEL_H -#define KWIN_DECORATIONMODEL_H -#include -#include -#include -#include - -#include -class KDesktopFile; -class KDecorationPlugins; -class KDecorationPreview; - -namespace KWin -{ - -class DecorationButtons; - -class DecorationModelData -{ -public: - enum DecorationType { - NativeDecoration = 0, - AuroraeDecoration = 1, - QmlDecoration = 2 - }; - QString name; - QString libraryName; - QPixmap preview; - DecorationType type; - QString comment; - QString author; - QString email; - QString website; - QString version; - QString license; - QString auroraeName; - QString qmlPath; - KDecorationDefines::BorderSize borderSize; - KDecorationDefines::BorderSize buttonSize; - /** - * Whether the window gets closed on double clicking the Menu Button. - * Only applies for Aurorae and QML Decoration. - **/ - bool closeDblClick; - - static bool less(const DecorationModelData& a, const DecorationModelData& b) { - return a.name < b.name; - } -}; - -class DecorationModel : public QAbstractListModel -{ - Q_OBJECT -public: - enum { - NameRole = Qt::UserRole, - LibraryNameRole = Qt::UserRole + 1, - PixmapRole = Qt::UserRole + 2, - TypeRole = Qt::UserRole + 3, - AuroraeNameRole = Qt::UserRole + 4, - PackageDescriptionRole = Qt::UserRole + 5, - PackageAuthorRole = Qt::UserRole + 6, - PackageEmailRole = Qt::UserRole + 7, - PackageWebsiteRole = Qt::UserRole + 8, - PackageVersionRole = Qt::UserRole + 9, - PackageLicenseRole = Qt::UserRole + 10, - BorderSizeRole = Qt::UserRole + 11, - BorderSizesRole = Qt::UserRole + 12, - ButtonSizeRole = Qt::UserRole + 13, - QmlMainScriptRole = Qt::UserRole + 14, - CloseOnDblClickRole = Qt::UserRole + 15 - }; - explicit DecorationModel(KSharedConfigPtr config, QObject* parent = 0); - ~DecorationModel(); - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); - - void reload(); - - void regeneratePreview(const QModelIndex& index); - - /** - * Changes the button state and regenerates the preview. - */ - void changeButtons(const DecorationButtons *buttons); - /** - * Changes the button state without regenerating the preview. - */ - void setButtons(bool custom, const QString& left, const QString& right); - - void setBorderSize(const QModelIndex& index, KDecorationDefines::BorderSize size); - - QModelIndex indexOfLibrary(const QString& libraryName) const; - QModelIndex indexOfName(const QString& decoName) const; - QModelIndex indexOfAuroraeName(const QString& auroraeName, const QString& type) const; - - void regeneratePreviews(int firstIndex = 0); - void stopPreviewGeneration(); - - Q_INVOKABLE QVariant readConfig(const QString &themeName, const QString &key, const QVariant &defaultValue = QVariant()); - - void notifyConfigChanged(const QModelIndex &index); - -Q_SIGNALS: - void configChanged(QString themeName); -public slots: - void regeneratePreview(const QModelIndex& index, const QSize& size); -private slots: - void regenerateNextPreview(); -private: - void findDecorations(); - void findAuroraeThemes(); - void metaData(DecorationModelData& data, const KDesktopFile& df); - QList m_decorations; - KDecorationPlugins* m_plugins; - KDecorationPreview* m_preview; - bool m_customButtons; - QString m_leftButtons; - QString m_rightButtons; - KSharedConfigPtr m_config; - int m_nextPreviewIndex; - int m_firstUpdateIndex; - int m_lastUpdateIndex; -}; - -} // namespace KWin - -#endif // KWIN_DECORATIONMODEL_H diff --git a/kwin/kcmkwin/kwindecoration/kwindecoration.cpp b/kwin/kcmkwin/kwindecoration/kwindecoration.cpp deleted file mode 100644 index 06c484d8..00000000 --- a/kwin/kcmkwin/kwindecoration/kwindecoration.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/* - This is the new kwindecoration kcontrol module - - Copyright (c) 2001 - Karol Szwed - http://gallium.n3.net/ - Copyright 2009, 2010 Martin Gräßlin - - Supports new kwin configuration plugins, and titlebar button position - modification via dnd interface. - - Based on original "kwintheme" (Window Borders) - 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 - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -*/ -// own -#include "kwindecoration.h" -#include "buttonsconfigdialog.h" -#include "configdialog.h" -#include "decorationmodel.h" -#include "auroraetheme.h" -// Qt -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// KCModule plugin interface -// ========================= -K_PLUGIN_FACTORY(KWinDecoFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(KWinDecoFactory("kcmkwindecoration")) - -namespace KWin -{ - -KWinDecorationForm::KWinDecorationForm(QWidget* parent) - : QWidget(parent) -{ - setupUi(this); -} - - -KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QVariantList &) - : KCModule(KWinDecoFactory::componentData(), parent) - , kwinConfig(KSharedConfig::openConfig("kwinrc")) - , m_showTooltips(false) - , m_model(NULL) - , m_proxyModel(NULL) - , m_configLoaded(false) - , m_decorationButtons(new DecorationButtons(this)) - , m_lastPreviewWidth(-1) - , m_previewUpdateTimer(NULL) -{ - qmlRegisterType("org.kde.kwin.aurorae", 0, 1, "AuroraeTheme"); - m_ui = new KWinDecorationForm(this); - m_ui->configureDecorationButton->setIcon(KIcon("configure")); - m_ui->configureButtonsButton->setIcon(KIcon("configure")); - QVBoxLayout* layout = new QVBoxLayout(this); - layout->addWidget(m_ui); - - KAboutData *about = - new KAboutData(I18N_NOOP("kcmkwindecoration"), 0, - ki18n("Window Decoration Control Module"), - 0, KLocalizedString(), KAboutData::License_GPL, - ki18n("(c) 2001 Karol Szwed")); - about->addAuthor(ki18n("Karol Szwed"), KLocalizedString(), "gallium@kde.org"); - setAboutData(about); -} - - -KWinDecorationModule::~KWinDecorationModule() -{ -} - -void KWinDecorationModule::showEvent(QShowEvent *ev) -{ - KCModule::showEvent(ev); - init(); -} - -void KWinDecorationModule::init() -{ - if (m_model) { - // init already called - return; - } - const QString mainQmlPath = KStandardDirs::locate("data", "kwin/kcm_kwindecoration/main.qml"); - if (mainQmlPath.isNull()) { - // TODO 4.11 i18n this - KMessageBox::error(this, "

Installation error

" - "The resource

kwin/kcm_kwindecoration/main.qml

could not be located in any application data path." - "

Please contact your distribution

" - "The application will now abort", "Installation Error"); - kFatal() << "Something strange happened"; - } - KConfigGroup style(kwinConfig, "Style"); - - // Set up the decoration lists and other UI settings - m_model = new DecorationModel(kwinConfig, this); - m_proxyModel = new QSortFilterProxyModel(this); - m_proxyModel->setSourceModel(m_model); - m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - m_ui->decorationList->setResizeMode(QDeclarativeView::SizeRootObjectToView); - /* use logic from KDeclarative::setupBindings(): - "addImportPath adds the path at the beginning, so to honour user's - paths we need to traverse the list in reverse order" */ - QStringListIterator paths(KGlobal::dirs()->findDirs("module", "imports")); - paths.toBack(); - while (paths.hasPrevious()) { - m_ui->decorationList->engine()->addImportPath(paths.previous()); - } - m_ui->decorationList->rootContext()->setContextProperty("decorationModel", m_proxyModel); - m_ui->decorationList->rootContext()->setContextProperty("decorationBaseModel", m_model); - m_ui->decorationList->rootContext()->setContextProperty("options", m_decorationButtons); - m_ui->decorationList->rootContext()->setContextProperty("highlightColor", m_ui->decorationList->palette().color(QPalette::Highlight)); - m_ui->decorationList->rootContext()->setContextProperty("sliderWidth", m_ui->decorationList->verticalScrollBar()->width()); - m_ui->decorationList->rootContext()->setContextProperty("auroraeSource", KStandardDirs::locate("data", "kwin/aurorae/aurorae.qml")); - m_ui->decorationList->rootContext()->setContextProperty("decorationActiveCaptionColor", KDecoration::options()->color(ColorFont, true)); - m_ui->decorationList->rootContext()->setContextProperty("decorationInactiveCaptionColor", KDecoration::options()->color(ColorFont, false)); - m_ui->decorationList->rootContext()->setContextProperty("decorationActiveTitleBarColor", KDecoration::options()->color(ColorTitleBar, true)); - m_ui->decorationList->rootContext()->setContextProperty("decorationInactiveTitleBarColor", KDecoration::options()->color(ColorTitleBar, false)); - m_ui->decorationList->setSource(mainQmlPath); - - readConfig(style); - - connect(m_ui->decorationList->rootObject(), SIGNAL(currentIndexChanged()), SLOT(slotSelectionChanged())); - connect(m_ui->decorationList->rootObject(), SIGNAL(widthChanged()), SLOT(updatePreviewWidth())); - connect(m_ui->configureButtonsButton, SIGNAL(clicked(bool)), this, SLOT(slotConfigureButtons())); - connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString))); - connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_ui->decorationList->rootObject(), SLOT(returnToBounds()), Qt::QueuedConnection); - connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), SLOT(updateScrollbarRange()), Qt::QueuedConnection); - connect(m_ui->configureDecorationButton, SIGNAL(clicked(bool)), SLOT(slotConfigureDecoration())); - - m_ui->decorationList->disconnect(m_ui->decorationList->verticalScrollBar()); - m_ui->decorationList->verticalScrollBar()->disconnect(m_ui->decorationList); - connect(m_ui->decorationList->rootObject(), SIGNAL(contentYChanged()), SLOT(updateScrollbarValue())); - connect(m_ui->decorationList->rootObject(), SIGNAL(contentHeightChanged()), SLOT(updateScrollbarRange())); - connect(m_ui->decorationList->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(updateScrollbarRange())); - connect(m_ui->decorationList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateViewPosition(int))); - - m_ui->decorationList->installEventFilter(this); - m_ui->decorationList->viewport()->installEventFilter(this); - QMetaObject::invokeMethod(this, "updatePreviews", Qt::QueuedConnection); - updateScrollbarRange(); -} - -int KWinDecorationModule::itemWidth() const -{ - const int width = m_ui->decorationList->rootObject()->property("width").toInt(); - const int sliderWidth = m_ui->decorationList->verticalScrollBar()->width(); - return width - sliderWidth; -} - -// This is the selection handler setting -void KWinDecorationModule::slotSelectionChanged() -{ - emit KCModule::changed(true); -} - -// Reads the kwin config settings, and sets all UI controls to those settings -// Updating the config plugin if required -void KWinDecorationModule::readConfig(const KConfigGroup & conf) -{ - m_showTooltips = conf.readEntry("ShowToolTips", true); - - // Find the corresponding decoration name to that of - // the current plugin library name - - QString libraryName = conf.readEntry("PluginLib", "kwin3_oxygen"); - - if (libraryName.isEmpty()) { - // Selected decoration doesn't exist, use the default - libraryName = "kwin3_oxygen"; - } - - const int bsize = conf.readEntry("BorderSize", (int)BorderNormal); - BorderSize borderSize = BorderNormal; - if (bsize >= BorderTiny && bsize < BordersCount) - borderSize = static_cast< BorderSize >(bsize); - if (libraryName == "kwin3_aurorae") { - KConfig auroraeConfig("auroraerc"); - KConfigGroup group(&auroraeConfig, "Engine"); - const QString themeName = group.readEntry("ThemeName", "example-deco"); - const QString type = group.readEntry("EngineType", "aurorae"); - const QModelIndex index = m_proxyModel->mapFromSource(m_model->indexOfAuroraeName(themeName, type)); - if (index.isValid()) { - m_ui->decorationList->rootObject()->setProperty("currentIndex", index.row()); - } - } else { - const QModelIndex index = m_proxyModel->mapFromSource(m_model->indexOfLibrary(libraryName)); - if (index.isValid()) { - m_model->setBorderSize(index, borderSize); - m_ui->decorationList->rootObject()->setProperty("currentIndex", index.row()); - } - } - - // Buttons tab - // ============ - m_decorationButtons->setCustomPositions(conf.readEntry("CustomButtonPositions", false)); - // Menu and onAllDesktops buttons are default on LHS - m_decorationButtons->setLeftButtons(conf.readEntry("ButtonsOnLeft", KDecorationOptions::defaultTitleButtonsLeft())); - // Help, Minimize, Maximize and Close are default on RHS - m_decorationButtons->setRightButtons(conf.readEntry("ButtonsOnRight", KDecorationOptions::defaultTitleButtonsRight())); - if (m_configLoaded) - m_model->changeButtons(m_decorationButtons); - else { - m_configLoaded = true; - m_model->setButtons(m_decorationButtons->customPositions(), m_decorationButtons->leftButtons(), m_decorationButtons->rightButtons()); - } - - emit KCModule::changed(false); -} - - -// Writes the selected user configuration to the kwin config file -void KWinDecorationModule::writeConfig(KConfigGroup & conf) -{ - const QModelIndex index = m_proxyModel->mapToSource(m_proxyModel->index(m_ui->decorationList->rootObject()->property("currentIndex").toInt(), 0)); - const QString libName = m_model->data(index, DecorationModel::LibraryNameRole).toString(); - - // General settings - conf.writeEntry("PluginLib", libName); - conf.writeEntry("CustomButtonPositions", m_decorationButtons->customPositions()); - conf.writeEntry("ShowToolTips", m_showTooltips); - - // Button settings - conf.writeEntry("ButtonsOnLeft", m_decorationButtons->leftButtons()); - conf.writeEntry("ButtonsOnRight", m_decorationButtons->rightButtons()); - conf.writeEntry("BorderSize", - static_cast(m_model->data(index, DecorationModel::BorderSizeRole).toInt())); - - if (m_model->data(index, DecorationModel::TypeRole).toInt() == DecorationModelData::AuroraeDecoration || - m_model->data(index, DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration) { - KConfig auroraeConfig("auroraerc"); - KConfigGroup group(&auroraeConfig, "Engine"); - group.writeEntry("ThemeName", m_model->data(index, DecorationModel::AuroraeNameRole).toString()); - if (m_model->data(index, DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration) { - group.writeEntry("EngineType", "qml"); - } else { - group.deleteEntry("EngineType"); - } - group.sync(); - } - - // We saved, so tell kcmodule that there have been no new user changes made. - emit KCModule::changed(false); -} - - -// Virutal functions required by KCModule -void KWinDecorationModule::load() -{ - const KConfigGroup config(kwinConfig, "Style"); - - // Reset by re-reading the config - readConfig(config); -} - - -void KWinDecorationModule::save() -{ - KConfigGroup config(kwinConfig, "Style"); - writeConfig(config); - config.sync(); - - // Send signal to all kwin instances - QDBusMessage message = - QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); - QDBusConnection::sessionBus().send(message); -} - - -void KWinDecorationModule::defaults() -{ - // Set the KDE defaults - m_showTooltips = true; - const QModelIndex index = m_proxyModel->mapFromSource(m_model->indexOfName(i18n("Oxygen"))); - if (index.isValid()) - m_ui->decorationList->rootObject()->setProperty("currentIndex", index.row()); - - m_decorationButtons->resetToDefaults(); - - m_model->changeButtons(m_decorationButtons); - - emit changed(true); -} - -QString KWinDecorationModule::quickHelp() const -{ - return i18n("

Window Manager Decoration

" - "

This module allows you to choose the window border decorations, " - "as well as titlebar button positions and custom decoration options.

" - "To choose a theme for your window decoration click on its name and apply your choice by clicking the \"Apply\" button below." - " If you do not want to apply your choice you can click the \"Reset\" button to discard your changes." - "

You can configure each theme. There are different options specific for each theme.

" - "

On the \"Buttons\" tab check the \"Use custom titlebar button positions\" box " - "and you can change the positions of the buttons to your liking.

"); -} - -void KWinDecorationModule::slotConfigureButtons() -{ - QPointer< KWinDecorationButtonsConfigDialog > configDialog = new KWinDecorationButtonsConfigDialog(m_decorationButtons, m_showTooltips, this); - if (configDialog->exec() == KDialog::Accepted) { - m_decorationButtons->setCustomPositions(configDialog->customPositions()); - m_showTooltips = configDialog->showTooltips(); - m_decorationButtons->setLeftButtons(configDialog->buttonsLeft()); - m_decorationButtons->setRightButtons(configDialog->buttonsRight()); - m_model->changeButtons(m_decorationButtons); - emit changed(true); - } - - delete configDialog; -} - -void KWinDecorationModule::slotConfigureDecoration() -{ - const QModelIndex index = m_proxyModel->mapToSource(m_proxyModel->index(m_ui->decorationList->rootObject()->property("currentIndex").toInt(), 0)); - bool reload = false; - if (index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::AuroraeDecoration || - index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration) { - QPointer< KDialog > dlg = new KDialog(this); - dlg->setCaption(i18n("Decoration Options")); - dlg->setButtons(KDialog::Ok | KDialog::Cancel); - KWinAuroraeConfigForm *form = new KWinAuroraeConfigForm(dlg); - form->enableNoSideBorderSupport(index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration); - dlg->setMainWidget(form); - form->borderSizesCombo->setCurrentIndex(index.data(DecorationModel::BorderSizeRole).toInt()); - form->buttonSizesCombo->setCurrentIndex(index.data(DecorationModel::ButtonSizeRole).toInt()); - form->closeWindowsDoubleClick->setChecked(index.data(DecorationModel::CloseOnDblClickRole).toBool()); - // in case of QmlDecoration look for a config.ui in the package structure - KConfigDialogManager *configManager = NULL; - if (index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration) { - const QString packageName = index.data(DecorationModel::AuroraeNameRole).toString(); - const QString uiPath = KStandardDirs::locate("data", "kwin/decorations/" + packageName + "/contents/ui/config.ui"); - const QString configPath = KStandardDirs::locate("data", "kwin/decorations/" + packageName + "/contents/config/main.xml"); - if (!uiPath.isEmpty() && !configPath.isEmpty()) { - // load the KConfigSkeleton - QFile configFile(configPath); - KSharedConfigPtr auroraeConfig = KSharedConfig::openConfig("auroraerc"); - KConfigGroup configGroup = auroraeConfig->group(packageName); - Plasma::ConfigLoader *skeleton = new Plasma::ConfigLoader(&configGroup, &configFile, dlg); - // load the ui file - QUiLoader *loader = new QUiLoader(dlg); - QFile uiFile(uiPath); - uiFile.open(QFile::ReadOnly); - QWidget *customConfigForm = loader->load(&uiFile, form); - uiFile.close(); - form->layout()->addWidget(customConfigForm); - // connect the ui file with the skeleton - configManager = new KConfigDialogManager(customConfigForm, skeleton); - configManager->updateWidgets(); - } - } - if (dlg->exec() == KDialog::Accepted) { - m_model->setData(index, form->borderSizesCombo->currentIndex(), DecorationModel::BorderSizeRole); - m_model->setData(index, form->buttonSizesCombo->currentIndex(), DecorationModel::ButtonSizeRole); - m_model->setData(index, form->closeWindowsDoubleClick->isChecked(), DecorationModel::CloseOnDblClickRole); - if (configManager && configManager->hasChanged()) { - // we have a config manager and the settings changed - configManager->updateSettings(); - m_model->notifyConfigChanged(index); - } - reload = true; - } - delete dlg; - } else { - QString name = index.data(DecorationModel::LibraryNameRole).toString(); - QList< QVariant > borderSizes = index.data(DecorationModel::BorderSizesRole).toList(); - const KDecorationDefines::BorderSize size = - static_cast(index.data(DecorationModel::BorderSizeRole).toInt()); - QPointer< KWinDecorationConfigDialog > configDialog = - new KWinDecorationConfigDialog(name, borderSizes, size, this); - if (configDialog->exec() == KDialog::Accepted) { - m_model->setData(index, configDialog->borderSize(), DecorationModel::BorderSizeRole); - reload = true; - } - - delete configDialog; - } - if (reload) { - save(); - } -} - -bool KWinDecorationModule::eventFilter(QObject *o, QEvent *e) -{ - if (o == m_ui->decorationList) { - if (e->type() == QEvent::Resize) - updateScrollbarRange(); - else if (e->type() == QEvent::KeyPress) { - int d = 0; - const int currentRow = m_ui->decorationList->rootObject()->property("currentIndex").toInt(); - const int key = static_cast(e)->key(); - switch (key) { - case Qt::Key_Home: - d = -currentRow; - break; - case Qt::Key_End: - d = m_proxyModel->rowCount() - (1 + currentRow); - break; - case Qt::Key_Up: - d = -1; - break; - case Qt::Key_Down: - d = 1; - break; - case Qt::Key_PageUp: - case Qt::Key_PageDown: - d = 150; - if (QObject *decoItem = m_ui->decorationList->rootObject()->findChild("decorationItem")) { - QVariant v = decoItem->property("height"); - if (v.isValid()) - d = v.toInt(); - } - if (d > 0) - d = qMax(m_ui->decorationList->height() / d, 1); - if (key == Qt::Key_PageUp) - d = -d; - break; - default: - break; - } - if (d) { - d = qMin(qMax(0, currentRow + d), m_proxyModel->rowCount()); - m_ui->decorationList->rootObject()->setProperty("currentIndex", d); - return true; - } - } - } else if (m_ui->decorationList->viewport()) { - if (e->type() == QEvent::Wheel) { - return static_cast(e)->orientation() == Qt::Horizontal; - } - } - return KCModule::eventFilter(o, e); -} - -void KWinDecorationModule::updatePreviews() -{ - if (!m_model) { - return; - } - m_ui->decorationList->rootContext()->setContextProperty("sliderWidth", m_ui->decorationList->verticalScrollBar()->width()); - const int newWidth = m_ui->decorationList->rootObject()->property("width").toInt(); - if (newWidth == m_lastPreviewWidth) - return; - m_lastPreviewWidth = newWidth; - const int h = m_ui->decorationList->rootObject()->property("contentHeight").toInt(); - const int y = m_ui->decorationList->rootObject()->property("contentY").toInt(); - // start at first element in sight - int row = 0; - if (h > 0) - row = qMin(qMax(0, y*m_model->rowCount()/h), m_model->rowCount()); - m_model->regeneratePreviews(row); -} - -void KWinDecorationModule::updatePreviewWidth() -{ - if (!m_previewUpdateTimer) { - m_previewUpdateTimer = new QTimer(this); - m_previewUpdateTimer->setSingleShot(true); - connect(m_previewUpdateTimer, SIGNAL(timeout()), this, SLOT(updatePreviews())); - } - m_model->stopPreviewGeneration(); - m_previewUpdateTimer->start(100); -} - -void KWinDecorationModule::updateScrollbarRange() -{ - m_ui->decorationList->verticalScrollBar()->blockSignals(true); - const bool atMinimum = m_ui->decorationList->rootObject()->property("atYBeginning").toBool(); - const int h = m_ui->decorationList->rootObject()->property("contentHeight").toInt(); - const int y = atMinimum ? m_ui->decorationList->rootObject()->property("contentY").toInt() : 0; - m_ui->decorationList->verticalScrollBar()->setRange(y, y + h - m_ui->decorationList->height()); - m_ui->decorationList->verticalScrollBar()->setPageStep(m_ui->decorationList->verticalScrollBar()->maximum()/m_model->rowCount()); - m_ui->decorationList->verticalScrollBar()->blockSignals(false); -} - -void KWinDecorationModule::updateScrollbarValue() -{ - const int v = m_ui->decorationList->rootObject()->property("contentY").toInt(); - m_ui->decorationList->verticalScrollBar()->blockSignals(true); // skippig this will kill kinetic scrolling but the scrollwidth is too low - m_ui->decorationList->verticalScrollBar()->setValue(v); - m_ui->decorationList->verticalScrollBar()->blockSignals(false); -} - -void KWinDecorationModule::updateViewPosition(int v) -{ - QGraphicsObject *list = m_ui->decorationList->rootObject(); - list->setProperty("contentY", v); -} - -DecorationButtons::DecorationButtons(QObject *parent) - : QObject(parent) - , m_customPositions(false) - , m_leftButtons(KDecorationOptions::defaultTitleButtonsLeft()) - , m_rightButtons(KDecorationOptions::defaultTitleButtonsRight()) -{ -} - -DecorationButtons::~DecorationButtons() -{ -} - -bool DecorationButtons::customPositions() const -{ - return m_customPositions; -} - -const QString &DecorationButtons::leftButtons() const -{ - return m_leftButtons; -} - -const QString &DecorationButtons::rightButtons() const -{ - return m_rightButtons; -} - -void DecorationButtons::setCustomPositions(bool set) -{ - if (m_customPositions == set) { - return; - } - m_customPositions = set; - emit customPositionsChanged(); -} - -void DecorationButtons::setLeftButtons(const QString &leftButtons) -{ - if (m_leftButtons == leftButtons) { - return; - } - m_leftButtons = leftButtons; - emit leftButtonsChanged(); -} - -void DecorationButtons::setRightButtons (const QString &rightButtons) -{ - if (m_rightButtons == rightButtons) { - return; - } - m_rightButtons = rightButtons; - emit rightButtonsChanged(); -} - -void DecorationButtons::resetToDefaults() -{ - setCustomPositions(false); - setLeftButtons(KDecorationOptions::defaultTitleButtonsLeft()); - setRightButtons(KDecorationOptions::defaultTitleButtonsRight()); -} - -} // namespace KWin - -#include "moc_kwindecoration.cpp" diff --git a/kwin/kcmkwin/kwindecoration/kwindecoration.desktop b/kwin/kcmkwin/kwindecoration/kwindecoration.desktop deleted file mode 100644 index 5238b095..00000000 --- a/kwin/kcmkwin/kwindecoration/kwindecoration.desktop +++ /dev/null @@ -1,203 +0,0 @@ -[Desktop Entry] -Exec=kcmshell4 kwindecoration -Icon=preferences-system-windows-action -Type=Service -X-KDE-ServiceTypes=KCModule -X-DocPath=kcontrol/kwindecoration/index.html - -X-KDE-Library=kcm_kwindecoration -X-KDE-ParentApp=kcontrol - -X-KDE-System-Settings-Parent-Category=desktop-appearance -X-KDE-Weight=90 - -Name=Window Decorations -Name[ar]=زخارف النوافذ -Name[ast]=Decoración de ventanes -Name[bg]=Декорации на прозорците -Name[bs]=Dekoracije prozora -Name[ca]=Decoració de les finestres -Name[ca@valencia]=Decoració de les finestres -Name[cs]=Dekorace oken -Name[da]=Vinduesdekorationer -Name[de]=Fensterdekoration -Name[el]=Διακοσμήσεις παραθύρου -Name[en_GB]=Window Decorations -Name[es]=Decoración de ventanas -Name[et]=Akna dekoratsioonid -Name[eu]=Leiho-apaindurak -Name[fi]=Ikkunoiden kehykset -Name[fr]=Décorations de fenêtres -Name[ga]=Maisiúcháin Fhuinneog -Name[gl]=Decoración da xanela -Name[he]=קישוטי חלון -Name[hi]=विंडो सजावट -Name[hr]=Ukrasi prozora -Name[hu]=Ablakdekorációk -Name[ia]=Decorationes de fenestra -Name[id]=Dekorasi Jendela -Name[is]=Gluggaskreytingar -Name[it]=Decorazioni delle finestre -Name[ja]=ウィンドウの飾り -Name[kk]=Терезенің безендірулері -Name[km]=ការ​តុបតែង​បង្អួច -Name[kn]=ವಿಂಡೋ ಅಲಂಕಾರಗಳು -Name[ko]=창 장식 -Name[lt]=Lango dekoracijos -Name[lv]=Logu dekorācijas -Name[mr]=चौकट सजावट -Name[nb]=Vinduspynt -Name[nds]=Finstern opfladusen -Name[nl]=Vensterdecoraties -Name[nn]=Vindaugspynt -Name[pa]=ਵਿੰਡੋ ਸਜਾਵਟ -Name[pl]=Wystrój okien -Name[pt]=Decorações das Janelas -Name[pt_BR]=Decorações da janela -Name[ro]=Decorații fereastră -Name[ru]=Оформление окон -Name[si]=කවුළු සැරසිලි -Name[sk]=Dekorácie okien -Name[sl]=Okraski oken -Name[sr]=Декорације прозора -Name[sr@ijekavian]=Декорације прозора -Name[sr@ijekavianlatin]=Dekoracije prozora -Name[sr@latin]=Dekoracije prozora -Name[sv]=Fönsterdekorationer -Name[th]=ส่วนตกแต่งหน้าต่าง -Name[tr]=Pencere Dekorasyonları -Name[ug]=كۆزنەك بېزەكلىرى -Name[uk]=Обрамлення вікон -Name[wa]=Gåyotaedjes des fniesses -Name[x-test]=xxWindow Decorationsxx -Name[zh_CN]=窗口装饰 -Name[zh_TW]=視窗裝飾 - -Comment=Configure the look and feel of window titles -Comment[af]=Stel die lyk-en-gevoel van venstertitels -Comment[ar]=اضبط المظهر والسمِة لعناوين النوافذ -Comment[ast]=Configuración del aspeutu y comportamientu de los títulos de les ventanes -Comment[be]=Настаўленні вонкавага выгляду загалоўкаў вокнаў -Comment[be@latin]=Nałady vyhladu zahałoŭkaŭ akon -Comment[bg]=Настройки на външния вид на заглавията прозорците -Comment[bn]=উইণ্ডো শিরোনামের চেহারা কনফিগার করুন -Comment[bn_IN]=উইন্ডোর শিরোনামের চেহারাছবি কনফিগার করতে ব্যবহৃত হয় -Comment[br]=Kefluniañ neuz ha feson titloù ar prenester -Comment[bs]=Podešavanje izgleda i osjećaja za naslove prozora -Comment[ca]=Configura l'aspecte i efecte dels títols de la finestra -Comment[ca@valencia]=Configura l'aspecte i efecte dels títols de la finestra -Comment[cs]=Nastavení vzhledu a dekorací oken -Comment[csb]=Kònfigùracëjô wëzdrzatkù ë ùchòwaniô titlowi listwë òknów -Comment[cy]=Ffurfweddu golwg a theimlad teitlau ffenestri -Comment[da]=Indstil udseendet af vinduestitler -Comment[de]=Das Erscheinungsbild von Fenstertiteln festlegen -Comment[el]=Διαμόρφωση της εμφάνισης και αίσθησης του τίτλου των παραθύρων -Comment[en_GB]=Configure the look and feel of window titles -Comment[eo]=Agordi la aspekton de la fenestraj titoloj -Comment[es]=Configuración del aspecto y comportamiento de los títulos de las ventanas -Comment[et]=Akna tiitliribade välimuse ja tunnetuse seadistamine -Comment[eu]=Konfiguratu leiho-tituluen itxura eta izaera -Comment[fa]=پیکربندی ظاهر و احساس عنوان پنجره‌ها -Comment[fi]=Ikkunoiden kehysten ulkoasuasetukset -Comment[fy]=Hjir kinne jo it uterlik en gedrach fan finstertitels ynstelle -Comment[ga]=Cumraigh dealramh na dteideal fuinneoige -Comment[gl]=Configurar a aparencia e o comportamento dos títulos das xanelas -Comment[gu]=વિન્ડો શીર્ષકોનો દેખાવ રૂપરેખાંકિત કરો -Comment[he]=הגדרת המראה והתחושה של כותרות החלונות -Comment[hi]=विंडो शीर्षकों के रूप आकार को कॉन्फ़िगर करें -Comment[hne]=विंडो सीर्सक के रूप आकार ल कान्फिगर करव -Comment[hr]=Konfiguriranje izgleda naslova prozora -Comment[hu]=Az ablakok címsorának megjelenési beállításai -Comment[ia]=Configura le semblantia de titulos de fenestra -Comment[id]=Atur tampilan dan rasa dari judul jendela -Comment[is]=Stilla viðmót gluggatitla -Comment[ka]=ფანჯრის სათაურის იერსახის კონფიგურაცია -Comment[kk]=Терезе айдарының безендіруін баптау -Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​រូបរាង​របស់​ចំណង​ជើង​បង្អួច -Comment[kn]=ಕಿಟಕಿಯ ಶೀರ್ಷಿಕೆಗಳ ರೂಪ, ಭಾವಗಳನ್ನು ಸಂರಚಿಸು -Comment[ko]=창 제목 표시줄의 모습과 느낌 설정 -Comment[lt]=Konfigūruoti langų antraščių išvaizdą ir elgseną -Comment[lv]=Šeit jūs varat konfigurēt loga virsrakstu izskatu un izturēšanos -Comment[mai]=विंडो शीर्षकों केर रूप आकार केँ बिन्यस्त करू -Comment[mk]=Конфигурирајте го изгледот и чувството на насловите на прозорците -Comment[ml]=ജാലകങ്ങളുടെ തലക്കെട്ടിന്റെ ഭംഗി ക്രമീകരിക്കുക. -Comment[mr]=चौकट शिर्षकचे रूप व आकार संयोजीत करा -Comment[nb]=Sett opp hvordan vindustitlene skal virke og se ut -Comment[nds]=Dat Utsehn vun de Finstertiteln instellen -Comment[ne]=सञ्झ्याल शीर्षकहरूको हेराइ र बुझाइ कन्फिगर गर्नुहोस् -Comment[nl]=Hier kunt u het uiterlijk en gedrag van venstertitels instellen -Comment[nn]=Set opp utsjånaden på vindaugstitlar -Comment[pa]=ਵਿੰਡੋ ਟਾਇਟਲਾਂ ਦੇ ਰੰਗ-ਰੂਪ ਦੀ ਸੰਰਚਨਾ -Comment[pl]=Ustawienia wyglądu i zachowań belek tytułowych okien -Comment[pt]=Configuração da aparência e comportamento dos títulos das janelas -Comment[pt_BR]=Configura a aparência dos títulos das janelas -Comment[ro]=Configurează aspectul titlului ferestrelor -Comment[ru]=Настройка внешнего вида заголовков окон -Comment[se]=Heivet lásenamahusaid fárdda -Comment[si]=කවුළු ශීර්‍ෂයන්හී පෙනුම හා හැඟීම සකසන්න -Comment[sk]=Nastavenie vzhľadu titulkov okien -Comment[sl]=Nastavi videz in delovanje naslovnih vrstic okna. -Comment[sr]=Подешавање изгледа и осећаја за наслове прозора -Comment[sr@ijekavian]=Подешавање изгледа и осјећаја за наслове прозора -Comment[sr@ijekavianlatin]=Podešavanje izgleda i osjećaja za naslove prozora -Comment[sr@latin]=Podešavanje izgleda i osećaja za naslove prozora -Comment[sv]=Anpassa namnlisternas utseende och känsla -Comment[ta]=சாளரம் மற்றும் தலைப்பின் காட்சிவகையை மாற்று -Comment[te]=విండో శీర్షికల ఆకృతి మరియు భావమును ఆకృతీకరించుము -Comment[tg]=Танзимоти намуди зохирии сарлавҳаҳои тиреза -Comment[th]=ปรับแต่งลักษณะรูปลักษณ์ของแถบหัวเรื่องหน้าต่าง -Comment[tr]=Pencere başlıklarını görünümlerini yapılandır -Comment[ug]=كۆزنەك ماۋزۇسىنىڭ كۆرۈنۈشىنى سەپلەيدۇ -Comment[uk]=Налаштування вигляду та поведінки заголовків вікон -Comment[uz]=Oyna sarlavhasining tashqi koʻrinishini moslash -Comment[uz@cyrillic]=Ойна сарлавҳасининг ташқи кўринишини мослаш -Comment[vi]=Cấu hình cảm quan cho tiêu đề cửa sổ -Comment[wa]=Apontyî li rivnance eyet l' dujhance des tites des fniesses -Comment[xh]=Qwalasela inkangeleko nemvakalelo yezihloko zeWindow -Comment[x-test]=xxConfigure the look and feel of window titlesxx -Comment[zh_CN]=配置窗口标题的观感 -Comment[zh_TW]=設定視窗標題列的外觀與感覺 - -X-KDE-Keywords=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration -X-KDE-Keywords[bs]=kwin,prozor,upravitelj,granica,stil,tema,izgled,osjećati,izgled,dugme,držati,ivica,kwm,dekoracija -X-KDE-Keywords[ca]=kwin,finestra,gestor,vora,estil,tema,aspecte,aparença,disposició,botó,gestió,vora,kwm,decoració -X-KDE-Keywords[ca@valencia]=kwin,finestra,gestor,vora,estil,tema,aspecte,aparença,disposició,botó,gestió,vora,kwm,decoració -X-KDE-Keywords[da]=kwin,vindueshåndtering,window,manager,kant,stil,tema,udseende,layout,knap,håndtag,kant,kwm,dekoration -X-KDE-Keywords[de]=KWin,Kwm,Fenster,Manager,Rahmen,Design,Stile,Themes,Optik,Erscheinungsbild,Layout,Knöpfe,Ränder,Dekorationen -X-KDE-Keywords[el]=kwin,παράθυρο,διαχειριστής,περίγραμμα,στιλ,θέμα,εμφάνιση,αίσθηση,διάταξη,κουμπί,χειρισμός,άκρη,kwm,διακόσμηση -X-KDE-Keywords[en_GB]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration -X-KDE-Keywords[es]=kwin,ventana,gestor,borde,estilo,tema,aspecto,sensación,disposición,botón,asa,borde,kwm,decoración -X-KDE-Keywords[et]=kwin,aken,haldur,piire,stiil,teema,välimus,paigutus,nupp,pide,serv,kwm,dekoratsioon -X-KDE-Keywords[eu]=kwin,leiho,kudeatzaile,ertz,estilo,gai, itxura,izaera,diseinu,botoi,helduleku,kwm,dekorazio,apaindura,apainketa -X-KDE-Keywords[fi]=kwin,ikkuna,hallinta,ikkunointiohjelma,kehys,reunus,tyyli,teema,ulkoasu,toiminta,asettelu,painike,kahva,kulma,reuna,kwm,koriste -X-KDE-Keywords[fr]=kwin, fenêtre, gestionnaire, composition, bordure, style, thème, apparence, comportement, disposition, bouton, prise en main, bord, kwm, décoration -X-KDE-Keywords[ga]=kwin,fuinneog,bainisteoir,imlíne,stíl,téama,cuma,brath,leagan amach,cnaipe,hanla,ciumhais,kwm,maisiúchán -X-KDE-Keywords[gl]=kwin,xanela,xestor,borde,estilo,tema,aparencia,comportamento,aspecto,disposición, botón,asa,bordo,kwm,decoración -X-KDE-Keywords[hu]=kwin,ablak,kezelő,szegély,stílus,téma,kinézet,megjelenés,elrendezés,gomb,kezel,szél,kwm,dekoráció -X-KDE-Keywords[ia]=kwin,fenestra,gerente,margine,stilo,thema,aspecto,sentir,disposition,button,maneator,bordo,kwm,decoration -X-KDE-Keywords[it]=kwin,gestore,finestre,bordo,stile,tema,aspetto,disposizione,pulsante,gestore,kwm,decorazione -X-KDE-Keywords[kk]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration -X-KDE-Keywords[km]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration -X-KDE-Keywords[ko]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,창,관리자,테두리,스타일,테마,단추,핸들,경계 -X-KDE-Keywords[nb]=kwin,vindu,behandler,ramme,stil,tema,lås,utforming,knapp,håndtak,kant,kwm -X-KDE-Keywords[nds]=KWin,Finster,Pleger,Rahmen,Stil,Muster,Utsehn,Bedenen,Knoop,Greep,Kant,kwm,Dekoratschoon -X-KDE-Keywords[nl]=kwin,venster,beheerder,grens,stijl,thema,look,feel,indeling,knop,handel,rand,kwm,decoratie -X-KDE-Keywords[pl]=kwin,okno,menadżer,obramowanie,styl,motyw,wygląd,odczucie,układ,przycisk, uchwyt,krawędź,kwm,dekoracja -X-KDE-Keywords[pt]=kwin,gestor,janela,contorno,estilo,tema,aparência,comportamento,disposição,botão,pega,extremo,kwm,decoração -X-KDE-Keywords[pt_BR]=kwin,gerenciador,janela,borda,estilo,tema,aparência,comportamento,leiaute,botão,canto,extremo,kwm,decoração -X-KDE-Keywords[ru]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,окно,диспетчер,граница,стиль,тема,внешний вид,оформление,разметка,шаблон,кнопка,управление,край -X-KDE-Keywords[sk]=kwin,okno,správca,rám,štýl,téma,vzhľad,cítenie,rozloženie,tlačidlo,spracovanie,okraj,kwm,dekorácia -X-KDE-Keywords[sl]=kwin,okna,okenski upravljalnik,upravljalnik oken,rob,obroba,slog,tema,videz,obnašanje,občutek,razpored,gumbi,ročica,okraski,kwm -X-KDE-Keywords[sr]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,К‑вин,прозор,менаџер,ивица,стила,тема,изглед,осећај,распоред,дугме,ручка,КВМ,декорација -X-KDE-Keywords[sr@ijekavian]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,К‑вин,прозор,менаџер,ивица,стила,тема,изглед,осећај,распоред,дугме,ручка,КВМ,декорација -X-KDE-Keywords[sr@ijekavianlatin]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,KWin,prozor,menadžer,ivica,stila,tema,izgled,osećaj,raspored,dugme,ručka,KWM,dekoracija -X-KDE-Keywords[sr@latin]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,KWin,prozor,menadžer,ivica,stila,tema,izgled,osećaj,raspored,dugme,ručka,KWM,dekoracija -X-KDE-Keywords[sv]=kwin,fönster,hantering,kant,stil,tema,utseende,känsla,layout,knapp,grepp,kant,kwm,dekoration -X-KDE-Keywords[tr]=kwin,pencere,yönetici,kenarlık,biçim,tema,görünüm,şekil,düzen,düğme,kullanım,kenar,kwm,dekorasyon -X-KDE-Keywords[uk]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,вікно,вікна,керування,менеджер,рамка,межа,стиль,тема,вигляд,поведінка,компонування,кнопка,елемент,край,декорації,обрамлення -X-KDE-Keywords[x-test]=xxkwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decorationxx -X-KDE-Keywords[zh_CN]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,窗口,管理,边框,样式,主题,外怪,布局,按钮,边界,装饰 -X-KDE-Keywords[zh_TW]=kwin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration - -Categories=Qt;KDE;X-KDE-settings-looknfeel; - diff --git a/kwin/kcmkwin/kwindecoration/kwindecoration.h b/kwin/kcmkwin/kwindecoration/kwindecoration.h deleted file mode 100644 index 377ab20e..00000000 --- a/kwin/kcmkwin/kwindecoration/kwindecoration.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - This is the new kwindecoration kcontrol module - - Copyright (c) 2001 - Karol Szwed - http://gallium.n3.net/ - Copyright 2009, 2010 Martin Gräßlin - - Supports new kwin configuration plugins, and titlebar button position - modification via dnd interface. - - Based on original "kwintheme" (Window Borders) - 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 - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -*/ - -#ifndef KWINDECORATION_H -#define KWINDECORATION_H - -#include -#include - -#include - -#include "ui_decoration.h" - -#include -#include - -namespace KWin -{ - -class DecorationModel; - -class KWinDecorationForm : public QWidget, public Ui::KWinDecorationForm -{ - Q_OBJECT - -public: - explicit KWinDecorationForm(QWidget* parent); -}; - -class DecorationButtons : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool customButtonPositions READ customPositions WRITE setCustomPositions NOTIFY customPositionsChanged) - Q_PROPERTY(QString leftButtons READ leftButtons WRITE setLeftButtons NOTIFY leftButtonsChanged) - Q_PROPERTY(QString rightButtons READ rightButtons WRITE setRightButtons NOTIFY rightButtonsChanged) -public: - explicit DecorationButtons(QObject *parent = 0); - virtual ~DecorationButtons(); - - bool customPositions() const; - const QString &leftButtons() const; - const QString &rightButtons() const; - - void setCustomPositions(bool set); - void setLeftButtons(const QString &leftButtons); - void setRightButtons(const QString &rightButtons); - -public Q_SLOTS: - void resetToDefaults(); - -Q_SIGNALS: - void customPositionsChanged(); - void leftButtonsChanged(); - void rightButtonsChanged(); - -private: - bool m_customPositions; - QString m_leftButtons; - QString m_rightButtons; -}; - -class KWinDecorationModule : public KCModule, public KDecorationDefines -{ - Q_OBJECT - -public: - KWinDecorationModule(QWidget* parent, const QVariantList &); - ~KWinDecorationModule(); - - virtual void load(); - virtual void save(); - virtual void defaults(); - - QString quickHelp() const; - - int itemWidth() const; - -signals: - void pluginLoad(const KConfigGroup& conf); - void pluginSave(KConfigGroup &conf); - void pluginDefaults(); - -protected: - bool eventFilter(QObject *o, QEvent *e); - virtual void showEvent(QShowEvent *ev); - -protected slots: - // Allows us to turn "save" on - void slotSelectionChanged(); - void slotConfigureButtons(); - void slotConfigureDecoration(); - -private: - void init(); - void readConfig(const KConfigGroup& conf); - void writeConfig(KConfigGroup &conf); -private slots: - void updatePreviews(); - void updatePreviewWidth(); - void updateScrollbarRange(); - void updateScrollbarValue(); - void updateViewPosition(int v); -private: - KSharedConfigPtr kwinConfig; - - KWinDecorationForm* m_ui; - bool m_showTooltips; - - DecorationModel* m_model; - QSortFilterProxyModel* m_proxyModel; - bool m_configLoaded; - DecorationButtons *m_decorationButtons; - - int m_lastPreviewWidth; - QTimer *m_previewUpdateTimer; -}; - -} //namespace - -#endif diff --git a/kwin/kcmkwin/kwindecoration/preview.cpp b/kwin/kcmkwin/kwindecoration/preview.cpp deleted file mode 100644 index 3e38e59d..00000000 --- a/kwin/kcmkwin/kwindecoration/preview.cpp +++ /dev/null @@ -1,518 +0,0 @@ -/* - * - * Copyright (c) 2003 Lubos Lunak - * - * 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 "preview.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -KDecorationPreview::KDecorationPreview(QWidget* parent) - : QWidget(parent) -{ - options = new KDecorationPreviewOptions; - - bridge[Active] = new KDecorationPreviewBridge(this, true); - bridge[Inactive] = new KDecorationPreviewBridge(this, false); - - deco[Active] = deco[Inactive] = NULL; - - setMinimumSize(100, 100); -} - -KDecorationPreview::~KDecorationPreview() -{ - for (int i = 0; i < NumWindows; i++) { - delete deco[i]; - delete bridge[i]; - } - delete options; -} - -bool KDecorationPreview::recreateDecoration(KDecorationPlugins* plugins) -{ - for (int i = 0; i < NumWindows; i++) { - delete deco[i]; // deletes also window - deco[i] = plugins->createDecoration(bridge[i]); - deco[i]->init(); - } - - m_activeMask = QRegion(); - m_inactiveMask = QRegion(); - - if (deco[Active] == NULL || deco[Inactive] == NULL) { - return false; - } - - return true; -} - -void KDecorationPreview::disablePreview() -{ - delete deco[Active]; - delete deco[Inactive]; - deco[Active] = deco[Inactive] = NULL; -} - -KDecorationFactory *KDecorationPreview::factory() const -{ - return deco[Active] ? deco[Active]->factory() : 0; -} - -QPixmap KDecorationPreview::preview() -{ - QPixmap pixmap(size()); - pixmap.fill(Qt::transparent); - if (!deco[Active] || !deco[Inactive]) - return pixmap; - - int titleBarHeight, leftBorder, rightBorder, xoffset, - dummy1, dummy2, dummy3; - // don't have more than one reference to the same dummy variable in one borders() call. - deco[Active]->borders(dummy1, dummy2, titleBarHeight, dummy3); - deco[Inactive]->borders(leftBorder, rightBorder, dummy1, dummy2); - - titleBarHeight = qMin(int(titleBarHeight * .9), 30); - xoffset = qMin(qMax(10, QApplication::isRightToLeft() - ? leftBorder : rightBorder), 30); - QPainter p; - p.begin(&pixmap); - - const QSize size(width() - xoffset - 20, height() - titleBarHeight - 20); - render(&p, deco[Inactive], size, QPoint(10 + xoffset, 10), m_inactiveMask); - render(&p, deco[Active], size, QPoint(10, 10 + titleBarHeight), m_activeMask); - p.end(); - return pixmap; -} - -void KDecorationPreview::render(QPainter *painter, KDecoration *decoration, const QSize &recommendedSize, const QPoint &offset, const QRegion &mask) const -{ - QWidget *w = decoration->widget(); - QSize size = QSize(recommendedSize) - .expandedTo(decoration->minimumSize()); - int padLeft, padRight, padTop, padBottom; - padLeft = padRight = padTop = padBottom = 0; - bool useMask = true; - decoration->padding(padLeft, padRight, padTop, padBottom); - size.setWidth(size.width() + padLeft + padRight); - size.setHeight(size.height() + padTop + padBottom); - if (padLeft || padRight || padTop || padBottom) { - useMask = false; - } - decoration->resize(size); - - // why an if-else block instead of (useMask ? mask : QRegion())? - // For what reason ever it completely breaks if the mask is copied. - if (useMask) { - w->render(painter, offset + QPoint(-padLeft, - padTop), mask, - QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); - } else { - w->render(painter, offset + QPoint(-padLeft, - padTop), QRegion(), - QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); - } -} - -QRect KDecorationPreview::windowGeometry(bool active) const -{ - QWidget *widget = active ? deco[Active]->widget() : deco[Inactive]->widget(); - return widget->geometry(); -} - -void KDecorationPreview::setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size) -{ - options->setCustomBorderSize(size); - if (plugin->factory()->reset(KDecorationDefines::SettingBorder)) { - // can't handle the change, recreate decorations then - recreateDecoration(plugin); - } -} - -void KDecorationPreview::setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const QString &left, const QString &right) -{ - options->setCustomTitleButtonsEnabled(customEnabled); - options->setCustomTitleButtons(left, right); - if (plugin->factory()->reset(KDecorationDefines::SettingButtons)) { - // can't handle the change, recreate decorations then - recreateDecoration(plugin); - } -} - -QRegion KDecorationPreview::unobscuredRegion(bool active, const QRegion& r) const -{ - Q_UNUSED(active) - return r; -} - -void KDecorationPreview::setMask(const QRegion ®ion, bool active) -{ - if (active) { - m_activeMask = region; - } else { - m_inactiveMask = region; - } -} - -KDecorationPreviewBridge::KDecorationPreviewBridge(KDecorationPreview* p, bool a) - : preview(p), active(a) -{ -} - -QWidget* KDecorationPreviewBridge::initialParentWidget() const -{ - return preview; -} - -Qt::WFlags KDecorationPreviewBridge::initialWFlags() const -{ - return 0; -} - -bool KDecorationPreviewBridge::isActive() const -{ - return active; -} - -bool KDecorationPreviewBridge::isCloseable() const -{ - return true; -} - -bool KDecorationPreviewBridge::isMaximizable() const -{ - return true; -} - -KDecoration::MaximizeMode KDecorationPreviewBridge::maximizeMode() const -{ - return KDecoration::MaximizeRestore; -} - -KDecoration::QuickTileMode KDecorationPreviewBridge::quickTileMode() const -{ - return KDecoration::QuickTileNone; -} - -bool KDecorationPreviewBridge::isMinimizable() const -{ - return true; -} - -bool KDecorationPreviewBridge::providesContextHelp() const -{ - return true; -} - -int KDecorationPreviewBridge::desktop() const -{ - return 1; -} - -bool KDecorationPreviewBridge::isModal() const -{ - return false; -} - -bool KDecorationPreviewBridge::isShadeable() const -{ - return true; -} - -bool KDecorationPreviewBridge::isShade() const -{ - return false; -} - -bool KDecorationPreviewBridge::isSetShade() const -{ - return false; -} - -bool KDecorationPreviewBridge::keepAbove() const -{ - return false; -} - -bool KDecorationPreviewBridge::keepBelow() const -{ - return false; -} - -bool KDecorationPreviewBridge::isMovable() const -{ - return true; -} - -bool KDecorationPreviewBridge::isResizable() const -{ - return true; -} - -NET::WindowType KDecorationPreviewBridge::windowType(unsigned long) const -{ - return NET::Normal; -} - -QIcon KDecorationPreviewBridge::icon() const -{ - return KIcon("xorg"); -} - -QString KDecorationPreviewBridge::caption() const -{ - return active ? i18n("Active Window") : i18n("Inactive Window"); -} - -void KDecorationPreviewBridge::processMousePressEvent(QMouseEvent*) -{ -} - -void KDecorationPreviewBridge::showWindowMenu(const QRect &) -{ -} - -void KDecorationPreviewBridge::showWindowMenu(const QPoint &) -{ -} - -void KDecorationPreviewBridge::performWindowOperation(WindowOperation) -{ -} - -void KDecorationPreviewBridge::setMask(const QRegion& reg, int mode) -{ - Q_UNUSED(mode) - preview->setMask(reg, active); -} - -bool KDecorationPreviewBridge::isPreview() const -{ - return true; -} - -QRect KDecorationPreviewBridge::geometry() const -{ - return preview->windowGeometry(active); -} - -QRect KDecorationPreviewBridge::iconGeometry() const -{ - return QRect(); -} - -QRegion KDecorationPreviewBridge::unobscuredRegion(const QRegion& r) const -{ - return preview->unobscuredRegion(active, r); -} - -WId KDecorationPreviewBridge::windowId() const -{ - return 0; // no decorated window -} - -void KDecorationPreviewBridge::closeWindow() -{ -} - -void KDecorationPreviewBridge::maximize(MaximizeMode) -{ -} - -void KDecorationPreviewBridge::minimize() -{ -} - -void KDecorationPreviewBridge::showContextHelp() -{ -} - -void KDecorationPreviewBridge::setDesktop(int) -{ -} - -void KDecorationPreviewBridge::titlebarDblClickOperation() -{ -} - -void KDecorationPreviewBridge::titlebarMouseWheelOperation(int) -{ -} - -void KDecorationPreviewBridge::setShade(bool) -{ -} - -void KDecorationPreviewBridge::setKeepAbove(bool) -{ -} - -void KDecorationPreviewBridge::setKeepBelow(bool) -{ -} - -int KDecorationPreviewBridge::currentDesktop() const -{ - return 1; -} - -void KDecorationPreviewBridge::grabXServer(bool) -{ -} - -bool KDecorationPreviewBridge::compositingActive() const -{ - return true; -} - -QRect KDecorationPreviewBridge::transparentRect() const -{ - return QRect(); -} - -// Window tabbing - -int KDecorationPreviewBridge::tabCount() const -{ - return 1; -} - -QString KDecorationPreviewBridge::caption(int) const -{ - return active ? "Active Window" : "Inactive Window"; -} - -QIcon KDecorationPreviewBridge::icon(int) const -{ - return icon(); -} - -long KDecorationPreviewBridge::tabId(int) const -{ - return 0; -} - -long KDecorationPreviewBridge::currentTabId() const -{ - return 0; -} - -void KDecorationPreviewBridge::setCurrentTab(long) -{ -} - -void KDecorationPreviewBridge::tab_A_before_B(long, long) -{ -} - -void KDecorationPreviewBridge::tab_A_behind_B(long, long) -{ -} - -void KDecorationPreviewBridge::untab(long, const QRect&) -{ -} - -void KDecorationPreviewBridge::closeTab(long) -{ -} - -void KDecorationPreviewBridge::closeTabGroup() -{ -} - -void KDecorationPreviewBridge::showWindowMenu(const QPoint &, long) -{ -} - - -KDecoration::WindowOperation KDecorationPreviewBridge::buttonToWindowOperation(Qt::MouseButtons) -{ - return KDecoration::NoOp; -} - -KDecorationPreviewOptions::KDecorationPreviewOptions() -{ - customBorderSize = BordersCount; // invalid - customButtonsChanged = false; // invalid - customButtons = true; - customTitleButtonsLeft.clear(); // invalid - customTitleButtonsRight.clear(); // invalid - updateSettings(); -} - -KDecorationPreviewOptions::~KDecorationPreviewOptions() -{ -} - -unsigned long KDecorationPreviewOptions::updateSettings() -{ - KConfig cfg("kwinrc"); - unsigned long changed = 0; - changed |= KDecorationOptions::updateSettings(&cfg); - - // set custom border size/buttons - if (customBorderSize != BordersCount) - setBorderSize(customBorderSize); - if (customButtonsChanged) - setCustomButtonPositions(customButtons); - if (customButtons) { - if (!customTitleButtonsLeft.isNull()) - setTitleButtonsLeft(customTitleButtonsLeft); - if (!customTitleButtonsRight.isNull()) - setTitleButtonsRight(customTitleButtonsRight); - } else { - setTitleButtonsLeft(KDecorationOptions::defaultTitleButtonsLeft()); - setTitleButtonsRight(KDecorationOptions::defaultTitleButtonsRight()); - } - - return changed; -} - -void KDecorationPreviewOptions::setCustomBorderSize(BorderSize size) -{ - customBorderSize = size; - - updateSettings(); -} - -void KDecorationPreviewOptions::setCustomTitleButtonsEnabled(bool enabled) -{ - customButtonsChanged = true; - customButtons = enabled; - - updateSettings(); -} - -void KDecorationPreviewOptions::setCustomTitleButtons(const QString &left, const QString &right) -{ - customTitleButtonsLeft = left; - customTitleButtonsRight = right; - - updateSettings(); -} - -#include "moc_preview.cpp" diff --git a/kwin/kcmkwin/kwindecoration/preview.h b/kwin/kcmkwin/kwindecoration/preview.h deleted file mode 100644 index d1ac6309..00000000 --- a/kwin/kcmkwin/kwindecoration/preview.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * - * Copyright (c) 2003 Lubos Lunak - * - * 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 KWINDECORATION_PREVIEW_H -#define KWINDECORATION_PREVIEW_H - -#include -#include -#include -#include - -class KDecorationPreviewBridge; -class KDecorationPreviewOptions; -#include - -class KDecorationPreview - : public QWidget -{ - Q_OBJECT -public: - // Note: Windows can't be added or removed without making changes to - // the code, since parts of it assume there's just an active - // and an inactive window. - enum Windows { Inactive = 0, Active, NumWindows }; - - explicit KDecorationPreview(QWidget* parent = NULL); - virtual ~KDecorationPreview(); - bool recreateDecoration(KDecorationPlugins* plugin); - void disablePreview(); - KDecorationFactory *factory() const; - QRegion unobscuredRegion(bool, const QRegion&) const; - QRect windowGeometry(bool) const; - void setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size); - void setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const QString &left, const QString &right); - QPixmap preview(); - void setMask(const QRegion ®ion, bool active); -private: - void render(QPainter *painter, KDecoration *decoration, const QSize &recommendedSize, const QPoint &offset, const QRegion &mask) const; - KDecorationPreviewOptions* options; - KDecorationPreviewBridge* bridge[NumWindows]; - KDecoration* deco[NumWindows]; - QRegion m_activeMask; - QRegion m_inactiveMask; -}; - -class KDecorationPreviewBridge - : public KDecorationBridge -{ -public: - KDecorationPreviewBridge(KDecorationPreview* preview, bool active); - virtual bool isActive() const; - virtual bool isCloseable() const; - virtual bool isMaximizable() const; - virtual MaximizeMode maximizeMode() const; - virtual QuickTileMode quickTileMode() const; - virtual bool isMinimizable() const; - virtual bool providesContextHelp() const; - virtual int desktop() const; - virtual bool isModal() const; - virtual bool isShadeable() const; - virtual bool isShade() const; - virtual bool isSetShade() const; - virtual bool keepAbove() const; - virtual bool keepBelow() const; - virtual bool isMovable() const; - virtual bool isResizable() const; - virtual NET::WindowType windowType(unsigned long supported_types) const; - virtual QIcon icon() const; - virtual QString caption() const; - virtual void processMousePressEvent(QMouseEvent*); - virtual void showWindowMenu(const QRect &); - virtual void showWindowMenu(const QPoint &); - virtual void performWindowOperation(WindowOperation); - virtual void setMask(const QRegion&, int); - virtual bool isPreview() const; - virtual QRect geometry() const; - virtual QRect iconGeometry() const; - virtual QRegion unobscuredRegion(const QRegion& r) const; - virtual WId windowId() const; - virtual void closeWindow(); - virtual void maximize(MaximizeMode mode); - virtual void minimize(); - virtual void showContextHelp(); - virtual void setDesktop(int desktop); - virtual void titlebarDblClickOperation(); - virtual void titlebarMouseWheelOperation(int delta); - virtual void setShade(bool set); - virtual void setKeepAbove(bool); - virtual void setKeepBelow(bool); - virtual int currentDesktop() const; - virtual QWidget* initialParentWidget() const; - virtual Qt::WFlags initialWFlags() const; - virtual void grabXServer(bool grab); - - virtual bool compositingActive() const; - virtual QRect transparentRect() const; - - // Window tabbing - virtual QString caption(int idx) const; - virtual void closeTab(long id); - virtual void closeTabGroup(); - virtual long currentTabId() const; - virtual QIcon icon(int idx) const; - virtual void setCurrentTab(long id); - virtual void showWindowMenu(const QPoint &, long id); - virtual void tab_A_before_B(long A, long B); - virtual void tab_A_behind_B(long A, long B); - virtual int tabCount() const; - virtual long tabId(int idx) const; - virtual void untab(long id, const QRect& newGeom); - virtual WindowOperation buttonToWindowOperation(Qt::MouseButtons button); - -private: - KDecorationPreview* preview; - bool active; -}; - -class KDecorationPreviewOptions - : public KDecorationOptions -{ -public: - KDecorationPreviewOptions(); - virtual ~KDecorationPreviewOptions(); - virtual unsigned long updateSettings(); - - void setCustomBorderSize(BorderSize size); - void setCustomTitleButtonsEnabled(bool enabled); - void setCustomTitleButtons(const QString &left, const QString &right); - -private: - BorderSize customBorderSize; - bool customButtonsChanged; - bool customButtons; - QString customTitleButtonsLeft; - QString customTitleButtonsRight; -}; - -class KDecorationPreviewPlugins - : public KDecorationPlugins -{ -public: - explicit KDecorationPreviewPlugins(const KSharedConfigPtr &cfg); -}; - -inline KDecorationPreviewPlugins::KDecorationPreviewPlugins(const KSharedConfigPtr &cfg) - : KDecorationPlugins(cfg) -{ -} - -#endif diff --git a/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml b/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml deleted file mode 100644 index 74ad78f9..00000000 --- a/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 - -Item { - property alias active: decoration.active - property alias source: auroraeLoader.source - QtObject { - signal configChanged - id: decoration - property bool active: false - property string caption: display - property int desktop: 1 - property variant icon: "xorg" - property bool closeable: true - property bool maximizeable: true - property bool minimizeable: true - property bool modal: false - property bool moveable: true - property bool onAllDesktops: false - property bool preview: true - property bool resizeable: true - property bool setShade: false - property bool shade: false - property bool shadeable: false - property bool keepAbove: false - property bool keepBelow: false - property bool maximized: false - property bool providesContextHelp: true - property string leftButtons: "MS" - property string rightButtons: "HIAX" - function titleMouseMoved() {} - function readConfig(key, defaultValue) { - if (key == "BorderSize") { - return borderSize; - } else if (key == "ButtonSize") { - return buttonSize; - } else { - return decorationBaseModel.readConfig(auroraeThemeName, key, defaultValue); - } - } - } - Loader { - id: auroraeLoader - anchors.fill: parent - } - Connections { - target: decorationBaseModel - onConfigChanged: { - if (auroraeThemeName == themeName) { - decoration.configChanged(); - } - } - } -} diff --git a/kwin/kcmkwin/kwindecoration/qml/AuroraePreview.qml b/kwin/kcmkwin/kwindecoration/qml/AuroraePreview.qml deleted file mode 100644 index 369914c0..00000000 --- a/kwin/kcmkwin/kwindecoration/qml/AuroraePreview.qml +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.kwin.aurorae 0.1 - -Item { - id: aurorae - AuroraeTheme { - id: auroraeTheme - Component.onCompleted: { - auroraeTheme.loadTheme(auroraeThemeName); - inactiveAurorae.source = auroraeSource; - activeAurorae.source = auroraeSource; - } - } - AuroraeDecoration { - id: inactiveAurorae - active: false - anchors { - fill: parent - leftMargin: 40 - auroraeTheme.paddingLeft - rightMargin: 10 - auroraeTheme.paddingRight - topMargin: 10 - auroraeTheme.paddingTop - bottomMargin: 40 - auroraeTheme.paddingBottom - } - } - AuroraeDecoration { - id: activeAurorae - active: true - anchors { - fill: parent - leftMargin: 10 - auroraeTheme.paddingLeft - rightMargin: 40 - auroraeTheme.paddingRight - topMargin: 40 - auroraeTheme.paddingTop - bottomMargin: 10 - auroraeTheme.paddingBottom - } - } -} diff --git a/kwin/kcmkwin/kwindecoration/qml/DecorationPreview.qml b/kwin/kcmkwin/kwindecoration/qml/DecorationPreview.qml deleted file mode 100644 index ee476c2a..00000000 --- a/kwin/kcmkwin/kwindecoration/qml/DecorationPreview.qml +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 - -Item { - id: decorationPreview - AuroraeDecoration { - id: inactiveDecoration - active: false - anchors { - fill: parent - leftMargin: 40 - rightMargin: 10 - topMargin: 10 - bottomMargin: 40 - } - } - AuroraeDecoration { - id: activeDecoration - active: true - anchors { - fill: parent - leftMargin: 10 - rightMargin: 40 - topMargin: 40 - bottomMargin: 10 - } - } - Component.onCompleted: { - inactiveDecoration.source = mainScript; - activeDecoration.source = mainScript; - } -} diff --git a/kwin/kcmkwin/kwindecoration/qml/main.qml b/kwin/kcmkwin/kwindecoration/qml/main.qml deleted file mode 100644 index 70f5d3d9..00000000 --- a/kwin/kcmkwin/kwindecoration/qml/main.qml +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin -Copyright (C) 2012 Nuno Pinheiro - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.qtextracomponents 0.1 as QtExtra - -ListView { - id: listView - x: 0 - y: 0 - model: decorationModel - highlight: Rectangle { - width: listView.width - sliderWidth - height: 150 - color: highlightColor - opacity: 0.5 - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - delegate: Item { - objectName: "decorationItem" - width: listView.width - sliderWidth - height: 150 - QtExtra.QPixmapItem { - pixmap: preview - anchors.fill: parent - visible: type == 0 - } - Loader { - source: type == 1 ? "AuroraePreview.qml" : "" - anchors.fill: parent - } - Loader { - source: type == 2 ? "DecorationPreview.qml" : "" - anchors.fill: parent - } - MouseArea { - hoverEnabled: false - anchors.fill: parent - onClicked: { - listView.currentIndex = index; - } - } - } -} diff --git a/kwin/kcmkwin/kwinscreenedges/main.cpp b/kwin/kcmkwin/kwinscreenedges/main.cpp index b2c946d9..ab19d2af 100644 --- a/kwin/kcmkwin/kwinscreenedges/main.cpp +++ b/kwin/kcmkwin/kwinscreenedges/main.cpp @@ -248,23 +248,6 @@ void KWinScreenEdgesConfig::monitorLoad() foreach (const int i, list) { monitorChangeEdge(ElectricBorder(i), PresentWindowsClass); } - - // TabBox - KConfigGroup tabBoxConfig(m_config, "TabBox"); - list.clear(); - // TabBox - list.append(ElectricNone); - list = tabBoxConfig.readEntry("BorderActivate", list); - foreach (const int i, list) { - monitorChangeEdge(ElectricBorder(i), TabBox); - } - // Alternative TabBox - list.clear(); - list.append(ElectricNone); - list = tabBoxConfig.readEntry("BorderAlternativeActivate", list); - foreach (const int i, list) { - monitorChangeEdge(ElectricBorder(i), TabBoxAlternative); - } } void KWinScreenEdgesConfig::monitorSaveAction(int edge, const QString& configName) @@ -301,13 +284,6 @@ void KWinScreenEdgesConfig::monitorSave() monitorCheckEffectHasEdge(PresentWindowsCurrent)); presentWindowsConfig.writeEntry("BorderActivateClass", monitorCheckEffectHasEdge(PresentWindowsClass)); - - // TabBox - KConfigGroup tabBoxConfig(m_config, "TabBox"); - tabBoxConfig.writeEntry("BorderActivate", - monitorCheckEffectHasEdge(TabBox)); - tabBoxConfig.writeEntry("BorderAlternativeActivate", - monitorCheckEffectHasEdge(TabBoxAlternative)); } void KWinScreenEdgesConfig::monitorDefaults() @@ -336,12 +312,6 @@ void KWinScreenEdgesConfig::monitorShowEvent() monitorItemSetEnabled(PresentWindowsCurrent, false); monitorItemSetEnabled(PresentWindowsAll, false); } - // tabbox, depends on reasonable focus policy. - KConfigGroup config2(m_config, "Windows"); - QString focusPolicy = config2.readEntry("FocusPolicy", QString()); - bool reasonable = focusPolicy != "FocusStrictlyUnderMouse" && focusPolicy != "FocusUnderMouse"; - monitorItemSetEnabled(TabBox, reasonable); - monitorItemSetEnabled(TabBoxAlternative, reasonable); } void KWinScreenEdgesConfig::monitorChangeEdge(ElectricBorder border, int index) diff --git a/kwin/kcmkwin/kwinscreenedges/main.h b/kwin/kcmkwin/kwinscreenedges/main.h index 1b27de04..d0a0fa0c 100644 --- a/kwin/kcmkwin/kwinscreenedges/main.h +++ b/kwin/kcmkwin/kwinscreenedges/main.h @@ -66,9 +66,7 @@ private: PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions PresentWindowsCurrent = 4, PresentWindowsClass = 5, - DesktopGrid = 6, - TabBox = 7, - TabBoxAlternative = 8 + DesktopGrid = 6 }; bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const; diff --git a/kwin/kcmkwin/kwintabbox/CMakeLists.txt b/kwin/kcmkwin/kwintabbox/CMakeLists.txt deleted file mode 100644 index fd7f7e3f..00000000 --- a/kwin/kcmkwin/kwintabbox/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -include_directories( ${CMAKE_SOURCE_DIR}/kwin/tabbox ) - -########### next target ############### - -ADD_DEFINITIONS(-DTABBOX_KCM) - -set(kcm_kwintabbox_PART_SRCS - main.cpp - layoutpreview.cpp - thumbnailitem.cpp - ${CMAKE_SOURCE_DIR}/kwin/tabbox/clientmodel.cpp - ${CMAKE_SOURCE_DIR}/kwin/tabbox/declarative.cpp - ${CMAKE_SOURCE_DIR}/kwin/tabbox/desktopmodel.cpp - ${CMAKE_SOURCE_DIR}/kwin/tabbox/tabboxconfig.cpp - ${CMAKE_SOURCE_DIR}/kwin/tabbox/tabboxhandler.cpp - main.ui -) - -kde4_add_plugin(kcm_kwintabbox ${kcm_kwintabbox_PART_SRCS}) - -target_link_libraries(kcm_kwintabbox - KDE4::kdeui - KDE4::kcmutils - KDE4::plasma - ${X11_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARY} - KDE4::kdeclarative -) - -install( - TARGETS kcm_kwintabbox - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -########### install files ############### -install( - FILES kwintabbox.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) -install( - FILES qml/main.qml - DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/kcm_kwintabbox -) -install( - FILES - thumbnails/konsole.png - thumbnails/kmail.png - thumbnails/systemsettings.png - thumbnails/dolphin.png - DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/kcm_kwintabbox -) diff --git a/kwin/kcmkwin/kwintabbox/Messages.sh b/kwin/kcmkwin/kwintabbox/Messages.sh deleted file mode 100644 index 6f3f488c..00000000 --- a/kwin/kcmkwin/kwintabbox/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -$EXTRACTRC *.ui >> rc.cpp || exit 11 -$XGETTEXT *.cpp -o $podir/kcm_kwintabbox.pot -rm -f rc.cpp diff --git a/kwin/kcmkwin/kwintabbox/kwintabbox.desktop b/kwin/kcmkwin/kwintabbox/kwintabbox.desktop deleted file mode 100644 index 87011600..00000000 --- a/kwin/kcmkwin/kwintabbox/kwintabbox.desktop +++ /dev/null @@ -1,163 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule -Icon=window-duplicate -Exec=kcmshell4 kwintabbox -X-DocPath=kcontrol/kwintabbox/index.html -X-KDE-Library=kcm_kwintabbox -X-KDE-ParentApp=kcontrol - -X-KDE-System-Settings-Parent-Category=workspace-behavior -X-KDE-Weight=110 - -Name=Task Switcher -Name[ar]=مبدّل المهام -Name[ast]=Camudador de xeres -Name[bg]=Превключване на задачи -Name[bs]=Prebacivanje zadataka -Name[ca]=Commutador de tasques -Name[ca@valencia]=Commutador de tasques -Name[cs]=Přepínač úloh -Name[da]=Opgaveskifter -Name[de]=Anwendungsumschalter -Name[el]=Εναλλαγή εργασιών -Name[en_GB]=Task Switcher -Name[es]=Cambiador de tareas -Name[et]=Ülesannete vahetaja -Name[eu]=Ataza-aldarazlea -Name[fi]=Ikkunanvalitsin -Name[fr]=Changeur de tâches -Name[ga]=Malartóir Tascanna -Name[gl]=Selector de tarefa -Name[he]=מחליף משימות -Name[hi]=कार्य बदल -Name[hr]=Prebacivač zadataka -Name[hu]=Feladatváltó -Name[ia]=Commutator de carga -Name[id]=Pengganti Tugas -Name[is]=Verkefnaskiptir -Name[it]=Scambiafinestre -Name[ja]=タスクスイッチャー -Name[kk]=Тапсырма ауыстырғышы -Name[km]=កម្មវិធី​ប្ដូរ​ភារកិច្ច​ -Name[kn]=ಕಾರ್ಯ ಬದಲಾವಣೆಗಾರ -Name[ko]=작업 전환기 -Name[lt]=Užduočių keitiklis -Name[lv]=Uzdevumu pārslēdzējs -Name[mr]=कार्य बदलणारा -Name[nb]=Oppgavebytter -Name[nds]=Twischen Opgaven wesseln -Name[nl]=Taakschakelaar -Name[nn]=Oppgåvevekslar -Name[pa]=ਟਾਸਕ ਸਵਿੱਚਰ -Name[pl]=Przełączanie zadań -Name[pt]=Mudança de Tarefas -Name[pt_BR]=Mudança de tarefas -Name[ro]=Comutator de sarcini -Name[ru]=Переключение окон -Name[si]=කාර්ය මාරුකරනය -Name[sk]=Prepínač úloh -Name[sl]=Preklop med opravili -Name[sr]=Пребацивање задатака -Name[sr@ijekavian]=Пребацивање задатака -Name[sr@ijekavianlatin]=Prebacivanje zadataka -Name[sr@latin]=Prebacivanje zadataka -Name[sv]=Aktivitetsbyte -Name[th]=ตัวสลับงาน -Name[tr]=Görev Seçici -Name[ug]=ۋەزىپە ئالماشتۇرغۇچ -Name[uk]=Перемикання задач -Name[wa]=Passaedje d' ene bouye a l' ôte -Name[x-test]=xxTask Switcherxx -Name[zh_CN]=任务切换器 -Name[zh_TW]=工作切換器 -Comment=Configure the behavior for navigating through windows -Comment[ast]=Configurar el comportamientu de la navegación poles ventanes. -Comment[bg]=Настройки на поведението при превключване между прозорците -Comment[bs]=Podešavanje ponašanja pri kretanju kroz prozore -Comment[ca]=Configura el comportament per navegar per les finestres -Comment[ca@valencia]=Configura el comportament per navegar per les finestres -Comment[cs]=Nastavení chování pro navigaci okny -Comment[da]=Indstil opførsel for navigering imellem vinduer -Comment[de]=Verhalten zum Durchsehen von Fenstern festlegen -Comment[el]=Διαμορφώστε τη συμπεριφορά για την περιήγηση μέσω παραθύρων -Comment[en_GB]=Configure the behaviour for navigating through windows -Comment[es]=Configurar el comportamiento de la circulación entre ventanas -Comment[et]=Akende vahel liikumise seadistamine -Comment[eu]=Konfiguratu leihoen arteko nabigaziorako portaera -Comment[fi]=Ikkunoiden selausasetukset -Comment[gl]=Configura o comportamento do percorrido polas xanelas -Comment[he]=הגדרת ההתנהגות בניווט בין חלונות -Comment[hr]=Podesi ponašanje listanja prozora -Comment[hu]=Az ablakok közötti váltás működésének beállítása -Comment[ia]=Configura le comportamento pro navigar intra fenestras -Comment[is]=Stilla hegðun flakks á milli glugga. -Comment[kk]=Терезелер арасында ауысу тәртібін орнату. -Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ឥរិយាបថ​សម្រាប់​រុករក​កាត់​បង្អួច ។ -Comment[ko]=창 탐색 효과 설정 -Comment[lt]=Navigavimo tarp langų elgsenos konfigūravimas -Comment[lv]=Konfigurē uzvedību, navigējot starp logiem -Comment[mr]=चौकटींमध्ये संचारण करण्याचे वर्तन संयोजीत करा -Comment[nb]=Sett opp oppførselen for navigering gjennom vinduer -Comment[nds]=Dat Bedregen bi't „Lopen dör de Finstern“ instellen -Comment[nl]=Het gedrag voor het door vensters wandelen configureren -Comment[pa]=ਵਿੰਡੋਜ਼ ਵਿੱਚ ਏਧਰ-ਓਧਰ ਕਰਨ ਦੇ ਰਵੱਈਏ ਦੀ ਸੰਰਚਨਾ -Comment[pl]=Ustawienia zachowań przechodzenia między oknami -Comment[pt]=Configurar o comportamento de navegação pelas janelas -Comment[pt_BR]=Configura o comportamento da navegação pelas janelas -Comment[ro]=Configurează comportamentul navigării printre ferestre -Comment[ru]=Настройка поведения переключателя окон -Comment[sk]=Nastavenie správania pre prepínanie medzi oknami -Comment[sl]=Nastavi obnašanje pri preklapljanju med okni -Comment[sr]=Подешавање понашања при кретању кроз прозоре -Comment[sr@ijekavian]=Подешавање понашања при кретању кроз прозоре -Comment[sr@ijekavianlatin]=Podešavanje ponašanja pri kretanju kroz prozore -Comment[sr@latin]=Podešavanje ponašanja pri kretanju kroz prozore -Comment[sv]=Anpassa beteendet för att navigera i fönster -Comment[th]=ปรับแต่งพฤติกรรมของการนำร่องไปยังหน้าต่างต่าง ๆ -Comment[tr]=Pencereler arasında gezinme davranışını yapılandır -Comment[uk]=Налаштування поведінки системи під час навігації вікнами -Comment[vi]=Cấu hình hành vi điều hướng qua các cửa sổ -Comment[wa]=Apontyî li dujhance naiviaedje avå les fniesses -Comment[x-test]=xxConfigure the behavior for navigating through windowsxx -Comment[zh_CN]=配置窗口导航的行为 -Comment[zh_TW]=設定透過視窗導覽的行為。 -X-KDE-Keywords=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[bs]=prozor,prozori,razmijenjivati,razimjenjivati prozor,gašenje prozora,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[ca]=finestra,finestres,commutador,commutador de finestres,commutació,commutació de finestres,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[ca@valencia]=finestra,finestres,commutador,commutador de finestres,commutació,commutació de finestres,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[da]=vindue,vinduer,skifter,vinduesskifter,skift,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[de]=fenster,umschalter,fensterumschalter,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[el]=παράθυρο,παράθυρα,εναλλάκτης,εναλλάκτης παραθύρων,εναλλαγή,εναλλαγή παραθύρων,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[en_GB]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[es]=ventana,ventanas,conmutador,conmutador de ventanas,conmutación,conmutación de ventanas,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[et]=aken,aknad,lülitaja,akende vahetaja,vahetamine,lülitamine,akende lülitamine,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[eu]=leiho,leihoak,kommutadore,aldatzaile,leiho-kommutadore,leiho-aldatzaile,aldatzea,leihoz aldatzea,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[fi]=ikkuna,ikkunat,vaihtaja,vaihto,valitsin,ikkunan vaihtaja,tehtävänvalitsin,ikkunanvalitsin,vaihtaminen,ikkunan vaihtaminen,ikkunan vaihto,alttab,alt-tab,alt+tab,alt tab,altsarkain,alt-sarkain,alt+sarkain,alt sarkain -X-KDE-Keywords[fr]=fenêtre, fenêtres, basculeur, changeur de fenêtre, basculer, changement de fenêtre, alttab, alt-tab, alt+tab, alt tab -X-KDE-Keywords[gl]=xanela,xanelas,alternador,cambiar,trocar de xanela,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[hu]=ablak,ablakok,váltó,ablakváltó,váltás,ablakváltás,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[ia]=fenestra,fenestras,commutator,commutator de fenestra,commutar,commutar fenestra,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[it]=finestra,finestre,scambiatore,scambiafinestre,scambio,scambio finestre,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[kk]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[km]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[ko]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,창,창 전환,창 전환기,전환 -X-KDE-Keywords[nb]=vindu,vinduer,bytter,vindusbytter,bytte,vindusbytte,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[nds]=Finster,Finstern,wesseln,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[nl]=venster,vensters,schakelaar,vensterwisselaar,wisseling,vensterwisseling,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[pl]=okno,okna,przełączanie,przełączanie okien,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[pt]=janela,janelas,selector,selector de janelas,mudar,mudança de janela,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[pt_BR]=janela,janelas,seletor,seletor de janelas,mudar,mudança de janela,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[ru]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,окно,окна,переключатель,переключатель окон,переключение,переключение окон -X-KDE-Keywords[sk]=okno,okná,prepínač,prepínanie okien,prepínanie,prepínač okien,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[sl]=okno,okna,preklapljanje,preklapljanje med okni,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[sr]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,прозор,мењач,мењач прозора,мењање,пребацивање,AltTab,Alt-Tab,Alt+Tab,Alt Tab -X-KDE-Keywords[sr@ijekavian]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,прозор,мењач,мењач прозора,мењање,пребацивање,AltTab,Alt-Tab,Alt+Tab,Alt Tab -X-KDE-Keywords[sr@ijekavianlatin]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,prozor,menjač,menjač prozora,menjanje,prebacivanje,AltTab,Alt-Tab,Alt+Tab,Alt Tab -X-KDE-Keywords[sr@latin]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,prozor,menjač,menjač prozora,menjanje,prebacivanje,AltTab,Alt-Tab,Alt+Tab,Alt Tab -X-KDE-Keywords[sv]=fönster,byte,fönsterbytare,byta,fönsterbyte,alttabulator,alt-tabulator,alt+tabulator,alt tabulator -X-KDE-Keywords[tr]=pencere,pencereler,değiştirici,pencere seçici,değiştirme,pencere seçimi,alttab,alt-tab,alt+tab,alt tab -X-KDE-Keywords[uk]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,вікно,вікна,перемикач,перемикач вікон,перемикання,перемикання вікон,альттаб,альт-таб,альт+таб -X-KDE-Keywords[x-test]=xxwindow,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tabxx -X-KDE-Keywords[zh_CN]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab,窗口,窗口切换器,切换器, -X-KDE-Keywords[zh_TW]=window,windows,switcher,window switcher,switching,window switching,alttab,alt-tab,alt+tab,alt tab diff --git a/kwin/kcmkwin/kwintabbox/layoutpreview.cpp b/kwin/kcmkwin/kwintabbox/layoutpreview.cpp deleted file mode 100644 index ad3177c6..00000000 --- a/kwin/kcmkwin/kwintabbox/layoutpreview.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009, 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -// own -#include "layoutpreview.h" -#include "thumbnailitem.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace KWin -{ -namespace TabBox -{ - -LayoutPreview::LayoutPreview(QWidget* parent) - : QDeclarativeView(parent) -{ - setAutoFillBackground(false); - QPalette pal = palette(); - pal.setColor(backgroundRole(), Qt::transparent); - setPalette(pal); - setMinimumSize(QSize(480, 310)); - setResizeMode(QDeclarativeView::SizeRootObjectToView); - foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) { - engine()->addImportPath(importPath); - } - foreach (const QString &importPath, KGlobal::dirs()->findDirs("data", "kwin/tabbox")) { - engine()->addImportPath(importPath); - } - ExampleClientModel *model = new ExampleClientModel(this); - engine()->addImageProvider(QLatin1String("client"), new TabBoxImageProvider(model)); - KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(engine()); - kdeclarative.initialize(); - kdeclarative.setupBindings(); - qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); - rootContext()->setContextProperty("clientModel", model); - rootContext()->setContextProperty("sourcePath", QString()); - rootContext()->setContextProperty("name", QString()); - setSource(KStandardDirs::locate("data", "kwin/kcm_kwintabbox/main.qml")); -} - -LayoutPreview::~LayoutPreview() -{ -} - -void LayoutPreview::setLayout(const QString &path, const QString &name) -{ - rootContext()->setContextProperty("sourcePath", path); - rootContext()->setContextProperty("name", name); -} - -TabBoxImageProvider::TabBoxImageProvider(QAbstractListModel* model) - : QDeclarativeImageProvider(QDeclarativeImageProvider::Pixmap) - , m_model(model) -{ -} - -QPixmap TabBoxImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - bool ok = false; - QStringList parts = id.split('/'); - const int index = parts.first().toInt(&ok); - if (!ok) { - return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize); - } - QSize s(32, 32); - if (requestedSize.isValid()) { - s = requestedSize; - } - *size = s; - QPixmap icon(KIcon(m_model->data(m_model->index(index), Qt::UserRole+3).toString()).pixmap(s)); - if (parts.size() > 2) { - KIconEffect *effect = KIconLoader::global()->iconEffect(); - KIconLoader::States state = KIconLoader::DefaultState; - if (parts.at(2) == QLatin1String("selected")) { - state = KIconLoader::ActiveState; - } else if (parts.at(2) == QLatin1String("disabled")) { - state = KIconLoader::DisabledState; - } - icon = effect->apply(icon, KIconLoader::Desktop, state); - } - return icon; -} - -ExampleClientModel::ExampleClientModel (QObject* parent) - : QAbstractListModel (parent) -{ - QHash roles; - roles[Qt::UserRole] = "caption"; - roles[Qt::UserRole+1] = "minimized"; - roles[Qt::UserRole+2] = "desktopName"; - roles[Qt::UserRole+4] = "windowId"; - setRoleNames(roles); - init(); -} - -ExampleClientModel::~ExampleClientModel() -{ -} - -void ExampleClientModel::init() -{ - QList applications; - applications << "konsole" << "kmail" << "systemsettings" << "dolphin"; - - foreach (const QString& application, applications) { - KService::Ptr service = KService::serviceByStorageId(application + ".desktop"); - if (service) { - m_nameList << service->entryPath(); - } - } -} - -QVariant ExampleClientModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) { - return QVariant(); - } - switch (role) { - case Qt::DisplayRole: - case Qt::UserRole: - return KDesktopFile(m_nameList.at(index.row())).readName(); - case Qt::UserRole+1: - return false; - case Qt::UserRole+2: - return i18nc("An example Desktop Name", "Desktop 1"); - case Qt::UserRole+3: - return KDesktopFile(m_nameList.at(index.row())).readIcon(); - case Qt::UserRole+4: - const QString desktopFile = KDesktopFile(m_nameList.at(index.row())).fileName().split('/').last(); - if (desktopFile == "konsole.desktop") { - return WindowThumbnailItem::Konsole; - } else if (desktopFile == "kmail.desktop") { - return WindowThumbnailItem::KMail; - } else if (desktopFile == "systemsettings.desktop") { - return WindowThumbnailItem::Systemsettings; - } else if (desktopFile == "dolphin.desktop") { - return WindowThumbnailItem::Dolphin; - } - return 0; - } - return QVariant(); -} - -int ExampleClientModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - return m_nameList.size(); -} - -} // namespace KWin -} // namespace TabBox - diff --git a/kwin/kcmkwin/kwintabbox/layoutpreview.h b/kwin/kcmkwin/kwintabbox/layoutpreview.h deleted file mode 100644 index 7c20a9f1..00000000 --- a/kwin/kcmkwin/kwintabbox/layoutpreview.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009, 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_TABBOX_LAYOUTPREVIEW_H -#define KWIN_TABBOX_LAYOUTPREVIEW_H - -#include -#include -#include - -namespace KWin -{ - -namespace TabBox -{ - -class LayoutPreview : public QDeclarativeView -{ - Q_OBJECT -public: - explicit LayoutPreview(QWidget *parent = NULL); - virtual ~LayoutPreview(); - - void setLayout(const QString &path, const QString &name); -}; - -class TabBoxImageProvider : public QDeclarativeImageProvider -{ -public: - explicit TabBoxImageProvider(QAbstractListModel *model); - virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); -private: - QAbstractListModel *m_model; -}; - -class ExampleClientModel : public QAbstractListModel -{ - Q_OBJECT -public: - explicit ExampleClientModel(QObject *parent = NULL); - virtual ~ExampleClientModel(); - - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - -private: - void init(); - QStringList m_nameList; -}; - -} // namespace TabBox -} // namespace KWin - -#endif // KWIN_TABBOX_LAYOUTPREVIEW_H diff --git a/kwin/kcmkwin/kwintabbox/main.cpp b/kwin/kcmkwin/kwintabbox/main.cpp deleted file mode 100644 index cfe2810f..00000000 --- a/kwin/kcmkwin/kwintabbox/main.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "main.h" - -// Katie -#include -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// own -#include "tabboxconfig.h" -#include "layoutpreview.h" - -K_PLUGIN_FACTORY(KWinTabBoxConfigFactory, registerPlugin();) -K_EXPORT_PLUGIN(KWinTabBoxConfigFactory("kcm_kwintabbox")) - -namespace KWin -{ - -using namespace TabBox; - -KWinTabBoxConfigForm::KWinTabBoxConfigForm(QWidget* parent) - : QWidget(parent) -{ - setupUi(this); -} - -KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args) - : KCModule(KWinTabBoxConfigFactory::componentData(), parent, args) - , m_config(KSharedConfig::openConfig("kwinrc")) - , m_layoutPreview(NULL) -{ - KGlobal::locale()->insertCatalog("kwin_effects"); - KTabWidget* tabWidget = new KTabWidget(this); - m_primaryTabBoxUi = new KWinTabBoxConfigForm(tabWidget); - m_alternativeTabBoxUi = new KWinTabBoxConfigForm(tabWidget); - tabWidget->addTab(m_primaryTabBoxUi, i18n("Main")); - tabWidget->addTab(m_alternativeTabBoxUi, i18n("Alternative")); - QVBoxLayout* layout = new QVBoxLayout(this); - KTitleWidget* infoLabel = new KTitleWidget(tabWidget); - infoLabel->setText(i18n("Focus policy settings limit the functionality of navigating through windows."), - KTitleWidget::InfoMessage); - infoLabel->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft); - layout->addWidget(infoLabel,0); - layout->addWidget(tabWidget,1); - setLayout(layout); - -#define ADD_SHORTCUT(_NAME_, _CUT_, _BTN_) \ - a = qobject_cast(m_actionCollection->addAction(_NAME_));\ - a->setProperty("isConfigurationAction", true);\ - _BTN_->setProperty("shortcutAction", _NAME_);\ - a->setText(i18n(_NAME_));\ - a->setGlobalShortcut(KShortcut(_CUT_)); \ - connect(_BTN_, SIGNAL(keySequenceChanged(QKeySequence)), SLOT(shortcutChanged(QKeySequence))) - - // Shortcut config. The shortcut belongs to the component "kwin"! - m_actionCollection = new KActionCollection(this, KComponentData("kwin")); - m_actionCollection->setConfigGroup("Navigation"); - m_actionCollection->setConfigGlobal(true); - KAction* a; - ADD_SHORTCUT("Walk Through Windows", Qt::ALT + Qt::Key_Tab, m_primaryTabBoxUi->scAll); - ADD_SHORTCUT("Walk Through Windows (Reverse)", Qt::ALT + Qt::SHIFT + Qt::Key_Backtab, - m_primaryTabBoxUi->scAllReverse); - ADD_SHORTCUT("Walk Through Windows Alternative", , m_alternativeTabBoxUi->scAll); - ADD_SHORTCUT("Walk Through Windows Alternative (Reverse)", ,m_alternativeTabBoxUi->scAllReverse); - ADD_SHORTCUT("Walk Through Windows of Current Application", Qt::ALT + Qt::Key_QuoteLeft, - m_primaryTabBoxUi->scCurrent); - ADD_SHORTCUT("Walk Through Windows of Current Application (Reverse)", Qt::ALT + Qt::Key_AsciiTilde, - m_primaryTabBoxUi->scCurrentReverse); - ADD_SHORTCUT("Walk Through Windows of Current Application Alternative", , m_alternativeTabBoxUi->scCurrent); - ADD_SHORTCUT("Walk Through Windows of Current Application Alternative (Reverse)", , - m_alternativeTabBoxUi->scCurrentReverse); -#undef ADD_SHORTCUT - - initLayoutLists(); - KWinTabBoxConfigForm *ui[2] = { m_primaryTabBoxUi, m_alternativeTabBoxUi }; - for (int i = 0; i < 2; ++i) { - ui[i]->effectConfigButton->setIcon(KIcon("view-preview")); - - connect(ui[i]->highlightWindowCheck, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->showTabBox, SIGNAL(clicked(bool)), SLOT(tabBoxToggled(bool))); - connect(ui[i]->effectCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); - connect(ui[i]->effectCombo, SIGNAL(currentIndexChanged(int)), SLOT(effectSelectionChanged(int))); - connect(ui[i]->effectConfigButton, SIGNAL(clicked(bool)), SLOT(configureEffectClicked())); - - connect(ui[i]->switchingModeCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); - connect(ui[i]->showDesktop, SIGNAL(clicked(bool)), SLOT(changed())); - - connect(ui[i]->filterDesktops, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->currentDesktop, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->otherDesktops, SIGNAL(clicked(bool)), SLOT(changed())); - - connect(ui[i]->filterScreens, SIGNAL(clicked(bool)), SLOT(changed())); - if (QApplication::desktop()->screenCount() < 2) { - ui[i]->filterScreens->hide(); - ui[i]->screenFilter->hide(); - } else { - connect(ui[i]->currentScreen, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->otherScreens, SIGNAL(clicked(bool)), SLOT(changed())); - } - - connect(ui[i]->oneAppWindow, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->filterMinimization, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->visibleWindows, SIGNAL(clicked(bool)), SLOT(changed())); - connect(ui[i]->hiddenWindows, SIGNAL(clicked(bool)), SLOT(changed())); - } - - // check focus policy - we don't offer configs for unreasonable focus policies - KConfigGroup config(m_config, "Windows"); - QString policy = config.readEntry("FocusPolicy", "ClickToFocus"); - if ((policy == "FocusUnderMouse") || (policy == "FocusStrictlyUnderMouse")) { - tabWidget->setEnabled(false); - infoLabel->show(); - } else - infoLabel->hide(); -} - -KWinTabBoxConfig::~KWinTabBoxConfig() -{ -} - -void KWinTabBoxConfig::initLayoutLists() -{ - // search the effect names - // TODO: way to recognize if a effect is not found - KServiceTypeTrader* trader = KServiceTypeTrader::self(); - - KService::List offers = trader->query("KWin/WindowSwitcher"); - QStringList layoutNames, layoutPlugins, layoutPaths; - foreach (const KService::Ptr service, offers) { - const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString(); - if (service->property("X-Plasma-API").toString() != "declarativeappletscript") { - continue; - } - if (service->property("X-KWin-Exclude-Listing").toBool()) { - continue; - } - const QString scriptName = service->property("X-Plasma-MainScript").toString(); - const QString scriptFile = KStandardDirs::locate("data", "kwin/tabbox/" + pluginName + "/contents/" + scriptName); - if (scriptFile.isNull()) { - continue; - } - - layoutNames << service->name(); - layoutPlugins << pluginName; - layoutPaths << scriptFile; - } - - KWinTabBoxConfigForm *ui[2] = { m_primaryTabBoxUi, m_alternativeTabBoxUi }; - for (int i=0; i<2; ++i) { - int index = ui[i]->effectCombo->currentIndex(); - QVariant data = ui[i]->effectCombo->itemData(index); - ui[i]->effectCombo->clear(); - for (int j = 0; j < layoutNames.count(); ++j) { - ui[i]->effectCombo->addItem(layoutNames[j], layoutPlugins[j]); - ui[i]->effectCombo->setItemData(ui[i]->effectCombo->count() - 1, layoutPaths[j], Qt::UserRole+1); - } - if (data.isValid()) { - ui[i]->effectCombo->setCurrentIndex(ui[i]->effectCombo->findData(data)); - } else if (index != -1) { - ui[i]->effectCombo->setCurrentIndex(index); - } - } -} - -void KWinTabBoxConfig::load() -{ - KCModule::load(); - - const QString group[2] = { "TabBox", "TabBoxAlternative" }; - KWinTabBoxConfigForm* ui[2] = { m_primaryTabBoxUi, m_alternativeTabBoxUi }; - TabBoxConfig *tabBoxConfig[2] = { &m_tabBoxConfig, &m_tabBoxAlternativeConfig }; - - for (int i = 0; i < 2; ++i) { - KConfigGroup config(m_config, group[i]); - loadConfig(config, *(tabBoxConfig[i])); - - updateUiFromConfig(ui[i], *(tabBoxConfig[i])); - - QString action; -#define LOAD_SHORTCUT(_BTN_)\ - action = ui[i]->_BTN_->property("shortcutAction").toString();\ - qDebug() << "load shortcut for " << action;\ - if (KAction *a = qobject_cast(m_actionCollection->action(action)))\ - ui[i]->_BTN_->setKeySequence(a->globalShortcut().primary()) - LOAD_SHORTCUT(scAll); - LOAD_SHORTCUT(scAllReverse); - LOAD_SHORTCUT(scCurrent); - LOAD_SHORTCUT(scCurrentReverse); -#undef LOAD_SHORTCUT - } - emit changed(false); -} - -void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig) -{ - tabBoxConfig.setClientDesktopMode(TabBoxConfig::ClientDesktopMode( - config.readEntry("DesktopMode", TabBoxConfig::defaultDesktopMode()))); - tabBoxConfig.setClientApplicationsMode(TabBoxConfig::ClientApplicationsMode( - config.readEntry("ApplicationsMode", TabBoxConfig::defaultApplicationsMode()))); - tabBoxConfig.setClientMinimizedMode(TabBoxConfig::ClientMinimizedMode( - config.readEntry("MinimizedMode", TabBoxConfig::defaultMinimizedMode()))); - tabBoxConfig.setShowDesktopMode(TabBoxConfig::ShowDesktopMode( - config.readEntry("ShowDesktopMode", TabBoxConfig::defaultShowDesktopMode()))); - tabBoxConfig.setClientMultiScreenMode(TabBoxConfig::ClientMultiScreenMode( - config.readEntry("MultiScreenMode", TabBoxConfig::defaultMultiScreenMode()))); - tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode( - config.readEntry("SwitchingMode", TabBoxConfig::defaultSwitchingMode()))); - - tabBoxConfig.setShowTabBox(config.readEntry("ShowTabBox", TabBoxConfig::defaultShowTabBox())); - tabBoxConfig.setHighlightWindows(config.readEntry("HighlightWindows", TabBoxConfig::defaultHighlightWindow())); - - tabBoxConfig.setLayoutName(config.readEntry("LayoutName", TabBoxConfig::defaultLayoutName())); -} - -void KWinTabBoxConfig::saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig) -{ - // combo boxes - config.writeEntry("DesktopMode", int(tabBoxConfig.clientDesktopMode())); - config.writeEntry("ApplicationsMode", int(tabBoxConfig.clientApplicationsMode())); - config.writeEntry("MinimizedMode", int(tabBoxConfig.clientMinimizedMode())); - config.writeEntry("ShowDesktopMode", int(tabBoxConfig.showDesktopMode())); - config.writeEntry("MultiScreenMode", int(tabBoxConfig.clientMultiScreenMode())); - config.writeEntry("SwitchingMode", int(tabBoxConfig.clientSwitchingMode())); - config.writeEntry("LayoutName", tabBoxConfig.layoutName()); - - // check boxes - config.writeEntry("ShowTabBox", tabBoxConfig.isShowTabBox()); - config.writeEntry("HighlightWindows", tabBoxConfig.isHighlightWindows()); - - config.sync(); -} - -void KWinTabBoxConfig::save() -{ - KCModule::save(); - KConfigGroup config(m_config, "TabBox"); - - // sync ui to config - updateConfigFromUi(m_primaryTabBoxUi, m_tabBoxConfig); - updateConfigFromUi(m_alternativeTabBoxUi, m_tabBoxAlternativeConfig); - saveConfig(config, m_tabBoxConfig); - config = KConfigGroup(m_config, "TabBoxAlternative"); - saveConfig(config, m_tabBoxAlternativeConfig); - - // effects - bool highlightWindows = m_primaryTabBoxUi->highlightWindowCheck->isChecked() || - m_alternativeTabBoxUi->highlightWindowCheck->isChecked(); - - // activate effects if not active - KConfigGroup effectconfig(m_config, "Plugins"); - if (highlightWindows) - effectconfig.writeEntry("kwin4_effect_highlightwindowEnabled", true); - effectconfig.sync(); - - // Reload KWin. - QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); - QDBusConnection::sessionBus().send(message); - - emit changed(false); -} - -void KWinTabBoxConfig::defaults() -{ - const KWinTabBoxConfigForm* ui[2] = { m_primaryTabBoxUi, m_alternativeTabBoxUi}; - for (int i = 0; i < 2; ++i) { - // combo boxes -#define CONFIGURE(SETTING, MODE, IS, VALUE) \ - ui[i]->SETTING->setChecked(TabBoxConfig::default##MODE##Mode() IS TabBoxConfig::VALUE) - CONFIGURE(filterDesktops, Desktop, !=, AllDesktopsClients); - CONFIGURE(currentDesktop, Desktop, ==, OnlyCurrentDesktopClients); - CONFIGURE(otherDesktops, Desktop, ==, ExcludeCurrentDesktopClients); - CONFIGURE(filterScreens, MultiScreen, !=, IgnoreMultiScreen); - CONFIGURE(currentScreen, MultiScreen, ==, OnlyCurrentScreenClients); - CONFIGURE(otherScreens, MultiScreen, ==, ExcludeCurrentScreenClients); - CONFIGURE(oneAppWindow, Applications, ==, OneWindowPerApplication); - CONFIGURE(filterMinimization, Minimized, !=, IgnoreMinimizedStatus); - CONFIGURE(visibleWindows, Minimized, ==, ExcludeMinimizedClients); - CONFIGURE(hiddenWindows, Minimized, ==, OnlyMinimizedClients); - - ui[i]->switchingModeCombo->setCurrentIndex(TabBoxConfig::defaultSwitchingMode()); - - // checkboxes - ui[i]->showTabBox->setChecked(TabBoxConfig::defaultShowTabBox()); - ui[i]->highlightWindowCheck->setChecked(TabBoxConfig::defaultHighlightWindow()); - CONFIGURE(showDesktop, ShowDesktop, ==, ShowDesktopClient); -#undef CONFIGURE - // effects - ui[i]->effectCombo->setCurrentIndex(ui[i]->effectCombo->findData("thumbnails")); - } - - QString action; -#define RESET_SHORTCUT(_BTN_, _CUT_) \ - action = _BTN_->property("shortcutAction").toString(); \ - if (KAction *a = qobject_cast(m_actionCollection->action(action))) \ - a->setGlobalShortcut(KShortcut(_CUT_), KAction::ActiveShortcut, KAction::NoAutoloading) - RESET_SHORTCUT(m_primaryTabBoxUi->scAll, Qt::ALT + Qt::Key_Tab); - RESET_SHORTCUT(m_primaryTabBoxUi->scAllReverse, Qt::ALT + Qt::SHIFT + Qt::Key_Backtab); - RESET_SHORTCUT(m_alternativeTabBoxUi->scAll, ); - RESET_SHORTCUT(m_alternativeTabBoxUi->scAllReverse, ); - RESET_SHORTCUT(m_primaryTabBoxUi->scCurrent, Qt::ALT + Qt::Key_QuoteLeft); - RESET_SHORTCUT(m_primaryTabBoxUi->scCurrentReverse, Qt::ALT + Qt::Key_AsciiTilde); - RESET_SHORTCUT(m_alternativeTabBoxUi->scCurrent, ); - RESET_SHORTCUT(m_alternativeTabBoxUi->scCurrentReverse, ); - m_actionCollection->writeSettings(); -#undef RESET_SHORTCUT - emit changed(true); -} - -bool KWinTabBoxConfig::effectEnabled(const QString& effect, const KConfigGroup& cfg) const -{ - KService::List services = KServiceTypeTrader::self()->query( - "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + '\''); - if (services.isEmpty()) - return false; - QVariant v = services.first()->property("X-KDE-PluginInfo-EnabledByDefault"); - return cfg.readEntry("kwin4_effect_" + effect + "Enabled", v.toBool()); -} - -void KWinTabBoxConfig::updateUiFromConfig(KWinTabBoxConfigForm* ui, const KWin::TabBox::TabBoxConfig& config) -{ -#define CONFIGURE(SETTING, MODE, IS, VALUE) ui->SETTING->setChecked(config.MODE##Mode() IS TabBoxConfig::VALUE) - CONFIGURE(filterDesktops, clientDesktop, !=, AllDesktopsClients); - CONFIGURE(currentDesktop, clientDesktop, ==, OnlyCurrentDesktopClients); - CONFIGURE(otherDesktops, clientDesktop, ==, ExcludeCurrentDesktopClients); - CONFIGURE(filterScreens, clientMultiScreen, !=, IgnoreMultiScreen); - CONFIGURE(currentScreen, clientMultiScreen, ==, OnlyCurrentScreenClients); - CONFIGURE(otherScreens, clientMultiScreen, ==, ExcludeCurrentScreenClients); - CONFIGURE(oneAppWindow, clientApplications, ==, OneWindowPerApplication); - CONFIGURE(filterMinimization, clientMinimized, !=, IgnoreMinimizedStatus); - CONFIGURE(visibleWindows, clientMinimized, ==, ExcludeMinimizedClients); - CONFIGURE(hiddenWindows, clientMinimized, ==, OnlyMinimizedClients); - - ui->switchingModeCombo->setCurrentIndex(config.clientSwitchingMode()); - - // check boxes - ui->showTabBox->setChecked(config.isShowTabBox()); - ui->highlightWindowCheck->setChecked(config.isHighlightWindows()); - ui->effectCombo->setCurrentIndex(ui->effectCombo->findData(config.layoutName())); - CONFIGURE(showDesktop, showDesktop, ==, ShowDesktopClient); -#undef CONFIGURE -} - -void KWinTabBoxConfig::updateConfigFromUi(const KWin::KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config) -{ - if (ui->filterDesktops->isChecked()) - config.setClientDesktopMode(ui->currentDesktop->isChecked() ? TabBoxConfig::OnlyCurrentDesktopClients : TabBoxConfig::ExcludeCurrentDesktopClients); - else - config.setClientDesktopMode(TabBoxConfig::AllDesktopsClients); - if (ui->filterScreens->isChecked()) - config.setClientMultiScreenMode(ui->currentScreen->isChecked() ? TabBoxConfig::OnlyCurrentScreenClients : TabBoxConfig::ExcludeCurrentScreenClients); - else - config.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); - config.setClientApplicationsMode(ui->oneAppWindow->isChecked() ? TabBoxConfig::OneWindowPerApplication : TabBoxConfig::AllWindowsAllApplications); - if (ui->filterMinimization->isChecked()) - config.setClientMinimizedMode(ui->visibleWindows->isChecked() ? TabBoxConfig::ExcludeMinimizedClients : TabBoxConfig::OnlyMinimizedClients); - else - config.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus); - - config.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode(ui->switchingModeCombo->currentIndex())); - - config.setShowTabBox(ui->showTabBox->isChecked()); - config.setHighlightWindows(ui->highlightWindowCheck->isChecked()); - config.setLayoutName(ui->effectCombo->itemData(ui->effectCombo->currentIndex()).toString()); - config.setShowDesktopMode(ui->showDesktop->isChecked() ? TabBoxConfig::ShowDesktopClient : TabBoxConfig::DoNotShowDesktopClient); -} - -#define CHECK_CURRENT_TABBOX_UI \ - Q_ASSERT(sender());\ - KWinTabBoxConfigForm *ui = 0;\ - QObject *dad = sender();\ - while (!ui && (dad = dad->parent()))\ - ui = qobject_cast(dad);\ - Q_ASSERT(ui); - -void KWinTabBoxConfig::effectSelectionChanged(int index) -{ - CHECK_CURRENT_TABBOX_UI - ui->effectConfigButton->setIcon(KIcon("view-preview")); - if (!ui->showTabBox->isChecked()) - return; - ui->highlightWindowCheck->setEnabled(index); - if (m_layoutPreview && m_layoutPreview->isVisible()) { - m_layoutPreview->setLayout(ui->effectCombo->itemData(index, Qt::UserRole+1).toString(), ui->effectCombo->itemText(index)); - } -} - -void KWinTabBoxConfig::tabBoxToggled(bool on) { - CHECK_CURRENT_TABBOX_UI - on = !on || ui->effectCombo->currentIndex() >= 0; - ui->highlightWindowCheck->setEnabled(on); - emit changed(); -} - -void KWinTabBoxConfig::configureEffectClicked() -{ - CHECK_CURRENT_TABBOX_UI - - const int effect = ui->effectCombo->currentIndex(); - if (!m_layoutPreview) { - m_layoutPreview = new LayoutPreview(this); - m_layoutPreview->setWindowTitle(i18n("Tabbox layout preview")); - m_layoutPreview->setWindowFlags(Qt::Dialog); - } - m_layoutPreview->setLayout(ui->effectCombo->itemData(effect, Qt::UserRole+1).toString(), ui->effectCombo->itemText(effect)); - m_layoutPreview->show(); -} - -void KWinTabBoxConfig::shortcutChanged(const QKeySequence &seq) -{ - QString action; - if (sender()) - action = sender()->property("shortcutAction").toString(); - if (action.isEmpty()) - return; - if (KAction *a = qobject_cast(m_actionCollection->action(action))) - a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut, KAction::NoAutoloading); - m_actionCollection->writeSettings(); -} - -} // namespace diff --git a/kwin/kcmkwin/kwintabbox/main.h b/kwin/kcmkwin/kwintabbox/main.h deleted file mode 100644 index 85b439aa..00000000 --- a/kwin/kcmkwin/kwintabbox/main.h +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef __MAIN_H__ -#define __MAIN_H__ - -#include -#include -#include "tabboxconfig.h" - -#include "ui_main.h" - -class KShortcutsEditor; -class KActionCollection; - -namespace KWin -{ -namespace TabBox -{ - -class LayoutPreview; -} - - - -class KWinTabBoxConfigForm : public QWidget, public Ui::KWinTabBoxConfigForm -{ - Q_OBJECT - -public: - explicit KWinTabBoxConfigForm(QWidget* parent); -}; - -class KWinTabBoxConfig : public KCModule -{ - Q_OBJECT - -public: - explicit KWinTabBoxConfig(QWidget* parent, const QVariantList& args); - ~KWinTabBoxConfig(); - -public slots: - virtual void save(); - virtual void load(); - virtual void defaults(); - -private slots: - void effectSelectionChanged(int index); - void configureEffectClicked(); - void tabBoxToggled(bool on); - void shortcutChanged(const QKeySequence &seq); -private: - void updateUiFromConfig(KWinTabBoxConfigForm* ui, const TabBox::TabBoxConfig& config); - void updateConfigFromUi(const KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config); - void loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig); - void saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig); - void initLayoutLists(); - -private: - KWinTabBoxConfigForm* m_primaryTabBoxUi; - KWinTabBoxConfigForm* m_alternativeTabBoxUi; - KSharedConfigPtr m_config; - KActionCollection* m_actionCollection; - KShortcutsEditor* m_editor; - TabBox::TabBoxConfig m_tabBoxConfig; - TabBox::TabBoxConfig m_tabBoxAlternativeConfig; - TabBox::LayoutPreview *m_layoutPreview; - - bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const; -}; - -} // namespace - -#endif diff --git a/kwin/kcmkwin/kwintabbox/main.ui b/kwin/kcmkwin/kwintabbox/main.ui deleted file mode 100644 index 4e0f3a4a..00000000 --- a/kwin/kcmkwin/kwintabbox/main.ui +++ /dev/null @@ -1,628 +0,0 @@ - - - KWinTabBoxConfigForm - - - - 0 - 0 - 630 - 351 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Content - - - true - - - - - - Include "Show Desktop" icon - - - - - - - - 0 - 0 - - - - - Recently used - - - - - Stacking order - - - - - - - - Only one window per application - - - false - - - - - - - Sort order: - - - switchingModeCombo - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Filter windows by - - - true - - - - - - Virtual desktops - - - false - - - - - - - false - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Current desktop - - - - - - - All other desktops - - - - - - - - - - false - - - - 0 - - - - - - - - Screens - - - false - - - - - - - false - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Current screen - - - - - - - All other screens - - - - - - - - - - Minimization - - - false - - - - - - - false - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 24 - 20 - - - - - - - - Visible windows - - - - - - - Hidden windows - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Shortcuts - - - true - - - - - - Forward - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - - - - - 75 - true - - - - All windows - - - Qt::AlignCenter - - - - - - - Reverse - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Forward - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Reverse - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - KKeySequenceWidget::GlobalShortcuts - - - - - - - KKeySequenceWidget::GlobalShortcuts - - - - - - - - 75 - true - - - - Current application - - - Qt::AlignCenter - - - - - - - KKeySequenceWidget::GlobalShortcuts - - - - - - - KKeySequenceWidget::GlobalShortcuts - - - - - - - - - - Visualization - - - true - - - - - - - 0 - - - - - - 0 - 0 - - - - The effect to replace the list window when desktop effects are active. - - - - - - - - 0 - 0 - - - - - - - - - - - - - - true - - - - - - - The currently selected window will be highlighted by fading out all other windows. This option requires desktop effects to be active. - - - Show selected window - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Vertical - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - KKeySequenceWidget - QWidget -
kkeysequencewidget.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
- - KPushButton - QPushButton -
kpushbutton.h
-
-
- - highlightWindowCheck - showTabBox - effectCombo - effectConfigButton - switchingModeCombo - showDesktop - oneAppWindow - filterDesktops - currentDesktop - otherDesktops - filterScreens - currentScreen - otherScreens - filterMinimization - visibleWindows - hiddenWindows - - - - filterDesktops - toggled(bool) - desktopFilter - setEnabled(bool) - - - 541 - 172 - - - 701 - 197 - - - - - filterScreens - toggled(bool) - screenFilter - setEnabled(bool) - - - 555 - 272 - - - 701 - 297 - - - - - filterMinimization - toggled(bool) - minimizationFilter - setEnabled(bool) - - - 558 - 322 - - - 701 - 347 - - - - - showTabBox - toggled(bool) - widget_6 - setEnabled(bool) - - - 164 - 125 - - - 230 - 108 - - - - -
diff --git a/kwin/kcmkwin/kwintabbox/qml/main.qml b/kwin/kcmkwin/kwintabbox/qml/main.qml deleted file mode 100644 index 300474b7..00000000 --- a/kwin/kcmkwin/kwintabbox/qml/main.qml +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 - -Item { - id : preview - Loader { - property int screenWidth : preview.width - property int screenHeight : preview.height - property bool allDesktops: true - width: preview.width - height: preview.height - textElement.height - source: sourcePath - anchors.centerIn: parent - onLoaded: { - if (item.allDesktops != undefined) { - item.allDesktops = allDesktops; - } - if (item.setModel) { - item.setModel(clientModel); - } - if (item.screenWidth != undefined) { - item.screenWidth = screenWidth; - } - if (item.screenHeight != undefined) { - item.screenHeight = screenHeight; - } - item.width = preview.width; - item.height = preview.height - textElement.height; - } - } - Text { - id: textElement - font.bold: true - text: name - anchors { - horizontalCenter: parent.horizontalCenter - bottom: parent.bottom - } - visible: true - } -} diff --git a/kwin/kcmkwin/kwintabbox/thumbnailitem.cpp b/kwin/kcmkwin/kwintabbox/thumbnailitem.cpp deleted file mode 100644 index 525289a0..00000000 --- a/kwin/kcmkwin/kwintabbox/thumbnailitem.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ - -#include "thumbnailitem.h" -// Qt -#include -#include -#include -// KDE -#include -#include - -namespace KWin -{ -WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent) - : QDeclarativeItem(parent) - , m_wId(0) - , m_image() -{ - setFlags(flags() & ~QGraphicsItem::ItemHasNoContents); -} - -WindowThumbnailItem::~WindowThumbnailItem() -{ -} - -void WindowThumbnailItem::setWId(qulonglong wId) -{ - m_wId = wId; - emit wIdChanged(wId); - findImage(); -} - -void WindowThumbnailItem::findImage() -{ - QString imagePath; - switch (m_wId) { - case Konsole: - imagePath = KStandardDirs::locate("data", "kwin/kcm_kwintabbox/konsole.png"); - break; - case Systemsettings: - imagePath = KStandardDirs::locate("data", "kwin/kcm_kwintabbox/systemsettings.png"); - break; - case KMail: - imagePath = KStandardDirs::locate("data", "kwin/kcm_kwintabbox/kmail.png"); - break; - case Dolphin: - imagePath = KStandardDirs::locate("data", "kwin/kcm_kwintabbox/dolphin.png"); - break; - default: - // ignore - break; - } - if (imagePath.isNull()) { - m_image = QImage(); - } else { - m_image = QImage(imagePath); - } -} - -void WindowThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - if (m_image.isNull()) { - // no image: default behavior - QDeclarativeItem::paint(painter, option, widget); - } - QSizeF difference(boundingRect().width() - m_image.width(), boundingRect().height() - m_image.height()); - const QRectF drawRect(boundingRect().x() + difference.width()/2.0, boundingRect().y(), m_image.width(), m_image.height()); - painter->drawImage(drawRect, m_image); -} - -} // namespace KWin diff --git a/kwin/kcmkwin/kwintabbox/thumbnailitem.h b/kwin/kcmkwin/kwintabbox/thumbnailitem.h deleted file mode 100644 index b06eb781..00000000 --- a/kwin/kcmkwin/kwintabbox/thumbnailitem.h +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef KWIN_THUMBNAILITEM_H -#define KWIN_THUMBNAILITEM_H - -#include - -namespace KWin -{ - -class WindowThumbnailItem : public QDeclarativeItem -{ - Q_OBJECT - Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) -public: - explicit WindowThumbnailItem(QDeclarativeItem *parent = 0); - virtual ~WindowThumbnailItem(); - - qulonglong wId() const { - return m_wId; - } - void setWId(qulonglong wId); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - enum Thumbnail { - Konsole = 1, - KMail, - Systemsettings, - Dolphin - }; -Q_SIGNALS: - void wIdChanged(qulonglong wid); -private: - void findImage(); - qulonglong m_wId; - QImage m_image; -}; - -} // KWin - -#endif // KWIN_THUMBNAILITEM_H diff --git a/kwin/kcmkwin/kwintabbox/thumbnails/dolphin.png b/kwin/kcmkwin/kwintabbox/thumbnails/dolphin.png deleted file mode 100644 index 403c3760..00000000 Binary files a/kwin/kcmkwin/kwintabbox/thumbnails/dolphin.png and /dev/null differ diff --git a/kwin/kcmkwin/kwintabbox/thumbnails/kmail.png b/kwin/kcmkwin/kwintabbox/thumbnails/kmail.png deleted file mode 100644 index 32852df9..00000000 Binary files a/kwin/kcmkwin/kwintabbox/thumbnails/kmail.png and /dev/null differ diff --git a/kwin/kcmkwin/kwintabbox/thumbnails/konsole.png b/kwin/kcmkwin/kwintabbox/thumbnails/konsole.png deleted file mode 100644 index f4794fad..00000000 Binary files a/kwin/kcmkwin/kwintabbox/thumbnails/konsole.png and /dev/null differ diff --git a/kwin/kcmkwin/kwintabbox/thumbnails/systemsettings.png b/kwin/kcmkwin/kwintabbox/thumbnails/systemsettings.png deleted file mode 100644 index a691b4e0..00000000 Binary files a/kwin/kcmkwin/kwintabbox/thumbnails/systemsettings.png and /dev/null differ diff --git a/kwin/kwin.kcfg b/kwin/kwin.kcfg index 1f2cae44..044acc0e 100644 --- a/kwin/kwin.kcfg +++ b/kwin/kwin.kcfg @@ -252,42 +252,4 @@ 6
- - - true - - - 90 - - - 1 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - true - - - true - - - true - - - thumbnails - - diff --git a/kwin/layers.cpp b/kwin/layers.cpp index fb4f30b4..77bc0f83 100644 --- a/kwin/layers.cpp +++ b/kwin/layers.cpp @@ -80,7 +80,6 @@ along with this program. If not, see . #include "focuschain.h" #include "netinfo.h" #include "workspace.h" -#include "tabbox.h" #include "group.h" #include "rules.h" #include "screens.h" diff --git a/kwin/libkwineffects/kwineffects.h b/kwin/libkwineffects/kwineffects.h index 3aaaeb23..18d8f2d2 100644 --- a/kwin/libkwineffects/kwineffects.h +++ b/kwin/libkwineffects/kwineffects.h @@ -718,16 +718,6 @@ public: // window will be temporarily painted as if being at the top of the stack virtual void setElevatedWindow(EffectWindow* w, bool set) = 0; - virtual void setTabBoxWindow(EffectWindow*) = 0; - virtual void setTabBoxDesktop(int) = 0; - virtual EffectWindowList currentTabBoxWindowList() const = 0; - virtual void refTabBox() = 0; - virtual void unrefTabBox() = 0; - virtual void closeTabBox() = 0; - virtual QList< int > currentTabBoxDesktopList() const = 0; - virtual int currentTabBoxDesktop() const = 0; - virtual EffectWindow* currentTabBoxWindow() const = 0; - virtual void setActiveFullScreenEffect(Effect* e) = 0; virtual Effect* activeFullScreenEffect() const = 0; @@ -1005,48 +995,6 @@ Q_SIGNALS: * @since 4.7 **/ void windowDamaged(KWin::EffectWindow *w, const QRect &r); - /** - * Signal emitted when a tabbox is added. - * An effect who wants to replace the tabbox with itself should use @link refTabBox. - * @param mode The TabBoxMode. - * @see refTabBox - * @see tabBoxClosed - * @see tabBoxUpdated - * @see tabBoxKeyEvent - * @since 4.7 - **/ - void tabBoxAdded(int mode); - /** - * Signal emitted when the TabBox was closed by KWin core. - * An effect which referenced the TabBox should use @link unrefTabBox to unref again. - * @see unrefTabBox - * @see tabBoxAdded - * @since 4.7 - **/ - void tabBoxClosed(); - /** - * Signal emitted when the selected TabBox window changed or the TabBox List changed. - * An effect should only response to this signal if it referenced the TabBox with @link refTabBox. - * @see refTabBox - * @see currentTabBoxWindowList - * @see currentTabBoxDesktopList - * @see currentTabBoxWindow - * @see currentTabBoxDesktop - * @since 4.7 - **/ - void tabBoxUpdated(); - /** - * Signal emitted when a key event, which is not handled by TabBox directly is, happens while - * TabBox is active. An effect might use the key event to e.g. change the selected window. - * An effect should only response to this signal if it referenced the TabBox with @link refTabBox. - * @param event The key event not handled by TabBox directly - * @see refTabBox - * @since 4.7 - **/ - void tabBoxKeyEvent(QKeyEvent* event); - void currentTabAboutToChange(KWin::EffectWindow* from, KWin::EffectWindow* to); - void tabAdded(KWin::EffectWindow* from, KWin::EffectWindow* to); // from merged with to - void tabRemoved(KWin::EffectWindow* c, KWin::EffectWindow* group); // c removed from group /** * Signal emitted when mouse changed. * If an effect needs to get updated mouse positions, it needs to first call @link startMousePolling. diff --git a/kwin/libkwineffects/kwinglobals.h b/kwin/libkwineffects/kwinglobals.h index 85f518c6..3ffb9e7d 100644 --- a/kwin/libkwineffects/kwinglobals.h +++ b/kwin/libkwineffects/kwinglobals.h @@ -77,18 +77,6 @@ enum ElectricBorderAction { ELECTRIC_ACTION_COUNT = 3 }; -// DesktopMode and WindowsMode are based on the order in which the desktop -// or window were viewed. -// DesktopListMode lists them in the order created. -enum TabBoxMode { - TabBoxDesktopMode, // Focus chain of desktops - TabBoxDesktopListMode, // Static desktop order - TabBoxWindowsMode, // Primary window switching mode - TabBoxWindowsAlternativeMode, // Secondary window switching mode - TabBoxCurrentAppWindowsMode, // Same as primary window switching mode but only for windows of current application - TabBoxCurrentAppWindowsAlternativeMode // Same as secondary switching mode but only for windows of current application -}; - enum KWinOption { CloseButtonCorner, SwitchDesktopOnScreenEdge, diff --git a/kwin/manage.cpp b/kwin/manage.cpp index a75398c2..46cb2337 100644 --- a/kwin/manage.cpp +++ b/kwin/manage.cpp @@ -133,7 +133,6 @@ bool Client::manage(xcb_window_t w, bool isMapped) original_skip_taskbar = skip_taskbar = (info->state() & NET::SkipTaskbar) != 0; skip_pager = (info->state() & NET::SkipPager) != 0; - updateFirstInTabBox(); setupCompositing(); diff --git a/kwin/scene.cpp b/kwin/scene.cpp index f4705c4c..5334ab18 100644 --- a/kwin/scene.cpp +++ b/kwin/scene.cpp @@ -80,8 +80,6 @@ along with this program. If not, see . #include "effects.h" #include "overlaywindow.h" #include "shadow.h" - -#include "thumbnailitem.h" #include "workspace.h" namespace KWin @@ -410,163 +408,6 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad WindowPaintData data(w->window()->effectWindow()); data.quads = quads; effects->paintWindow(effectWindow(w), mask, region, data); - // paint thumbnails on top of window - paintWindowThumbnails(w, region, data.opacity(), data.brightness(), data.saturation()); - // and desktop thumbnails - paintDesktopThumbnails(w); -} - -void Scene::paintWindowThumbnails(Scene::Window *w, QRegion region, qreal opacity, qreal brightness, qreal saturation) -{ - EffectWindowImpl *wImpl = static_cast(effectWindow(w)); - for (QHash >::const_iterator it = wImpl->thumbnails().constBegin(); - it != wImpl->thumbnails().constEnd(); - ++it) { - if (it.value().isNull()) { - continue; - } - WindowThumbnailItem *item = it.key(); - if (!item->isVisible()) { - continue; - } - EffectWindowImpl *thumb = it.value().data(); - WindowPaintData thumbData(thumb); - thumbData.setOpacity(opacity); - thumbData.setBrightness(brightness * item->brightness()); - thumbData.setSaturation(saturation * item->saturation()); - - const QRect visualThumbRect(thumb->expandedGeometry()); - - QSizeF size = QSizeF(visualThumbRect.size()); - size.scale(QSizeF(item->width(), item->height()), Qt::KeepAspectRatio); - if (size.width() > visualThumbRect.width() || size.height() > visualThumbRect.height()) { - size = QSizeF(visualThumbRect.size()); - } - thumbData.setXScale(size.width() / static_cast(visualThumbRect.width())); - thumbData.setYScale(size.height() / static_cast(visualThumbRect.height())); - // it can happen in the init/closing phase of the tabbox - // that the corresponding QGraphicsScene is not available - if (item->scene() == 0) { - continue; - } - - QGraphicsView* declview = findViewForThumbnailItem(item, w); - if (declview == 0) { - continue; - } - QPoint viewPos = findOffsetInWindow(declview, w->window()->window()); - const QPoint point = viewPos + declview->mapFromScene(item->scenePos()); - qreal x = point.x() + w->x() + (item->width() - size.width())/2; - qreal y = point.y() + w->y() + (item->height() - size.height()) / 2; - x -= thumb->x(); - y -= thumb->y(); - // compensate shadow topleft padding - x += (thumb->x()-visualThumbRect.x())*thumbData.xScale(); - y += (thumb->y()-visualThumbRect.y())*thumbData.yScale(); - thumbData.setXTranslation(x); - thumbData.setYTranslation(y); - int thumbMask = PAINT_WINDOW_TRANSFORMED; - if (thumbData.opacity() == 1.0) { - thumbMask |= PAINT_WINDOW_OPAQUE; - } else { - thumbMask |= PAINT_WINDOW_TRANSLUCENT; - } - QRegion clippingRegion = region; - clippingRegion &= QRegion(wImpl->x(), wImpl->y(), wImpl->width(), wImpl->height()); - QPainterPath path = item->clipPath(); - if (!path.isEmpty()) { - // here we assume that the clippath consists of a single rectangle - const QPolygonF sceneBounds = item->mapToScene(path.boundingRect()); - const QRect viewBounds = declview->mapFromScene(sceneBounds).boundingRect(); - // shrinking the rect due to rounding errors - clippingRegion &= viewBounds.adjusted(0,0,-1,-1).translated(viewPos + w->pos()); - } - effects->drawWindow(thumb, thumbMask, clippingRegion, thumbData); - } -} - -void Scene::paintDesktopThumbnails(Scene::Window *w) -{ - EffectWindowImpl *wImpl = static_cast(effectWindow(w)); - for (QList::const_iterator it = wImpl->desktopThumbnails().constBegin(); - it != wImpl->desktopThumbnails().constEnd(); - ++it) { - DesktopThumbnailItem *item = *it; - if (!item->isVisible()) { - continue; - } - // it can happen in the init/closing phase of the tabbox - // that the corresponding QGraphicsScene is not available - if (item->scene() == 0) { - continue; - } - QGraphicsView* declview = findViewForThumbnailItem(item, w); - if (declview == 0) { - continue; - } - QPoint viewPos = findOffsetInWindow(declview, w->window()->window()); - s_recursionCheck = w; - - ScreenPaintData data; - QSize size = QSize(displayWidth(), displayHeight()); - - size.scale(item->width(), item->height(), Qt::KeepAspectRatio); - data *= QVector2D(size.width() / double(displayWidth()), - size.height() / double(displayHeight())); - const QPoint point = viewPos + declview->mapFromScene(item->scenePos()); - const qreal x = point.x() + w->x() + (item->width() - size.width())/2; - const qreal y = point.y() + w->y() + (item->height() - size.height()) / 2; - const QRect region = QRect(x, y, item->width(), item->height()); - QRegion clippingRegion = region; - clippingRegion &= QRegion(wImpl->x(), wImpl->y(), wImpl->width(), wImpl->height()); - QPainterPath path = item->clipPath(); - if (!path.isEmpty()) { - // here we assume that the clippath consists of a single rectangle - const QPolygonF sceneBounds = item->mapToScene(path.boundingRect()); - const QRect viewBounds = declview->mapFromScene(sceneBounds).boundingRect(); - // shrinking the rect due to rounding errors - clippingRegion &= viewBounds.adjusted(0,0,-1,-1).translated(viewPos + w->pos()); - } - data += QPointF(x, y); - const int desktopMask = PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_BACKGROUND_FIRST; - paintDesktop(item->desktop(), desktopMask, clippingRegion, data); - s_recursionCheck = NULL; - } -} - -QGraphicsView *Scene::findViewForThumbnailItem(AbstractThumbnailItem *item, Scene::Window *w) -{ - // in principle there could be more than one QGraphicsView per QGraphicsScene, - // although TabBox does not make use of it so far - QList views = item->scene()->views(); - foreach (QGraphicsView* view, views) { - if (view->winId() == w->window()->window()) { - return view; - } - QWidget *parent = view; - while ((parent = parent->parentWidget())) { - // if the graphicsview is not the topmost widget we try to go up to the - // toplevel widget and check whether that is the window we are looking for. - if (parent->winId() == w->window()->window()) { - return view; - } - } - } - return NULL; -} - -QPoint Scene::findOffsetInWindow(QWidget *view, xcb_window_t idOfTopmostWindow) -{ - if (view->winId() == idOfTopmostWindow) { - return QPoint(); - } - QWidget *parent = view; - while ((parent = parent->parentWidget())) { - if (parent->winId() == idOfTopmostWindow) { - return view->mapTo(parent, QPoint()); - } - } - return QPoint(); } void Scene::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) diff --git a/kwin/scene.h b/kwin/scene.h index aea5b7c9..fded7b63 100644 --- a/kwin/scene.h +++ b/kwin/scene.h @@ -32,7 +32,6 @@ along with this program. If not, see . namespace KWin { -class AbstractThumbnailItem; class Workspace; class Deleted; class EffectFrameImpl; @@ -162,16 +161,6 @@ protected: // time since last repaint int time_diff; QElapsedTimer last_time; -private: - void paintWindowThumbnails(Scene::Window *w, QRegion region, qreal opacity, qreal brightness, qreal saturation); - void paintDesktopThumbnails(Scene::Window *w); - /** - * Helper function to find the GraphicsView the ThumbnailItem @p item is rendered in which - * matches our Window @p w. - * If not found @c NULL is returned. - **/ - QGraphicsView *findViewForThumbnailItem(AbstractThumbnailItem *item, Scene::Window *w); - QPoint findOffsetInWindow(QWidget *view, xcb_window_t idOfTopmostWindow); }; // The base class for windows representations in composite backends diff --git a/kwin/tabbox/CMakeLists.txt b/kwin/tabbox/CMakeLists.txt deleted file mode 100644 index 273ca4cb..00000000 --- a/kwin/tabbox/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_subdirectory( qml ) -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - -# Install the KWin/WindowSwitcher service type -install( FILES kwinwindowswitcher.desktop DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR} ) -install( FILES kwindesktopswitcher.desktop DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR} ) diff --git a/kwin/tabbox/clientmodel.cpp b/kwin/tabbox/clientmodel.cpp deleted file mode 100644 index 043931d7..00000000 --- a/kwin/tabbox/clientmodel.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -// own -#include "clientmodel.h" -// tabbox -#include "tabboxconfig.h" -#include "tabboxhandler.h" -// Qt -// TODO: remove with Qt 5, only for HTML escaping the caption -#include -#include -// other -#include - -namespace KWin -{ -namespace TabBox -{ - -ClientModel::ClientModel(QObject* parent) - : QAbstractItemModel(parent) -{ - QHash roles; - roles[CaptionRole] = "caption"; - roles[DesktopNameRole] = "desktopName"; - roles[MinimizedRole] = "minimized"; - roles[WIdRole] = "windowId"; - roles[CloseableRole] = "closeable"; - setRoleNames(roles); -} - -ClientModel::~ClientModel() -{ -} - -QVariant ClientModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - if (m_clientList.isEmpty()) { - return QVariant(); - } - - int clientIndex = index.row(); - if (clientIndex >= m_clientList.count()) - return QVariant(); - QSharedPointer client = m_clientList[ clientIndex ].toStrongRef(); - if (!client) { - return QVariant(); - } - switch(role) { - case Qt::DisplayRole: - case CaptionRole: { - QString caption = client->caption(); - if (Qt::mightBeRichText(caption)) { - caption = Qt::escape(caption); - } - return caption; - } - case ClientRole: - return qVariantFromValue((void*)client.data()); - case DesktopNameRole: { - return tabBox->desktopName(client.data()); - } - case WIdRole: - return qulonglong(client->window()); - case MinimizedRole: - return client->isMinimized(); - case CloseableRole: - //clients that claim to be first are not closeable - return client->isCloseable() && !client->isFirstInTabBox(); - default: - return QVariant(); - } -} - -QString ClientModel::longestCaption() const -{ - QString caption; - foreach (const QWeakPointer &clientPointer, m_clientList) { - QSharedPointer client = clientPointer.toStrongRef(); - if (!client) { - continue; - } - if (client->caption().size() > caption.size()) { - caption = client->caption(); - } - } - return caption; -} - -int ClientModel::columnCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent) - return 1; -} - -int ClientModel::rowCount(const QModelIndex& parent) const -{ - if (parent.isValid()) { - return 0; - } - return m_clientList.count(); -} - -QModelIndex ClientModel::parent(const QModelIndex& child) const -{ - Q_UNUSED(child) - return QModelIndex(); -} - -QModelIndex ClientModel::index(int row, int column, const QModelIndex& parent) const -{ - if (row < 0 || column != 0 || parent.isValid()) { - return QModelIndex(); - } - int index = row * columnCount(); - if (index >= m_clientList.count() && !m_clientList.isEmpty()) - return QModelIndex(); - return createIndex(row, 0); -} - -QModelIndex ClientModel::index(QWeakPointer client) const -{ - if (!m_clientList.contains(client)) - return QModelIndex(); - int index = m_clientList.indexOf(client); - int row = index / columnCount(); - int column = index % columnCount(); - return createIndex(row, column); -} - -void ClientModel::createClientList(bool partialReset) -{ - createClientList(tabBox->currentDesktop(), partialReset); -} - -void ClientModel::createClientList(int desktop, bool partialReset) -{ - TabBoxClient* start = tabBox->activeClient().toStrongRef().data(); - // TODO: new clients are not added at correct position - if (partialReset && !m_clientList.isEmpty()) { - QSharedPointer firstClient = m_clientList.first().toStrongRef(); - if (firstClient) { - start = firstClient.data(); - } - } - - m_clientList.clear(); - QList< QWeakPointer< TabBoxClient > > stickyClients; - - switch(tabBox->config().clientSwitchingMode()) { - case TabBoxConfig::FocusChainSwitching: { - TabBoxClient* c = start; - if (!tabBox->isInFocusChain(c)) { - QSharedPointer firstClient = tabBox->firstClientFocusChain().toStrongRef(); - if (firstClient) { - c = firstClient.data(); - } - } - TabBoxClient* stop = c; - do { - QWeakPointer add = tabBox->clientToAddToList(c, desktop); - if (!add.isNull()) { - m_clientList += add; - if (add.data()->isFirstInTabBox()) { - stickyClients << add; - } - } - c = tabBox->nextClientFocusChain(c).data(); - } while (c && c != stop); - break; - } - case TabBoxConfig::StackingOrderSwitching: { - // TODO: needs improvement - TabBoxClientList stacking = tabBox->stackingOrder(); - TabBoxClient* c = stacking.first().data(); - TabBoxClient* stop = c; - int index = 0; - while (c) { - QWeakPointer add = tabBox->clientToAddToList(c, desktop); - if (!add.isNull()) { - if (start == add.data()) { - m_clientList.removeAll(add); - m_clientList.prepend(add); - } else - m_clientList += add; - if (add.data()->isFirstInTabBox()) { - stickyClients << add; - } - } - if (index >= stacking.size() - 1) { - c = NULL; - } else { - c = stacking[++index].data(); - } - - if (c == stop) - break; - } - break; - } - } - foreach (const QWeakPointer< TabBoxClient > &c, stickyClients) { - m_clientList.removeAll(c); - m_clientList.prepend(c); - } - if (tabBox->config().showDesktopMode() == TabBoxConfig::ShowDesktopClient || m_clientList.isEmpty()) { - QWeakPointer desktopClient = tabBox->desktopClient(); - if (!desktopClient.isNull()) - m_clientList.append(desktopClient); - } - reset(); -} - -void ClientModel::close(int i) -{ - QModelIndex ind = index(i, 0); - if (!ind.isValid()) { - return; - } - QSharedPointer client = m_clientList.at(i).toStrongRef(); - if (client) { - client->close(); - } -} - -void ClientModel::activate(int i) -{ - QModelIndex ind = index(i, 0); - if (!ind.isValid()) { - return; - } - tabBox->setCurrentIndex(ind); - tabBox->activateAndClose(); -} - -} // namespace Tabbox -} // namespace KWin diff --git a/kwin/tabbox/clientmodel.h b/kwin/tabbox/clientmodel.h deleted file mode 100644 index 6b5d6c8c..00000000 --- a/kwin/tabbox/clientmodel.h +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef CLIENTMODEL_H -#define CLIENTMODEL_H -#include "tabboxhandler.h" - -#include -/** -* @file -* This file defines the class ClientModel, the model for TabBoxClients. -* -* @author Martin Gräßlin -* @since 4.4 -*/ - -namespace KWin -{ -namespace TabBox -{ - - -/** -* The model for TabBoxClients used in TabBox. -* -* @author Martin Gräßlin -* @since 4.4 -*/ -class ClientModel - : public QAbstractItemModel -{ - Q_OBJECT -public: - enum { - ClientRole = Qt::UserRole, ///< The TabBoxClient - CaptionRole = Qt::UserRole + 1, ///< The caption of TabBoxClient - DesktopNameRole = Qt::UserRole + 2, ///< The name of the desktop the TabBoxClient is on - IconRole = Qt::UserRole + 3, // TODO: to be removed - WIdRole = Qt::UserRole + 5, ///< The window ID of TabBoxClient - MinimizedRole = Qt::UserRole + 6, ///< TabBoxClient is minimized - CloseableRole = Qt::UserRole + 7 ///< TabBoxClient can be closed - }; - explicit ClientModel(QObject* parent = 0); - ~ClientModel(); - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex& child) const; - virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; - QString longestCaption() const; - - /** - * @param client The TabBoxClient whose index should be returned - * @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex - * if the model does not contain the given TabBoxClient. - */ - QModelIndex index(QWeakPointer client) const; - - /** - * Generates a new list of TabBoxClients based on the current config. - * Calling this method will reset the model. If partialReset is true - * the top of the list is kept as a starting point. If not the the - * current active client is used as the starting point to generate the - * list. - * @param desktop The desktop for which the list should be created - * @param partialReset Keep the currently selected client or regenerate everything - */ - void createClientList(int desktop, bool partialReset = false); - /** - * This method is provided as a overload for current desktop - * @see createClientList - */ - void createClientList(bool partialReset = false); - /** - * @return Returns the current list of TabBoxClients. - */ - TabBoxClientList clientList() const { - return m_clientList; - } - -public Q_SLOTS: - void close(int index); - /** - * Activates the client at @p index and closes the TabBox. - * @param index The row index - **/ - void activate(int index); - -private: - TabBoxClientList m_clientList; -}; - -} // namespace Tabbox -} // namespace KWin - -#endif // CLIENTMODEL_H diff --git a/kwin/tabbox/declarative.cpp b/kwin/tabbox/declarative.cpp deleted file mode 100644 index 7f0cd90a..00000000 --- a/kwin/tabbox/declarative.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -// own -#include "declarative.h" -#include "tabboxhandler.h" -#include "clientmodel.h" -// Qt -#include -#include -#include -#include -#include -#include -#include - -// include KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// KWin -#include "thumbnailitem.h" -#include -#include "../effects.h" -#include "../client.h" -#include "../workspace.h" - -namespace KWin -{ -namespace TabBox -{ - -ImageProvider::ImageProvider(QAbstractItemModel *model) - : QDeclarativeImageProvider(QDeclarativeImageProvider::Pixmap) - , m_model(model) -{ -} - -QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - bool ok = false; - QStringList parts = id.split('/'); - const int row = parts.first().toInt(&ok); - if (!ok) { - return QPixmap(); - } - QModelIndex parentIndex; - const int parentRow = parts.at(1).toInt(&ok); - if (ok) { - // we have parent index - parentIndex = m_model->index(parentRow, 0); - if (!parentIndex.isValid()) { - return QPixmap(); - } - } - const QModelIndex index = m_model->index(row, 0, parentIndex); - if (!index.isValid()) { - return QPixmap(); - } - TabBoxClient* client = static_cast< TabBoxClient* >(index.model()->data(index, ClientModel::ClientRole).value()); - if (!client) { - return QPixmap(); - } - - QSize s(32, 32); - if (requestedSize.isValid()) { - s = requestedSize; - } - *size = s; - QPixmap icon = client->icon(s); - if (s.width() > icon.width() || s.height() > icon.height()) { - // icon is smaller than what we requested - QML would scale it which looks bad - QPixmap temp(s); - temp.fill(Qt::transparent); - QPainter p(&temp); - p.drawPixmap(s.width()/2 - icon.width()/2, s.height()/2 - icon.height()/2, icon); - icon = temp; - } - if (parts.size() > 2) { - KIconEffect *effect = KIconLoader::global()->iconEffect(); - KIconLoader::States state = KIconLoader::DefaultState; - if (parts.last() == QLatin1String("selected")) { - state = KIconLoader::ActiveState; - } else if (parts.last() == QLatin1String("disabled")) { - state = KIconLoader::DisabledState; - } - icon = effect->apply(icon, KIconLoader::Desktop, state); - } - return icon; -} - - -DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent) - : QDeclarativeView(parent) - , m_model(model) - , m_mode(mode) - , m_currentScreenGeometry() - , m_currentLayout() - , m_cachedWidth(0) - , m_cachedHeight(0) -{ - setAttribute(Qt::WA_TranslucentBackground); - setWindowFlags(Qt::X11BypassWindowManagerHint); - if (tabBox->embedded()) { - setResizeMode(QDeclarativeView::SizeRootObjectToView); - } else { - setResizeMode(QDeclarativeView::SizeViewToRootObject); - } - QPalette pal = palette(); - pal.setColor(backgroundRole(), Qt::transparent); - setPalette(pal); - engine()->addImageProvider(QLatin1String("client"), new ImageProvider(model)); - KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(engine()); - kdeclarative.initialize(); - kdeclarative.setupBindings(); -#ifndef TABBOX_KCM - qmlRegisterType("org.kde.kwin", 0, 1, "DesktopThumbnailItem"); -#endif - qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); - rootContext()->setContextProperty("viewId", static_cast(winId())); - if (m_mode == TabBoxConfig::ClientTabBox) { - rootContext()->setContextProperty("clientModel", model); - } else if (m_mode == TabBoxConfig::DesktopTabBox) { - rootContext()->setContextProperty("clientModel", model); - } - setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/tabbox/tabbox.qml")))); - - connect(tabBox, SIGNAL(configChanged()), SLOT(updateQmlSource())); - if (m_mode == TabBoxConfig::ClientTabBox) { - connect(tabBox, SIGNAL(embeddedChanged(bool)), SLOT(slotEmbeddedChanged(bool))); - } -} - -void DeclarativeView::showEvent(QShowEvent *event) -{ -#ifndef TABBOX_KCM - if (tabBox->embedded()) { - Client *c = Workspace::self()->findClient(WindowMatchPredicate(tabBox->embedded())); - if (c) { - connect(c, SIGNAL(geometryChanged()), this, SLOT(slotUpdateGeometry())); - } - } -#endif - updateQmlSource(); - m_currentScreenGeometry = QApplication::desktop()->screenGeometry(tabBox->activeScreen()); - rootObject()->setProperty("screenWidth", m_currentScreenGeometry.width()); - rootObject()->setProperty("screenHeight", m_currentScreenGeometry.height()); - rootObject()->setProperty("allDesktops", tabBox->config().tabBoxMode() == TabBoxConfig::ClientTabBox && - tabBox->config().clientDesktopMode() == TabBoxConfig::AllDesktopsClients); - if (ClientModel *clientModel = qobject_cast(m_model)) { - rootObject()->setProperty("longestCaption", clientModel->longestCaption()); - } - - if (QObject *item = rootObject()->findChild("listView")) { - item->setProperty("currentIndex", tabBox->first().row()); - connect(item, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged(int))); - } - slotUpdateGeometry(); - QResizeEvent re(size(), size()); // to set mask and blurring. - resizeEvent(&re); - QGraphicsView::showEvent(event); -} - -void DeclarativeView::hideEvent(QHideEvent *event) -{ - QWidget::hideEvent(event); -#ifndef TABBOX_KCM - if (tabBox->embedded()) { - Client *c = Workspace::self()->findClient(WindowMatchPredicate(tabBox->embedded())); - if (c) { - disconnect(c, SIGNAL(geometryChanged()), this, SLOT(slotUpdateGeometry())); - } - } -#endif -} - -bool DeclarativeView::x11Event(XEvent *e) -{ - if (tabBox->embedded() && - (e->type == ButtonPress || e->type == ButtonRelease || e->type == MotionNotify)) { - XEvent ev; - - memcpy(&ev, e, sizeof(ev)); - if (e->type == ButtonPress || e->type == ButtonRelease) { - ev.xbutton.x += m_relativePos.x(); - ev.xbutton.y += m_relativePos.y(); - ev.xbutton.window = tabBox->embedded(); - } else if (e->type == MotionNotify) { - ev.xmotion.x += m_relativePos.x(); - ev.xmotion.y += m_relativePos.y(); - ev.xmotion.window = tabBox->embedded(); - } - - XSendEvent( QX11Info::display(), tabBox->embedded(), False, NoEventMask, &ev ); - } - return QDeclarativeView::x11Event(e); -} - -void DeclarativeView::slotUpdateGeometry() -{ - const WId embeddedId = tabBox->embedded(); - if (embeddedId != 0) { - const KWindowInfo info = KWindowSystem::windowInfo(embeddedId, NET::WMGeometry); - const Qt::Alignment alignment = tabBox->embeddedAlignment(); - const QPoint offset = tabBox->embeddedOffset(); - int x = info.geometry().left(); - int y = info.geometry().top(); - int width = tabBox->embeddedSize().width(); - int height = tabBox->embeddedSize().height(); - if (alignment.testFlag(Qt::AlignLeft) || alignment.testFlag(Qt::AlignHCenter)) { - x += offset.x(); - } - if (alignment.testFlag(Qt::AlignRight)) { - x = x + info.geometry().width() - offset.x() - width; - } - if (alignment.testFlag(Qt::AlignHCenter)) { - width = info.geometry().width() - 2 * offset.x(); - } - if (alignment.testFlag(Qt::AlignTop) || alignment.testFlag(Qt::AlignVCenter)) { - y += offset.y(); - } - if (alignment.testFlag(Qt::AlignBottom)) { - y = y + info.geometry().height() - offset.y() - height; - } - if (alignment.testFlag(Qt::AlignVCenter)) { - height = info.geometry().height() - 2 * offset.y(); - } - setGeometry(QRect(x, y, width, height)); - - m_relativePos = QPoint(info.geometry().x(), info.geometry().x()); - } else { - const int width = rootObject()->property("width").toInt(); - const int height = rootObject()->property("height").toInt(); - setGeometry(m_currentScreenGeometry.x() + static_cast(m_currentScreenGeometry.width()) * 0.5 - static_cast(width) * 0.5, - m_currentScreenGeometry.y() + static_cast(m_currentScreenGeometry.height()) * 0.5 - static_cast(height) * 0.5, - width, height); - m_relativePos = pos(); - } -} - -void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnimation) -{ - if (tabBox->config().tabBoxMode() != m_mode) { - return; - } - if (QObject *item = rootObject()->findChild("listView")) { - QVariant durationRestore; - if (disableAnimation) { - durationRestore = item->property("highlightMoveDuration"); - item->setProperty("highlightMoveDuration", QVariant(1)); - } - item->setProperty("currentIndex", index.row()); - if (disableAnimation) { - item->setProperty("highlightMoveDuration", durationRestore); - } - } -} - -void DeclarativeView::currentIndexChanged(int row) -{ - tabBox->setCurrentIndex(m_model->index(row, 0)); - KWindowSystem::forceActiveWindow(m_model->data(m_model->index(row, 0), ClientModel::WIdRole).toLongLong()); -} - -void DeclarativeView::updateQmlSource(bool force) -{ - if (status() != Ready) - return; - if (tabBox->config().tabBoxMode() != m_mode) { - return; - } - if (!force && tabBox->config().layoutName() == m_currentLayout) { - return; - } - const bool desktopMode = (m_mode == TabBoxConfig::DesktopTabBox); - m_currentLayout = tabBox->config().layoutName(); - KService::Ptr service = desktopMode ? findDesktopSwitcher() : findWindowSwitcher(); - if (service.isNull()) { - return; - } - if (service->property("X-Plasma-API").toString() != "declarativeappletscript") { - kDebug(1212) << "Window Switcher Layout is no declarativeappletscript"; - return; - } - const QString file = desktopMode ? findDesktopSwitcherScriptFile(service) : findWindowSwitcherScriptFile(service); - if (file.isNull()) { - kDebug(1212) << "Could not find QML file for window switcher"; - return; - } - rootObject()->setProperty("source", QUrl(file)); -} - -KService::Ptr DeclarativeView::findWindowSwitcher() -{ - QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName()); - KService::List offers = KServiceTypeTrader::self()->query("KWin/WindowSwitcher", constraint); - if (offers.isEmpty()) { - // load default - constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg("informative"); - offers = KServiceTypeTrader::self()->query("KWin/WindowSwitcher", constraint); - if (offers.isEmpty()) { - kDebug(1212) << "could not find default window switcher layout"; - return KService::Ptr(); - } - } - return offers.first(); -} - -KService::Ptr DeclarativeView::findDesktopSwitcher() -{ - QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName()); - KService::List offers = KServiceTypeTrader::self()->query("KWin/DesktopSwitcher", constraint); - if (offers.isEmpty()) { - // load default - constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg("informative"); - offers = KServiceTypeTrader::self()->query("KWin/DesktopSwitcher", constraint); - if (offers.isEmpty()) { - kDebug(1212) << "could not find default desktop switcher layout"; - return KService::Ptr(); - } - } - return offers.first(); -} - -QString DeclarativeView::findWindowSwitcherScriptFile(KService::Ptr service) -{ - const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString(); - const QString scriptName = service->property("X-Plasma-MainScript").toString(); - return KStandardDirs::locate("data", "kwin/tabbox/" + pluginName + "/contents/" + scriptName); -} - -QString DeclarativeView::findDesktopSwitcherScriptFile(KService::Ptr service) -{ - const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString(); - const QString scriptName = service->property("X-Plasma-MainScript").toString(); - return KStandardDirs::locate("data", "kwin/desktoptabbox/" + pluginName + "/contents/" + scriptName); -} - -void DeclarativeView::slotEmbeddedChanged(bool enabled) -{ - if (enabled) { - // cache the width - setResizeMode(QDeclarativeView::SizeRootObjectToView); - m_cachedWidth = rootObject()->property("width").toInt(); - m_cachedHeight = rootObject()->property("height").toInt(); - } else { - setResizeMode(QDeclarativeView::SizeViewToRootObject); - if (m_cachedWidth != 0 && m_cachedHeight != 0) { - rootObject()->setProperty("width", m_cachedWidth); - rootObject()->setProperty("height", m_cachedHeight); - } - updateQmlSource(true); - } -} - -void DeclarativeView::slotWindowChanged(WId wId, unsigned int properties) -{ - if (wId != tabBox->embedded()) { - return; - } - if (properties & NET::WMGeometry) { - slotUpdateGeometry(); - } -} - -bool DeclarativeView::sendKeyEvent(QKeyEvent *e) -{ - return event(e); -} - -} // namespace TabBox -} // namespace KWin diff --git a/kwin/tabbox/declarative.h b/kwin/tabbox/declarative.h deleted file mode 100644 index f43bdd8b..00000000 --- a/kwin/tabbox/declarative.h +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_TABBOX_DECLARATIVE_H -#define KWIN_TABBOX_DECLARATIVE_H -// includes -#include -#include -#include -#include "tabboxconfig.h" - -// forward declaration -#include -#include -class QPos; - -namespace Plasma -{ -class FrameSvg; -} - -namespace KWin -{ -namespace TabBox -{ - -class ImageProvider : public QDeclarativeImageProvider -{ -public: - explicit ImageProvider(QAbstractItemModel *model); - virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); - -private: - QAbstractItemModel *m_model; -}; - -class DeclarativeView : public QDeclarativeView -{ - Q_OBJECT -public: - DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent = NULL); - virtual void showEvent(QShowEvent *event); - void setCurrentIndex(const QModelIndex &index, bool disableAnimation = false); - bool sendKeyEvent(QKeyEvent *event); - -protected: - virtual void hideEvent(QHideEvent *event); - virtual bool x11Event(XEvent *e); - -public Q_SLOTS: - void slotUpdateGeometry(); - void slotEmbeddedChanged(bool enabled); -private Q_SLOTS: - void updateQmlSource(bool force = false); - void currentIndexChanged(int row); - void slotWindowChanged(WId wId, unsigned int properties); -private: - KService::Ptr findWindowSwitcher(); - KService::Ptr findDesktopSwitcher(); - QString findWindowSwitcherScriptFile(KService::Ptr service); - QString findDesktopSwitcherScriptFile(KService::Ptr service); - QAbstractItemModel *m_model; - TabBoxConfig::TabBoxMode m_mode; - QRect m_currentScreenGeometry; - QString m_currentLayout; - int m_cachedWidth; - int m_cachedHeight; - //relative position to the embedding window - QPoint m_relativePos; -}; - -} // namespace TabBox -} // namespace KWin -#endif diff --git a/kwin/tabbox/desktopchain.cpp b/kwin/tabbox/desktopchain.cpp deleted file mode 100644 index 8bc67a70..00000000 --- a/kwin/tabbox/desktopchain.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "desktopchain.h" - -namespace KWin -{ -namespace TabBox -{ - -DesktopChain::DesktopChain(uint initialSize) - : m_chain(initialSize) -{ - init(); -} - -void DesktopChain::init() -{ - for (int i = 0; i < m_chain.size(); ++i) { - m_chain[i] = i + 1; - } -} - -uint DesktopChain::next(uint indexDesktop) const -{ - const int i = m_chain.indexOf(indexDesktop); - if (i >= 0 && i + 1 < m_chain.size()) { - return m_chain[i+1]; - } else if (m_chain.size() > 0) { - return m_chain[0]; - } else { - return 1; - } -} - -void DesktopChain::resize(uint previousSize, uint newSize) -{ - Q_ASSERT(previousSize == m_chain.size()); - m_chain.resize(newSize); - - if (newSize >= previousSize) { - // We do not destroy the chain in case new desktops are added - for (uint i = previousSize; i < newSize; ++i) { - m_chain[i] = i + 1; - } - } else { - // But when desktops are removed, we may have to modify the chain a bit, - // otherwise invalid desktops may show up. - for (int i = 0; i < m_chain.size(); ++i) { - m_chain[i] = qMin(m_chain[i], newSize); - } - } -} - -void DesktopChain::add(uint desktop) -{ - if (m_chain.isEmpty() || int(desktop) > m_chain.count()) { - return; - } - int index = m_chain.indexOf(desktop); - if (index == -1) { - // not found - shift all elements by one position - index = m_chain.size() - 1; - } - for (int i = index; i > 0; --i) { - m_chain[i] = m_chain[i-1]; - } - m_chain[0] = desktop; -} - -DesktopChainManager::DesktopChainManager(QObject *parent) - : QObject(parent) - , m_maxChainSize(0) -{ - m_currentChain = m_chains.insert(QString(), DesktopChain()); -} - -DesktopChainManager::~DesktopChainManager() -{ -} - -uint DesktopChainManager::next(uint indexDesktop) const -{ - return m_currentChain.value().next(indexDesktop); -} - -void DesktopChainManager::resize(uint previousSize, uint newSize) -{ - m_maxChainSize = newSize; - for (DesktopChains::iterator it = m_chains.begin(); it != m_chains.end(); ++it) { - it.value().resize(previousSize, newSize); - } -} - -void DesktopChainManager::addDesktop(uint previousDesktop, uint currentDesktop) -{ - Q_UNUSED(previousDesktop) - m_currentChain.value().add(currentDesktop); -} - -void DesktopChainManager::useChain(const QString &identifier) -{ - if (m_currentChain.key().isNull()) { - createFirstChain(identifier); - } else { - m_currentChain = m_chains.find(identifier); - if (m_currentChain == m_chains.end()) { - m_currentChain = addNewChain(identifier); - } - } -} - -void DesktopChainManager::createFirstChain(const QString &identifier) -{ - DesktopChain value(m_currentChain.value()); - m_chains.erase(m_currentChain); - m_currentChain = m_chains.insert(identifier, value); -} - -QHash< QString, DesktopChain >::Iterator DesktopChainManager::addNewChain(const QString &identifier) -{ - return m_chains.insert(identifier, DesktopChain(m_maxChainSize)); -} - -} // namespace TabBox -} // namespace KWin diff --git a/kwin/tabbox/desktopchain.h b/kwin/tabbox/desktopchain.h deleted file mode 100644 index 5c8c3da7..00000000 --- a/kwin/tabbox/desktopchain.h +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_TABBOX_DESKTOP_CHAIN_H -#define KWIN_TABBOX_DESKTOP_CHAIN_H -// Qt -#include -#include -#include - -namespace KWin -{ -namespace TabBox -{ - -/** - * @brief A chain for last recently used virtual desktops. - **/ -class DesktopChain -{ -public: - /** - * Creates a last recently used virtual desktop chain with the given @p initialSize. - **/ - explicit DesktopChain(uint initialSize = 0); - /** - * Returns the next desktop in the chain starting from @p indexDesktop. - * In case that the @p indexDesktop is the last desktop of the chain, the method wraps around - * and returns the first desktop stored in the chain. - * In case the chain is valid, but does not contain the @p indexDesktop, the first element of - * the chain is returned. - * In case the chain is not valid, the always valid virtual desktop with identifier @c 1 - * is returned. - * @param indexDesktop The id of the virtual desktop which should be used as a starting point - * @return The next virtual desktop in the chain - **/ - uint next(uint indexDesktop) const; - /** - * Adds the @p desktop to the chain. The @p desktop becomes the first element of the - * chain. All desktops in the chain from the previous index of @p desktop are moved - * one position in the chain. - * @param desktop The new desktop to be the top most element in the chain. - **/ - void add(uint desktop); - /** - * Resizes the chain from @p previousSize to @p newSize. - * In case the chain grows new elements are added with a meaning full id in the range - * [previousSize, newSize]. - * In case the chain shrinks it is ensured that no element points to a virtual desktop - * with an id larger than @p newSize. - * @param previousSize The previous size of the desktop chain - * @param newSize The size to be used for the desktop chain - **/ - void resize(uint previousSize, uint newSize); - -private: - /** - * Initializes the chain with default values. - **/ - void init(); - QVector m_chain; -}; - -/** - * @brief A manager for multiple desktop chains. - * - * This manager keeps track of multiple desktop chains which have a given identifier. - * A common usage for this is to have a different desktop chain for each Activity. - **/ -class DesktopChainManager : public QObject -{ - Q_OBJECT - -public: - explicit DesktopChainManager(QObject *parent = 0); - virtual ~DesktopChainManager(); - - /** - * Returns the next virtual desktop starting from @p indexDesktop in the currently used chain. - * @param indexDesktop The id of the virtual desktop which should be used as a starting point - * @return The next virtual desktop in the currently used chain - * @see DesktopChain::next - **/ - uint next(uint indexDesktop) const; - -public slots: - /** - * Adds the @p currentDesktop to the currently used desktop chain. - * @param previousDesktop The previously used desktop, should be the top element of the chain - * @param currentDesktop The desktop which should be the new top element of the chain - **/ - void addDesktop(uint previousDesktop, uint currentDesktop); - /** - * Resizes all managed desktop chains from @p previousSize to @p newSize. - * @param previousSize The previously used size for the chains - * @param newSize The size to be used for the chains - * @see DesktopChain::resize - **/ - void resize(uint previousSize, uint newSize); - /** - * Switches to the desktop chain identified by the given @p identifier. - * If there is no chain yet for the given @p identifier a new chain is created and used. - * @param identifier The identifier of the desktop chain to be used - **/ - void useChain(const QString &identifier); - -private: - typedef QHash< QString, DesktopChain > DesktopChains; - /** - * Creates a new desktop chain for the given @p identifier and adds it to the list - * of identifiers. - * @returns Position of the new chain in the managed list of chains - **/ - DesktopChains::Iterator addNewChain(const QString &identifier); - /** - * Creates the very first list to be used when an @p identifier comes in. - * The dummy chain which is used by default gets copied and used for this chain. - **/ - void createFirstChain(const QString &identifier); - - DesktopChains::Iterator m_currentChain; - DesktopChains m_chains; - /** - * The maximum size to be used for a new desktop chain - **/ - uint m_maxChainSize; -}; - -} // TabBox -} // namespace KWin - -#endif diff --git a/kwin/tabbox/desktopmodel.cpp b/kwin/tabbox/desktopmodel.cpp deleted file mode 100644 index 8415536d..00000000 --- a/kwin/tabbox/desktopmodel.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ -// own -#include "desktopmodel.h" -// tabbox -#include "clientmodel.h" -#include "tabboxconfig.h" -#include "tabboxhandler.h" - -#include - -namespace KWin -{ -namespace TabBox -{ - -DesktopModel::DesktopModel(QObject* parent) - : QAbstractItemModel(parent) -{ - QHash roleNames; - roleNames.insert(Qt::DisplayRole, "display"); - roleNames.insert(DesktopNameRole, "caption"); - roleNames.insert(DesktopRole, "desktop"); - roleNames.insert(ClientModelRole, "client"); - setRoleNames(roleNames); -} - -DesktopModel::~DesktopModel() -{ -} - -QVariant DesktopModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid() || index.column() != 0) - return QVariant(); - - if (index.parent().isValid()) { - // parent is valid -> access to Client - ClientModel *model = m_clientModels[ m_desktopList[ index.internalId() - 1] ]; - return model->data(model->index(index.row(), 0), role); - } - - const int desktopIndex = index.row(); - if (desktopIndex >= m_desktopList.count()) - return QVariant(); - switch(role) { - case Qt::DisplayRole: - case DesktopNameRole: - return tabBox->desktopName(m_desktopList[ desktopIndex ]); - case DesktopRole: - return m_desktopList[ desktopIndex ]; - case ClientModelRole: - return qVariantFromValue((void*)m_clientModels[ m_desktopList[ desktopIndex ] ]); - default: - return QVariant(); - } -} - -int DesktopModel::columnCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent) - return 1; -} - -int DesktopModel::rowCount(const QModelIndex& parent) const -{ - if (parent.isValid()) { - if (parent.internalId() != 0 || parent.row() >= m_desktopList.count()) { - return 0; - } - const int desktop = m_desktopList.at(parent.row()); - const ClientModel *model = m_clientModels.value(desktop); - return model->rowCount(); - } - return m_desktopList.count(); -} - -QModelIndex DesktopModel::parent(const QModelIndex& child) const -{ - if (!child.isValid() || child.internalId() == 0) { - return QModelIndex(); - } - const int row = child.internalId() -1; - if (row >= m_desktopList.count()) { - return QModelIndex(); - } - return createIndex(row, 0); -} - -QModelIndex DesktopModel::index(int row, int column, const QModelIndex& parent) const -{ - if (column != 0) { - return QModelIndex(); - } - if (row < 0) { - return QModelIndex(); - } - if (parent.isValid()) { - if (parent.row() < 0 || parent.row() >= m_desktopList.count() || parent.internalId() != 0) { - return QModelIndex(); - } - const int desktop = m_desktopList.at(parent.row()); - const ClientModel *model = m_clientModels.value(desktop); - if (row >= model->rowCount()) { - return QModelIndex(); - } - return createIndex(row, column, parent.row() + 1); - } - if (row > m_desktopList.count() || m_desktopList.isEmpty()) - return QModelIndex(); - return createIndex(row, column); -} - -QModelIndex DesktopModel::desktopIndex(int desktop) const -{ - if (desktop > m_desktopList.count()) - return QModelIndex(); - return createIndex(m_desktopList.indexOf(desktop), 0); -} - -void DesktopModel::createDesktopList() -{ - beginResetModel(); - m_desktopList.clear(); - qDeleteAll(m_clientModels); - m_clientModels.clear(); - - switch(tabBox->config().desktopSwitchingMode()) { - case TabBoxConfig::MostRecentlyUsedDesktopSwitching: { - int desktop = tabBox->currentDesktop(); - do { - m_desktopList.append(desktop); - ClientModel* clientModel = new ClientModel(this); - clientModel->createClientList(desktop); - m_clientModels.insert(desktop, clientModel); - desktop = tabBox->nextDesktopFocusChain(desktop); - } while (desktop != tabBox->currentDesktop()); - break; - } - case TabBoxConfig::StaticDesktopSwitching: { - for (int i = 1; i <= tabBox->numberOfDesktops(); i++) { - m_desktopList.append(i); - ClientModel* clientModel = new ClientModel(this); - clientModel->createClientList(i); - m_clientModels.insert(i, clientModel); - } - break; - } - } - endResetModel(); -} - -} // namespace Tabbox -} // namespace KWin diff --git a/kwin/tabbox/desktopmodel.h b/kwin/tabbox/desktopmodel.h deleted file mode 100644 index c253354e..00000000 --- a/kwin/tabbox/desktopmodel.h +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef DESKTOPMODEL_H -#define DESKTOPMODEL_H - -#include -/** -* @file -* This file defines the class DesktopModel, the model for desktops. -* -* @author Martin Gräßlin -* @since 4.4 -*/ - -namespace KWin -{ -namespace TabBox -{ -class ClientModel; - -/** -* The model for desktops used in TabBox. -* -* @author Martin Gräßlin -* @since 4.4 -*/ -class DesktopModel - : public QAbstractItemModel -{ -public: - enum { - DesktopRole = Qt::UserRole, ///< Desktop number - DesktopNameRole = Qt::UserRole + 1, ///< Desktop name - ClientModelRole = Qt::UserRole + 2 ///< Clients on this desktop - }; - explicit DesktopModel(QObject* parent = 0); - ~DesktopModel(); - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex& child) const; - virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const; - - /** - * Generates a new list of desktops based on the current config. - * Calling this method will reset the model. - */ - void createDesktopList(); - /** - * @return The current list of desktops. - */ - QList< int > desktopList() const { - return m_desktopList; - } - /** - * @param desktop The desktop whose ModelIndex should be retrieved - * @return The ModelIndex of given desktop or an invalid ModelIndex if - * the desktop is not in the model. - */ - QModelIndex desktopIndex(int desktop) const; - -private: - QList< int > m_desktopList; - QMap< int, ClientModel* > m_clientModels; -}; - -} // namespace Tabbox -} // namespace KWin -#endif // DESKTOPMODEL_H diff --git a/kwin/tabbox/kwindesktopswitcher.desktop b/kwin/tabbox/kwindesktopswitcher.desktop deleted file mode 100644 index bf381451..00000000 --- a/kwin/tabbox/kwindesktopswitcher.desktop +++ /dev/null @@ -1,54 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=KWin/DesktopSwitcher - -Comment=KWin Desktop Switcher Layout -Comment[bs]=Izgled KWin prebacivača radnih površina -Comment[ca]=Disposició del commutador d'escriptoris del KWin -Comment[ca@valencia]=Disposició del commutador d'escriptoris del KWin -Comment[cs]=Rozvržení přepínače ploch KWin -Comment[da]=Layout til KWins skrivebordsskifter -Comment[de]=Arbeitsflächenwechsler-Layout -Comment[el]=Διάταξη εναλλαγής παραθύρων Kwin -Comment[en_GB]=KWin Desktop Switcher Layout -Comment[es]=Esquema del cambiador de escritorios de KWin -Comment[et]=KWini töölauavahetaja paigutus -Comment[eu]=KWin leiho-aldatzailearen diseinua -Comment[fi]=KWinin työpöydänvalitsimen asettelu -Comment[fr]=Une disposition du sélecteur de bureaux KWin -Comment[gl]=Disposición do selector de escritorios de KWin -Comment[hu]=KWin asztalváltó elrendezés -Comment[ia]=Disposition de commutator de scriptorio de KWin -Comment[it]=Disposizione scambiatore desktop KWin -Comment[kk]=KWin үстел ауыстырғышының қалыпы -Comment[ko]=KWin 데스크톱 전환기 레이아웃 -Comment[lt]=KWin darbastalio perjungimo išdėstymas -Comment[nb]=Utforming av KWin skrivebordsbytter -Comment[nds]=Utsehn vun de KWin-Schriefdischwesseln -Comment[nl]=KWin indeling van bureaubladwisselaar -Comment[pa]=KWin ਡੈਸਕਟਾਪ ਸਵਿੱਚਰ ਲੇਆਉਟ -Comment[pl]=Układ przełączania pulpitów KWin -Comment[pt]=Disposição da Mudança de Ecrãs do KWin -Comment[pt_BR]=Leiaute do seletor de área de trabalho do KWin -Comment[ru]=Переключатель рабочих столов для KWin -Comment[sk]=Rozloženie prepínača okien KWin -Comment[sl]=Razpored preklapljanja med namizji -Comment[sr]=Распоред К‑виновог мењача површи -Comment[sr@ijekavian]=Распоред К‑виновог мењача површи -Comment[sr@ijekavianlatin]=Raspored KWinovog menjača površi -Comment[sr@latin]=Raspored KWinovog menjača površi -Comment[sv]=Kwin-skrivbordsbyteslayout -Comment[tr]=KWin Pencere Değiştirme Düzeni -Comment[uk]=Компонування засобу перемикання стільниць KWin -Comment[x-test]=xxKWin Desktop Switcher Layoutxx -Comment[zh_CN]=KWin 桌面切换器布局 -Comment[zh_TW]=KWin 桌面切換器佈局 - -[PropertyDef::X-Plasma-API] -Type=QString - -[PropertyDef::X-Plasma-MainScript] -Type=QString - -[PropertyDef::X-KWin-Exclude-Listing] -Type=bool diff --git a/kwin/tabbox/kwinwindowswitcher.desktop b/kwin/tabbox/kwinwindowswitcher.desktop deleted file mode 100644 index 6d9dfefa..00000000 --- a/kwin/tabbox/kwinwindowswitcher.desktop +++ /dev/null @@ -1,56 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=KWin/WindowSwitcher - -Comment=KWin Window Switcher Layout -Comment[bs]=KWin Prozor Switcher Izgled -Comment[ca]=Disposició del commutador de finestres del KWin -Comment[ca@valencia]=Disposició del commutador de finestres del KWin -Comment[cs]=Rozvržení přepínače oken KWin -Comment[da]=Layout til KWins vinduesskifter -Comment[de]=Fensterwechsler-Layout -Comment[el]=Διάταξη εναλλαγής παραθύρων Kwin -Comment[en_GB]=KWin Window Switcher Layout -Comment[es]=Esquema del cambiador de ventanas de KWin -Comment[et]=KWini aknavahetaja paigutus -Comment[eu]=KWin-eko leiho-kommutadorearen diseinua -Comment[fi]=KWinin ikkunanvalitsimen asettelu -Comment[fr]=Disposition du sélecteur de fenêtres de KWin -Comment[gl]=Disposición do alternador de xanelas de KWin -Comment[hu]=KWin ablakváltó elrendezés -Comment[ia]=Disposition de commutator de fenestra de KWin -Comment[it]=Disposizione scambiafinestre KWin -Comment[kk]=KWin терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​នៃ​កម្មវិធី​ប្ដូរ​បង្អួច KWin -Comment[ko]=KWin 창 전환기 레이아웃 -Comment[lt]=KWin langų perjungimo išdėstymas -Comment[mr]=के-विन चौकट बदल रचना -Comment[nb]=Utforming av KWin vindusbytter -Comment[nds]=Utsehn vun de KWin-Finsterwesseln -Comment[nl]=KWin indeling van vensterwisselaar -Comment[pa]=KWin ਵਿੰਡੋ ਸਵਿੱਚਰ ਲੇਆਉਟ -Comment[pl]=Układ przełączania okien KWin -Comment[pt]=Disposição da Mudança de Janelas do KWin -Comment[pt_BR]=Leiaute do seletor de janelas do KWin -Comment[ru]=Переключатель окон для KWin -Comment[sk]=Rozloženie prepínača okien KWin -Comment[sl]=Razpored preklapljanja med okni -Comment[sr]=Распоред К‑виновог мењача прозора -Comment[sr@ijekavian]=Распоред К‑виновог мењача прозора -Comment[sr@ijekavianlatin]=Raspored KWinovog menjača prozora -Comment[sr@latin]=Raspored KWinovog menjača prozora -Comment[sv]=Kwin-fönsterbyteslayout -Comment[tr]=KWin Pencere Değiştirme Düzeni -Comment[uk]=Компонування засобу перемикання вікон KWin -Comment[x-test]=xxKWin Window Switcher Layoutxx -Comment[zh_CN]=KWin 窗口切换器布局 -Comment[zh_TW]=KWin 視窗切換器佈局 - -[PropertyDef::X-Plasma-API] -Type=QString - -[PropertyDef::X-Plasma-MainScript] -Type=QString - -[PropertyDef::X-KWin-Exclude-Listing] -Type=bool diff --git a/kwin/tabbox/qml/CMakeLists.txt b/kwin/tabbox/qml/CMakeLists.txt deleted file mode 100644 index 7b34c701..00000000 --- a/kwin/tabbox/qml/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -install( FILES tabbox.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) - -# packages -install( DIRECTORY clients/big_icons DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) -install( DIRECTORY clients/compact DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) -install( DIRECTORY clients/informative DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) -install( DIRECTORY clients/present_windows DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) -install( DIRECTORY clients/small_icons DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) -install( DIRECTORY clients/text DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) -install( DIRECTORY clients/thumbnails DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox ) - -install( DIRECTORY desktops/informative DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/desktoptabbox ) -install( DIRECTORY desktops/previews DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/desktoptabbox ) - -# service files -install( FILES clients/big_icons/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_big_icons.desktop ) -install( FILES clients/compact/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_compact.desktop ) -install( FILES clients/informative/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_informative.desktop ) -install( FILES clients/present_windows/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_present_windows.desktop ) -install( FILES clients/small_icons/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_small_icons.desktop ) -install( FILES clients/text/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_text.desktop ) -install( FILES clients/thumbnails/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_thumbnails.desktop ) - -install( FILES desktops/informative/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_desktop_switcher_informative.desktop ) -install( FILES desktops/previews/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin RENAME kwin4_desktop_switcher_previews.desktop ) - -install (FILES IconTabBox.qml ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/big_icons/contents/ui) -install (FILES IconTabBox.qml ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/small_icons/contents/ui) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/compact/contents/ui) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/informative/contents/ui) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/present_windows/contents/ui) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/thumbnails/contents/ui) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/tabbox/text/contents/ui) - -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/desktoptabbox/informative/contents/ui) -install (FILES ShadowedSvgItem.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/desktoptabbox/previews/contents/ui) diff --git a/kwin/tabbox/qml/IconTabBox.qml b/kwin/tabbox/qml/IconTabBox.qml deleted file mode 100644 index c5952618..00000000 --- a/kwin/tabbox/qml/IconTabBox.qml +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: iconsTabBox - property int iconSize - property int imagePathPrefix: (new Date()).getTime() - property alias count: iconsListView.count - property alias margins: hoverItem.margins - property alias currentItem: iconsListView.currentItem - focus: true - clip: true - - - function setModel(model) { - iconsListView.model = model; - iconsListView.imageId++; - } - - function modelChanged() { - iconsListView.imageId++; - } - - PlasmaCore.Theme { - id: theme - } - - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - // delegate - Component { - id: listDelegate - Item { - property alias data: iconItem.data - id: delegateItem - width: iconSize + hoverItem.margins.left + hoverItem.margins.right - height: iconSize + hoverItem.margins.top + hoverItem.margins.bottom - Image { - property variant data: model - id: iconItem - source: "image://client/" + index + "/" + iconsTabBox.imagePathPrefix + "-" + iconsListView.imageId + (index == iconsListView.currentIndex ? "/selected" : "") - sourceSize { - width: iconSize - height: iconSize - } - anchors { - fill: parent - leftMargin: hoverItem.margins.left - rightMargin: hoverItem.margins.right - topMargin: hoverItem.margins.top - bottomMargin: hoverItem.margins.bottom - } - } - MouseArea { - anchors.fill: parent - onClicked: { - iconsListView.currentIndex = index; - iconsListView.currentIndexChanged(iconsListView.currentIndex); - } - } - } - } - ListView { - signal currentIndexChanged(int index) - id: iconsListView - objectName: "listView" - orientation: ListView.Horizontal - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - width: Math.min(parent.width, (iconSize + margins.left + margins.right) * count) - height: iconSize + margins.top + margins.bottom - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - } - clip: true - delegate: listDelegate - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: iconSize + margins.left + margins.right - height: iconSize + margins.top + margins.bottom - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Left) { - iconsListView.decrementCurrentIndex(); - iconsListView.currentIndexChanged(iconsListView.currentIndex); - } else if (event.key == Qt.Key_Right) { - iconsListView.incrementCurrentIndex(); - iconsListView.currentIndexChanged(iconsListView.currentIndex); - } - } -} diff --git a/kwin/tabbox/qml/ShadowedSvgItem.qml b/kwin/tabbox/qml/ShadowedSvgItem.qml deleted file mode 100644 index 76d59221..00000000 --- a/kwin/tabbox/qml/ShadowedSvgItem.qml +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2013 Weng Xuetian - -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, see . -*********************************************************************/ - -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - property double leftMargin: shadow.margins.left + background.margins.left - property double topMargin: shadow.margins.top + background.margins.top - property double rightMargin: shadow.margins.right + background.margins.right - property double bottomMargin: shadow.margins.bottom + background.margins.bottom - property double centerWidth: shadow.width - shadow.margins.left - shadow.margins.right - property double centerHeight: shadow.height - shadow.margins.bottom - shadow.margins.top - property int centerTopMargin: shadow.margins.top - property int centerLeftMargin: shadow.margins.left - property alias maskImagePath: shadow.imagePath - - PlasmaCore.FrameSvg { - id: themeInfo - imagePath: "dialogs/background" - property bool hasNewShadows: hasElementPrefix("shadow") - } - - PlasmaCore.FrameSvgItem { - id: shadow - prefix: themeInfo.hasNewShadows ? "shadow" : "" - - imagePath: "dialogs/background" - anchors.fill: parent - visible: true - - PlasmaCore.FrameSvgItem { - id: background - imagePath: shadow.imagePath - visible: themeInfo.hasNewShadows - anchors { - fill: parent - leftMargin: shadow.margins.left - topMargin: shadow.margins.top - rightMargin: shadow.margins.right - bottomMargin: shadow.margins.bottom - } - } - } -} diff --git a/kwin/tabbox/qml/clients/big_icons/contents/ui/main.qml b/kwin/tabbox/qml/clients/big_icons/contents/ui/main.qml deleted file mode 100644 index 30e3b20b..00000000 --- a/kwin/tabbox/qml/clients/big_icons/contents/ui/main.qml +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: bigIconsTabBox - property int screenWidth : 0 - property int screenHeight : 0 - property int imagePathPrefix: (new Date()).getTime() - property int optimalWidth: (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count + background.leftMargin + background.bottomMargin - property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + background.topMargin + background.bottomMargin + 40 - property bool canStretchX: false - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.3, optimalWidth), screenWidth * 0.9) - height: Math.min(Math.max(screenHeight * 0.05, optimalHeight), screenHeight * 0.5) - - - function setModel(model) { - icons.setModel(model); - } - - function modelChanged() { - icons.modelChanged(); - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - IconTabBox { - id: icons - iconSize: 128 - height: iconSize + background.topMargin + icons.margins.top + icons.margins.bottom - anchors { - top: parent.top - left: parent.left - right: parent.right - topMargin: background.topMargin - rightMargin: background.rightMargin - leftMargin: background.leftMargin - } - } - Item { - id: captionFrame - anchors { - top: icons.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - Text { - function constrainWidth() { - if (textItem.width > textItem.maxWidth && textItem.width > 0 && textItem.maxWidth > 0) { - textItem.width = textItem.maxWidth; - } else { - textItem.width = undefined; - } - } - function calculateMaxWidth() { - textItem.maxWidth = bigIconsTabBox.width - captionFrame.anchors.leftMargin - captionFrame.anchors.rightMargin - captionFrame.anchors.rightMargin; - } - id: textItem - property int maxWidth: 0 - text: icons.currentItem ? icons.currentItem.data.caption : "" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: theme.textColor - elide: Text.ElideMiddle - font { - bold: true - } - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - } - onTextChanged: textItem.constrainWidth() - Component.onCompleted: textItem.calculateMaxWidth() - Connections { - target: bigIconsTabBox - onWidthChanged: { - textItem.calculateMaxWidth(); - textItem.constrainWidth(); - } - } - } - } -} diff --git a/kwin/tabbox/qml/clients/big_icons/metadata.desktop b/kwin/tabbox/qml/clients/big_icons/metadata.desktop deleted file mode 100644 index 9ffe36ab..00000000 --- a/kwin/tabbox/qml/clients/big_icons/metadata.desktop +++ /dev/null @@ -1,106 +0,0 @@ -[Desktop Entry] -Name=Large Icons -Name[bs]=Velike ikone -Name[ca]=Icones grans -Name[ca@valencia]=Icones grans -Name[cs]=Velké ikony -Name[da]=Store ikoner -Name[de]=Große Symbole -Name[el]=Μεγάλα εικονίδια -Name[en_GB]=Large Icons -Name[es]=Iconos grandes -Name[et]=Suured ikoonid -Name[eu]=Ikono handiak -Name[fi]=Suuret kuvakkeet -Name[fr]=Grandes icônes -Name[ga]=Deilbhíní Móra -Name[gl]=Iconas grandes -Name[he]=סמלים גדולים -Name[hu]=Nagy ikonok -Name[ia]=Icones grande -Name[it]=Icone grandi -Name[kk]=Үлкен таңбашалар -Name[km]=រូបតំណាង​ធំ -Name[ko]=큰 아이콘 -Name[lt]=Dideli ženkliukai -Name[mr]=मोठे चिन्ह -Name[nb]=Store ikoner -Name[nds]=Groot Lüttbiller -Name[nl]=Grote pictogrammen -Name[pa]=ਵੱਡੇ ਆਈਕਾਨ -Name[pl]=Duże ikony -Name[pt]=Ícones Grandes -Name[pt_BR]=Ícones grandes -Name[ro]=Pictograme mari -Name[ru]=Крупные значки -Name[sk]=Veľké ikony -Name[sl]=Velike ikone -Name[sr]=Велике иконе -Name[sr@ijekavian]=Велике иконе -Name[sr@ijekavianlatin]=Velike ikone -Name[sr@latin]=Velike ikone -Name[sv]=Stora ikoner -Name[tr]=Büyük Simgeler -Name[uk]=Великі піктограми -Name[vi]=Biểu tượng lớn -Name[x-test]=xxLarge Iconsxx -Name[zh_CN]=大图标 -Name[zh_TW]=大圖示 -Comment=A window switcher layout using large icons to represent the window -Comment[bs]=Izgled prozora Switcher pomoću velike ikone za zastupanje prozor -Comment[ca]=Una disposició del commutador de finestres que utilitza icones grans per representar la finestra -Comment[ca@valencia]=Una disposició del commutador de finestres que utilitza icones grans per representar la finestra -Comment[cs]=Rozvržení přepínače oken používající velké ikony -Comment[da]=Et vinduesskifter-layout som bruger store ikoner til at repræsentere vinduet -Comment[de]=Ein Fensterwechsler-Layout, das große Symbole zur Darstellung der Fenster verwendet -Comment[el]=Μια διάταξη εναλλαγής παραθύρων που χρησιμοποιεί μεγάλα εικονίδια για να αναπαραστήσει το παράθυρο -Comment[en_GB]=A window switcher layout using large icons to represent the window -Comment[es]=Un esquema de cambiador de ventanas que usa iconos grandes para representar las ventanas -Comment[et]=Aknavahetaja paigutus suurte, aknaid tähistavate ikoonidega -Comment[eu]=Leihoak irudikatzeko ikono handiak erabiltzen dituen leiho-kommutadorearen diseinu bat -Comment[fi]=Ikkunanvalitsimen asettelu, jossa ikkunat esitetään suurilla kuvakkeilla -Comment[fr]=Un sélecteur de fenêtres utilisant de grandes icônes pour représenter les fenêtres -Comment[gl]=Unha disposición do alternador de xanelas que usa iconas grandes para representar a xanela -Comment[hu]=Egy ablakváltó elrendezés, amely nagy ikonokat használ az ablak ábrázolásához -Comment[ia]=Un disposition de commutator de fenestra usante icones grande pro representar le fenestra -Comment[it]=Una disposizione dello scambiafinestre che usa icone grandi per rappresentare le finestre -Comment[kk]=Терезелерді үлкен таңбашалармен белгілейтін терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​កម្មវិធី​ប្ដូរ​បង្អួច ដោយ​ប្រើ​រូបតំណាង​ធំ ដើម្បី​បង្ហាញ​បង្អួច​ឡើងវិញ -Comment[ko]=큰 아이콘으로 창을 나타내는 창 전환기 레이아웃 -Comment[lt]=Langų perjungimo išdėstymas naudojantis dideles piktogramas langų pristatymui -Comment[mr]=चौकटींचे प्रतिनिधित्व करणारी मोठी चिन्हे वापरणारी एक चौकट बदल रचना -Comment[nb]=En vindusbytterutforming som bruker store ikoner for å representere vinduer -Comment[nds]=En Finsterwesseln mit groot Lüttbiller för de Finstern -Comment[nl]=Een indeling van de vensterwisselaar die grote pictogrammen gebruikt om vensters te representeren -Comment[pl]=Układ przełączania okien używający dużych ikon do prezentowania okien -Comment[pt]=Uma disposição de mudança de janelas que usa ícones grandes para representar a janela -Comment[pt_BR]=Um leiaute do seletor de janelas que usa ícones grandes para representá-las -Comment[ro]=Aranjament pentru comutarea ferestrelor ce folosește pictograme mari pentru a reprezenta fereastra -Comment[ru]=Переключатель окон, показывающий большие значки окон -Comment[sk]=Rozloženie prepínača okien používajúce veľké ikony na reprezentáciu okna -Comment[sl]=Razpored preklapljanja za predstavitev oken uporablja velike ikone -Comment[sr]=Распоред мењача прозора који представља прозоре великим иконама -Comment[sr@ijekavian]=Распоред мењача прозора који представља прозоре великим иконама -Comment[sr@ijekavianlatin]=Raspored menjača prozora koji predstavlja prozore velikim ikonama -Comment[sr@latin]=Raspored menjača prozora koji predstavlja prozore velikim ikonama -Comment[sv]=En layout för fönsterbyte som använder stora ikoner för att representera fönstret -Comment[tr]=Büyük simgeleri kullanan bir pencere değiştirme düzeni pencere temsilini gösteriyor -Comment[uk]=Компонування засобу перемикання вікон з великими піктограмами вікон -Comment[vi]=Một kiểu chuyển đổi cửa sổ sử dụng các biểu tượng lớn để đại diện cho cửa sổ -Comment[x-test]=xxA window switcher layout using large icons to represent the windowxx -Comment[zh_CN]=一个用大图标表示窗口的窗口切换器布局 -Comment[zh_TW]=使用大圖示來表示視窗的視窗切換器佈局 -Icon=preferences-system-windows-switcher-big-icons - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=big_icons -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/clients/compact/contents/ui/main.qml b/kwin/tabbox/qml/clients/compact/contents/ui/main.qml deleted file mode 100644 index 19cf79f6..00000000 --- a/kwin/tabbox/qml/clients/compact/contents/ui/main.qml +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: compactTabBox - property int screenWidth : 0 - property int screenHeight : 0 - property string longestCaption: "" - property int imagePathPrefix: (new Date()).getTime() - property int optimalWidth: compactListView.maxRowWidth - property int optimalHeight: compactListView.rowHeight * compactListView.count + background.topMargin + background.bottomMargin - property bool canStretchX: true - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) - height: Math.min(Math.max(screenHeight * 0.2, optimalHeight), screenHeight * 0.8) - focus: true - - property int textMargin: 2 - - onLongestCaptionChanged: { - compactListView.maxRowWidth = compactListView.calculateMaxRowWidth(); - } - - function setModel(model) { - compactListView.model = model; - compactListView.maxRowWidth = compactListView.calculateMaxRowWidth(); - compactListView.imageId++; - } - - function modelChanged() { - compactListView.imageId++; - } - - /** - * Returns the caption with adjustments for minimized items. - * @param caption the original caption - * @param mimized whether the item is minimized - * @return Caption adjusted for minimized state - **/ - function itemCaption(caption, minimized) { - var text = caption; - if (minimized) { - text = "(" + text + ")"; - } - return text; - } - - PlasmaCore.Theme { - id: theme - } - - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - // delegate - Component { - id: listDelegate - Item { - id: delegateItem - width: compactListView.width - height: compactListView.rowHeight - opacity: minimized ? 0.6 : 1.0 - Image { - id: iconItem - source: "image://client/" + index + "/" + compactTabBox.imagePathPrefix + "-" + compactListView.imageId + "/selected" - width: 16 - height: 16 - sourceSize { - width: 16 - height: 16 - } - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: hoverItem.margins.left - } - } - Text { - id: captionItem - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignBottom - text: itemCaption(caption, minimized) - font.bold: index == compactListView.currentIndex - color: theme.textColor - elide: Text.ElideMiddle - anchors { - left: iconItem.right - right: parent.right - top: parent.top - bottom: parent.bottom - topMargin: hoverItem.margins.top - rightMargin: hoverItem.margins.right - bottomMargin: hoverItem.margins.bottom - leftMargin: 2 * compactTabBox.textMargin - } - } - MouseArea { - anchors.fill: parent - onClicked: { - compactListView.currentIndex = index; - compactListView.currentIndexChanged(compactListView.currentIndex); - } - } - } - } - ListView { - function calculateMaxRowWidth() { - var width = 0; - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "' + itemCaption(compactTabBox.longestCaption, true) + '"\n' - + ' font.bold: true\n' - + ' visible: false\n' - + '}', - compactListView, "calculateMaxRowWidth"); - width = Math.max(textElement.width, width); - textElement.destroy(); - return width + 16 + 2 * compactTabBox.textMargin + hoverItem.margins.right + hoverItem.margins.left + background.leftMargin + background.rightMargin - } - /** - * Calculates the height of one row based on the text height and icon size. - * @return Row height - **/ - function calcRowHeight() { - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "Some Text"\n' - + ' font.bold: true\n' - + ' visible: false\n' - + '}', - compactListView, "calcRowHeight"); - var height = textElement.height; - textElement.destroy(); - // icon size or two text elements and margins and hoverItem margins - return Math.max(16, height + hoverItem.margins.top + hoverItem.margins.bottom); - } - signal currentIndexChanged(int index) - id: compactListView - objectName: "listView" - // the maximum text width + icon item width (32 + 4 margin) + margins for hover item + margins for background - property int maxRowWidth: calculateMaxRowWidth() - property int rowHeight: calcRowHeight() - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - anchors { - fill: parent - topMargin: background.topMargin - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - clip: true - delegate: listDelegate - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: compactListView.width - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Up) { - compactListView.decrementCurrentIndex(); - compactListView.currentIndexChanged(compactListView.currentIndex); - } else if (event.key == Qt.Key_Down) { - compactListView.incrementCurrentIndex(); - compactListView.currentIndexChanged(compactListView.currentIndex); - } - } -} diff --git a/kwin/tabbox/qml/clients/compact/metadata.desktop b/kwin/tabbox/qml/clients/compact/metadata.desktop deleted file mode 100644 index 3b28913a..00000000 --- a/kwin/tabbox/qml/clients/compact/metadata.desktop +++ /dev/null @@ -1,106 +0,0 @@ -[Desktop Entry] -Name=Compact -Name[bs]=Kompaktan -Name[ca]=Compacta -Name[ca@valencia]=Compacta -Name[cs]=Kompaktní -Name[da]=Kompakt -Name[de]=Kompakt -Name[el]=Συμπαγές -Name[en_GB]=Compact -Name[es]=Compacto -Name[et]=Kompaktne -Name[eu]=Trinkoa -Name[fi]=Tiivis -Name[fr]=Synthétique -Name[ga]=Dlúth -Name[gl]=Compacto -Name[he]=מרוכז -Name[hu]=Kompakt -Name[ia]=Compacte -Name[it]=Compatto -Name[kk]=Ықшам -Name[km]=បង្រួម -Name[ko]=축소됨 -Name[lt]=Kompaktiškas -Name[mr]=संक्षिप्त -Name[nb]=Kompakt -Name[nds]=Drang -Name[nl]=Compact -Name[pa]=ਸੰਖੇਪ -Name[pl]=Kompaktowy -Name[pt]=Compacto -Name[pt_BR]=Compacto -Name[ro]=Compact -Name[ru]=Компактный -Name[sk]=Kompaktný -Name[sl]=Strnjeno -Name[sr]=Сажето -Name[sr@ijekavian]=Сажето -Name[sr@ijekavianlatin]=Sažeto -Name[sr@latin]=Sažeto -Name[sv]=Kompakt -Name[tr]=Sıkışık -Name[uk]=Компактне -Name[vi]=Gọn -Name[x-test]=xxCompactxx -Name[zh_CN]=紧凑 -Name[zh_TW]=簡潔模式 -Comment=A compact window switcher layout -Comment[bs]=Kompaktan prozor izgled Switchera -Comment[ca]=Una disposició del commutador de finestres compacta -Comment[ca@valencia]=Una disposició del commutador de finestres compacta -Comment[cs]=Kompaktní rozvržení přepínače oken -Comment[da]=Et kompakt layout til vinduesskifter -Comment[de]=Ein kompaktes Fensterwechsler-Layout -Comment[el]=Μια διάταξη συμπαγούς εναλλάκτη παραθύρων -Comment[en_GB]=A compact window switcher layout -Comment[es]=Un esquema de cambiador de ventanas compacto -Comment[et]=Kompaktne aknavahetaja paigutus -Comment[eu]=Leiho-kommutadorearen diseinu trinko bat -Comment[fi]=Tiivis ikkunanvalitsimen asettelu -Comment[fr]=Une disposition synthétique du sélecteur de fenêtres -Comment[gl]=Unha disposición compacta do alternador de xanelas -Comment[hu]=Egy kompakt ablakváltó elrendezés -Comment[ia]=Un disposition de commutator de fenestra compacte -Comment[it]=Una disposizione compatta dello scambiafinestre -Comment[kk]=Ықшамды терезе ауыстырғышының қалыпы -Comment[km]=បង្រួម​ប្លង់​កម្មវិធី​ប្ដូរ​បង្អួច -Comment[ko]=소형 창 전환기 레이아웃 -Comment[lt]=Kompaktiškas langų perjungimo išdėstymas -Comment[mr]=एक संक्षिप्त चौकट बदल रचना -Comment[nb]=En kompakt utforming av vindusbytter -Comment[nds]=En drang Finsterwessel-Utsehn -Comment[nl]=Een compacte indeling van de vensterwisselaar -Comment[pa]=ਸੰਖੇਪ ਵਿੰਡੋ ਸਵਿੱਚਰ ਲੇਆਉਟ -Comment[pl]=Kompaktowy układ przełączania okien -Comment[pt]=Uma disposição de mudança de janelas compacta -Comment[pt_BR]=Uma leiaute compacto do seletor de janelas -Comment[ro]=Aranjament compact pentru comutarea ferestrelor -Comment[ru]=Компактный переключатель окон -Comment[sk]=Kompaktné rozloženie prepínača okien -Comment[sl]=Strnjen razpored preklapljanja med okni -Comment[sr]=Сажети распоред мењача прозора -Comment[sr@ijekavian]=Сажети распоред мењача прозора -Comment[sr@ijekavianlatin]=Sažeti raspored menjača prozora -Comment[sr@latin]=Sažeti raspored menjača prozora -Comment[sv]=En kompakt layout för fönsterbyte -Comment[tr]=Etkili bir pencere değiştirme düzeni -Comment[uk]=Компактне компонування засобу перемикання вікон -Comment[x-test]=xxA compact window switcher layoutxx -Comment[zh_CN]=一个紧凑的窗口切换器布局 -Comment[zh_TW]=簡潔模式的視窗切換器佈局 -Icon=preferences-system-windows-switcher-compact - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=compact -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/clients/informative/contents/ui/main.qml b/kwin/tabbox/qml/clients/informative/contents/ui/main.qml deleted file mode 100644 index c5218695..00000000 --- a/kwin/tabbox/qml/clients/informative/contents/ui/main.qml +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: informativeTabBox - property int screenWidth : 0 - property int screenHeight : 0 - property bool allDesktops: true - property string longestCaption: "" - property int imagePathPrefix: (new Date()).getTime() - property int optimalWidth: listView.maxRowWidth - property int optimalHeight: listView.rowHeight * listView.count + background.topMargin + background.bottomMargin - property bool canStretchX: true - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) - height: Math.min(Math.max(screenHeight * 0.2, optimalHeight), screenHeight * 0.8) - focus: true - - property int textMargin: 2 - - onLongestCaptionChanged: { - listView.maxRowWidth = listView.calculateMaxRowWidth(); - } - - function setModel(model) { - listView.model = model; - listView.maxRowWidth = listView.calculateMaxRowWidth(); - listView.imageId++; - } - - function modelChanged() { - listView.imageId++; - } - - /** - * Returns the caption with adjustments for minimized items. - * @param caption the original caption - * @param mimized whether the item is minimized - * @return Caption adjusted for minimized state - **/ - function itemCaption(caption, minimized) { - var text = caption; - if (minimized) { - text = "(" + text + ")"; - } - return text; - } - - PlasmaCore.Theme { - id: theme - } - - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - // delegate - Component { - id: listDelegate - Item { - id: delegateItem - width: listView.width - height: listView.rowHeight - Image { - id: iconItem - source: "image://client/" + index + "/" + informativeTabBox.imagePathPrefix + "-" + listView.imageId + (index == listView.currentIndex ? "/selected" : "/disabled") - width: 32 - height: 32 - sourceSize { - width: 32 - height: 32 - } - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: hoverItem.margins.left - } - } - Text { - id: captionItem - horizontalAlignment: Text.AlignHCenter - text: itemCaption(caption, minimized) - font.bold: true - font.italic: minimized - color: theme.textColor - elide: Text.ElideMiddle - anchors { - left: iconItem.right - right: parent.right - top: parent.top - topMargin: informativeTabBox.textMargin + hoverItem.margins.top - rightMargin: hoverItem.margins.right - } - } - Text { - id: desktopNameItem - horizontalAlignment: Text.AlignHCenter - text: desktopName - font.bold: false - font.italic: true - color: theme.textColor - elide: Text.ElideMiddle - visible: informativeTabBox.allDesktops - anchors { - left: iconItem.right - right: parent.right - top: captionItem.bottom - topMargin: informativeTabBox.textMargin - bottom: parent.bottom - bottomMargin: informativeTabBox.textMargin + hoverItem.margins.bottom - rightMargin: hoverItem.margins.right - } - } - MouseArea { - anchors.fill: parent - onClicked: { - listView.currentIndex = index; - listView.currentIndexChanged(listView.currentIndex); - } - } - } - } - ListView { - function calculateMaxRowWidth() { - var width = 0; - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "' + itemCaption(informativeTabBox.longestCaption, true) + '"\n' - + ' font.bold: true\n' - + ' visible: false\n' - + '}', - listView, "calculateMaxRowWidth"); - width = Math.max(textElement.width, width); - textElement.destroy(); - return width + 32 + hoverItem.margins.right + hoverItem.margins.left + background.leftMargin + background.rightMargin; - } - /** - * Calculates the height of one row based on the text height and icon size. - * @return Row height - **/ - function calcRowHeight() { - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "Some Text"\n' - + ' font.bold: true\n' - + ' visible: false\n' - + '}', - listView, "calcRowHeight"); - var height = textElement.height; - textElement.destroy(); - // icon size or two text elements and margins and hoverItem margins - return Math.max(32, height*2 + informativeTabBox.textMargin * 3 + hoverItem.margins.top + hoverItem.margins.bottom); - } - signal currentIndexChanged(int index) - id: listView - objectName: "listView" - // the maximum text width + icon item width (32 + 4 margin) + margins for hover item + margins for background - property int maxRowWidth: calculateMaxRowWidth() - property int rowHeight: calcRowHeight() - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - anchors { - fill: parent - topMargin: background.topMargin - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - clip: true - delegate: listDelegate - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: listView.width - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Up) { - listView.decrementCurrentIndex(); - listView.currentIndexChanged(listView.currentIndex); - } else if (event.key == Qt.Key_Down) { - listView.incrementCurrentIndex(); - listView.currentIndexChanged(listView.currentIndex); - } - } -} diff --git a/kwin/tabbox/qml/clients/informative/metadata.desktop b/kwin/tabbox/qml/clients/informative/metadata.desktop deleted file mode 100644 index 05fe4cea..00000000 --- a/kwin/tabbox/qml/clients/informative/metadata.desktop +++ /dev/null @@ -1,104 +0,0 @@ -[Desktop Entry] -Name=Informative -Name[bs]=informativan -Name[ca]=Informativa -Name[ca@valencia]=Informativa -Name[cs]=Informativní -Name[da]=Informativt -Name[de]=Informativ -Name[el]=Ενημερωτικό -Name[en_GB]=Informative -Name[es]=Informativo -Name[et]=Informatiivne -Name[eu]=Informatzailea -Name[fi]=Informatiivinen -Name[fr]=Informatif -Name[ga]=Faisnéiseach -Name[gl]=Informativo -Name[he]=מלא מידע -Name[hu]=Informatív -Name[ia]=Informative -Name[it]=Informativo -Name[kk]=Мәліметті -Name[km]=ព័ត៌មាន -Name[ko]=정보성 -Name[lt]=Informatyvus -Name[mr]=माहितीजनक -Name[nb]=Informativ -Name[nds]=Informeren -Name[nl]=Informatief -Name[pa]=ਜਾਣਕਾਰੀ -Name[pl]=Informacyjny -Name[pt]=Informativa -Name[pt_BR]=Informativo -Name[ro]=Informativ -Name[ru]=Подробный -Name[sk]=Informatívne -Name[sl]=Podrobno -Name[sr]=Информативно -Name[sr@ijekavian]=Информативно -Name[sr@ijekavianlatin]=Informativno -Name[sr@latin]=Informativno -Name[sv]=Informativ -Name[tr]=Bilgilendirici -Name[uk]=Інформативне -Name[vi]=Thông tin -Name[x-test]=xxInformativexx -Name[zh_CN]=信息 -Name[zh_TW]=資訊提供 -Comment=An informative window switcher layout including desktop name -Comment[bs]=Informativni prozor Switcher (izgled) uključujući stolno ime -Comment[ca]=Una disposició del commutador de finestres informativa que inclou el nom d'escriptori -Comment[ca@valencia]=Una disposició del commutador de finestres informativa que inclou el nom d'escriptori -Comment[cs]=Informativní rozvržení přepínače oken obsahující název plochy -Comment[da]=Et informativt vinduesskifter-layout som medtager navnet på skrivebordet -Comment[de]=Ein informatives Fensterwechsler-Layout, zeigt den Namen der Arbeitsfläche an -Comment[el]=Μια διάταξη εναλλαγής ενημερωτικών παραθύρων που περιλαμβάνει το όνομα της επιφάνειας εργασίας -Comment[en_GB]=An informative window switcher layout including desktop name -Comment[es]=Un esquema de cambiador de ventanas informativo que incluye el nombre del escritorio -Comment[et]=Informatiivne aknavahetaja paigutus koos töölauanimedega -Comment[eu]=Mahaigainaren izena duen leiho-kommutadorearen diseinu informatzaile bat -Comment[fi]=Informatiivinen ikkunanvalitsimen asettelu, joka näyttää myös työpöydän nimen -Comment[fr]=Une disposition de sélecteur de fenêtres informative incluant le nom du bureau -Comment[gl]=Unha disposición informativa do alternador de xanelas que inclúe o nome do escritorio -Comment[hu]=Egy informatív ablakváltó elrendezés az asztal nevét tartalmazva -Comment[ia]=Un disposition de commutator de fenestra informative includente nomine de scriptorio -Comment[it]=Una disposizione informativa dello scambiafinestre che include il nome del desktop -Comment[kk]=Мәліметті терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​កម្មវិធី​ប្ដូរ​បង្អួច​ព័ត៌មាន រួមមាន​ឈ្មោះ​ផ្ទៃតុ -Comment[ko]=데스크톱 이름을 포함하는 정보를 보여 주는 창 전환기 레이아웃 -Comment[lt]=Informatyvus langų perjungimo išdėstymas rodantis darbastalio pavadinimą -Comment[mr]=डेस्कटॉप नाव समाविष्टीत एक माहितीजनक चौकट बदल रचना -Comment[nb]=En informativ utforming av vindusbytter som tar med skrivebordsnavnet -Comment[nds]=En informeren Finsterwessel-Utsehn, dat ok den Schriefdischnaam wiest -Comment[nl]=Een informatieve indeling van de vensterwisselaar inclusief de naam van het bureaublad -Comment[pl]=Informacyjny układ przełączania okien uwzględniający nazwę pulpitu -Comment[pt]=Uma disposição de mudança de janelas que inclui o nome do ecrã -Comment[pt_BR]=Um leiaute do seletor de janelas que inclui o nome da área de trabalho -Comment[ru]=Информативный переключатель окон, с названиями рабочих столов -Comment[sk]=Informatívne rozloženie prepínača okien vrátane názvu plochy -Comment[sl]=Podroben razpored preklapljanja med okni, ki vsebuje ime namizja -Comment[sr]=Информативни распоред мењача прозора укључује и име површи -Comment[sr@ijekavian]=Информативни распоред мењача прозора укључује и име површи -Comment[sr@ijekavianlatin]=Informativni raspored menjača prozora uključuje i ime površi -Comment[sr@latin]=Informativni raspored menjača prozora uključuje i ime površi -Comment[sv]=En informativ layout för fönsterbyte som inkluderar skrivbordsnamnet -Comment[tr]=Masaüstü adını içeren, bilgilendirici bir pencere değiştirme düzeni -Comment[uk]=Інформативне компонування засобу перемикання вікон з назвами стільниць -Comment[x-test]=xxAn informative window switcher layout including desktop namexx -Comment[zh_CN]=一个包含有用信息例如桌面名称的窗口切换器布局 -Comment[zh_TW]=有較多資訊,包含桌面名稱的視窗切換器佈局 -Icon=preferences-system-windows-switcher-informative - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=informative -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/clients/present_windows/contents/ui/main.qml b/kwin/tabbox/qml/clients/present_windows/contents/ui/main.qml deleted file mode 100644 index 889fc900..00000000 --- a/kwin/tabbox/qml/clients/present_windows/contents/ui/main.qml +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 -import org.kde.kwin 0.1 as KWin - -Item { - id: presentWindowsTabBox - property int screenWidth : 1 - property int screenHeight : 1 - property int optimalWidth: 0.9*screenWidth - property int optimalHeight: 0.9*screenHeight - property int imagePathPrefix: (new Date()).getTime() - property int standardMargin: 2 - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: optimalWidth - height: optimalHeight - focus: true - - function setModel(model) { - thumbnailListView.model = model; - thumbnailListView.imageId++; - } - - function modelChanged() { - thumbnailListView.imageId++; - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - PlasmaCore.Theme { - id: theme - } - - GridView { - signal currentIndexChanged(int index) - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - property int rows: Math.round(Math.sqrt(count)) - property int columns: (rows*rows < count) ? rows + 1 : rows - id: thumbnailListView - objectName: "listView" - cellWidth: Math.floor(width / columns) - cellHeight: Math.floor(height / rows) - clip: true - anchors { - fill: parent - leftMargin: background.leftMargin - rightMargin: background.rightMargin - topMargin: background.topMargin - bottomMargin: background.bottomMargin - } - delegate: Item { - width: thumbnailListView.cellWidth - height: thumbnailListView.cellHeight - KWin.ThumbnailItem { - id: thumbnailItem - wId: windowId - anchors { - top: parent.top - left: parent.left - right: parent.right - bottom: captionItem.top - leftMargin: hoverItem.margins.left - rightMargin: hoverItem.margins.right - topMargin: hoverItem.margins.top - bottomMargin: standardMargin - } - } - Item { - id: captionItem - height: childrenRect.height - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - leftMargin: hoverItem.margins.left + standardMargin - bottomMargin: hoverItem.margins.bottom - rightMargin: hoverItem.margins.right - } - Image { - id: iconItem - source: "image://client/" + index + "/" + presentWindowsTabBox.imagePathPrefix + "-" + thumbnailListView.imageId - width: 32 - height: 32 - sourceSize { - width: 32 - height: 32 - } - anchors { - bottom: parent.bottom - right: textItem.left - } - } - Item { - id: textItem - property int maxWidth: parent.width - iconItem.width - parent.anchors.leftMargin - parent.anchors.rightMargin - anchors.leftMargin - standardMargin * 2 - width: (textElementSelected.implicitWidth >= maxWidth) ? maxWidth : textElementSelected.implicitWidth - anchors { - top: parent.top - bottom: parent.bottom - horizontalCenter: parent.horizontalCenter - leftMargin: standardMargin - } - Text { - id: textElementSelected - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: caption - font.italic: minimized - font.bold: true - visible: index == thumbnailListView.currentIndex - color: theme.textColor - elide: Text.ElideMiddle - anchors.fill: parent - } - Text { - id: textElementNormal - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: caption - font.italic: minimized - visible: index != thumbnailListView.currentIndex - color: theme.textColor - elide: Text.ElideMiddle - anchors.fill: parent - } - } - } - MouseArea { - anchors.fill: parent - onClicked: { - thumbnailListView.currentIndex = index; - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } - } - } - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: thumbnailListView.cellWidth - height: thumbnailListView.cellHeight - } - boundsBehavior: Flickable.StopAtBounds - } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Left) { - thumbnailListView.moveCurrentIndexLeft(); - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } else if (event.key == Qt.Key_Right) { - thumbnailListView.moveCurrentIndexRight(); - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } else if (event.key == Qt.Key_Up) { - thumbnailListView.moveCurrentIndexUp(); - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } else if (event.key == Qt.Key_Down) { - thumbnailListView.moveCurrentIndexDown(); - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } - } -} diff --git a/kwin/tabbox/qml/clients/present_windows/metadata.desktop b/kwin/tabbox/qml/clients/present_windows/metadata.desktop deleted file mode 100644 index 30c6b8b4..00000000 --- a/kwin/tabbox/qml/clients/present_windows/metadata.desktop +++ /dev/null @@ -1,105 +0,0 @@ -[Desktop Entry] -Name=Grid -Name[bs]=Grid -Name[ca]=Graella -Name[ca@valencia]=Graella -Name[cs]=Mřížka -Name[da]=Gitter -Name[de]=Raster -Name[el]=Κάνναβος -Name[en_GB]=Grid -Name[es]=Rejilla -Name[et]=Võrgustik -Name[eu]=Sareta -Name[fi]=Ruudukko -Name[fr]=Grille -Name[ga]=Greille -Name[gl]=Grella -Name[he]=רשת -Name[hu]=Rács -Name[ia]=Grillia -Name[it]=Griglia -Name[kk]=Тор -Name[km]=ក្រឡាចត្រង្គ -Name[ko]=바둑판식 -Name[lt]=Tinklelis -Name[mr]=जाळे -Name[nb]=Rutenett -Name[nds]=Gadder -Name[nl]=Raster -Name[nn]=Rutenett -Name[pa]=ਗਰਿੱਡ -Name[pl]=Siatka -Name[pt]=Grelha -Name[pt_BR]=Grade -Name[ro]=Grilă -Name[ru]=Сетка -Name[sk]=Mriežka -Name[sl]=Mreža -Name[sr]=Мрежа -Name[sr@ijekavian]=Мрежа -Name[sr@ijekavianlatin]=Mreža -Name[sr@latin]=Mreža -Name[sv]=Rutnät -Name[tr]=Izgara -Name[uk]=Ґратка -Name[vi]=Lưới -Name[x-test]=xxGridxx -Name[zh_CN]=网格 -Name[zh_TW]=格線 -Comment=A Window Switcher layout showing all windows as thumbnails in a grid -Comment[bs]=Izgled Prozor Switcher prikazuje sve prozore kao sličice u mreži -Comment[ca]=Una disposició del commutador de finestres que mostra totes les finestres com a miniatures en una graella -Comment[ca@valencia]=Una disposició del commutador de finestres que mostra totes les finestres com a miniatures en una graella -Comment[cs]=Rozvržení přepínače oken zobrazující všechna okna jako miniatury v mřížce -Comment[da]=Et vinduesskifter-layout som viser alle vinduer som miniaturer i et gitter -Comment[de]=Ein Fensterwechsler-Layout, das Vorschauen aller Fenster in einem Raster anzeigt -Comment[el]=Μια διάταξη εναλλαγής παραθύρων με όλα τα παράθυρα ως εικόνες επισκόπησης σε κάνναβο -Comment[en_GB]=A Window Switcher layout showing all windows as thumbnails in a grid -Comment[es]=Un esquema de cambiador de ventanas que muestra todas las ventanas como miniaturas en una rejilla -Comment[et]=Aknavahetaja paigutus kõigi akende näitamisega pisipiltidena võrgustikus -Comment[eu]=Leiho guztiak sareta batean koadro txiki gisa erakusten dituen leiho-aldatzailearen diseinu bat -Comment[fi]=Ikkunanvalitsimen asettelu, joka näyttää kaikkien ikkunoiden pienoiskuvat ruudukossa -Comment[fr]=Une disposition de sélecteur de fenêtres affichant toutes les fenêtres en miniatures dans une grille -Comment[gl]=Unha disposición do alternador de xanelas que mostra nunha grella miniaturas das xanelas -Comment[hu]=Egy ablakváltó elrendezés, amely az összes ablakot rácsban jeleníti meg bélyegképekként -Comment[ia]=Un disposition de commutator de fenestra monstrante fenestras como miniaturas in un grillia -Comment[it]=Una disposizione dello scambiafinestre che mostra tutte le finestre come miniature in una griglia -Comment[kk]=Бүкіл терезе нобайлары тор құрып көрсететілін терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​កម្មវិធី​ប្ដូរ​បង្អួច ដោយ​បង្ហាញ​បង្អួច​ទាំងអស់​ជា​រូបភាព​តូចៗ​ក្នុង​ក្រឡាចត្រង្គ -Comment[ko]=모든 창을 바둑판식으로 미리 보여 주는 창 전환기 레이아웃 -Comment[lt]=Langų perjungimo išdėstymas rodantis visus langus kaip miniatiūras tinklelyje -Comment[mr]=सर्व चौकटी एका जाळ्यात लघुप्रतिमेमध्ये दर्शविणारी एक चौकट बदल रचना -Comment[nb]=En vindusbytterutforming som viser alle vinduer som minibilder i et rutenett -Comment[nds]=En Finsterwessel-Utsehn, dat all Finstern as Vöransichten binnen en Gadder wiest -Comment[nl]=Een indeling van de vensterwisselaar met alle vensters als miniaturen in een raster -Comment[pl]=Układ przełączania okien pokazujący wszystkie okna jako miniatury w siatce -Comment[pt]=Uma disposição de mudança de janelas que mostra todas as janelas como miniaturas numa grelha -Comment[pt_BR]=Um leiaute de mudança de janelas que mostra todas as janelas como miniaturas em uma grade -Comment[ru]=Переключатель окон в виде выровненных по сетке миниатюр окон -Comment[sk]=Rozloženie prepínača okien zobrazujúce všetky okná ako miniatúry v mriežke -Comment[sl]=Razpored preklapljanja med okni, ki vsa okna prikazuje kot sličice v mreži -Comment[sr]=Распоред мењача прозора који представља прозоре сличицама у мрежи -Comment[sr@ijekavian]=Распоред мењача прозора који представља прозоре сличицама у мрежи -Comment[sr@ijekavianlatin]=Raspored menjača prozora koji predstavlja prozore sličicama u mreži -Comment[sr@latin]=Raspored menjača prozora koji predstavlja prozore sličicama u mreži -Comment[sv]=En layout för fönsterbyte som visar alla fönster som miniatyrbilder i ett rutnät -Comment[tr]=Bir pencere değiştirme düzeni, tüm pencereleri ızgara içerisinde küçük resimler halinde gösteriyor -Comment[uk]=Компонування засобу перемикання вікон з мініатюрами всіх вікон у форматі ґратки -Comment[x-test]=xxA Window Switcher layout showing all windows as thumbnails in a gridxx -Comment[zh_CN]=一个用表格布局显示窗口预览的窗口切换器布局 -Comment[zh_TW]=將所有視窗的縮圖顯示在格線中的視窗切換器佈局 -Icon=preferences-system-windows-switcher-present-windows - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=present_windows -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/clients/small_icons/contents/ui/main.qml b/kwin/tabbox/qml/clients/small_icons/contents/ui/main.qml deleted file mode 100644 index a3e862fb..00000000 --- a/kwin/tabbox/qml/clients/small_icons/contents/ui/main.qml +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: smallIconsTabBox - property int screenWidth : 0 - property int screenHeight : 0 - property int imagePathPrefix: (new Date()).getTime() - property int optimalWidth: (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count + background.leftMargin + background.bottomMargin - property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + background.topMargin + background.bottomMargin + 40 - property bool canStretchX: false - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.1, optimalWidth), screenWidth * 0.9) - height: Math.min(Math.max(screenHeight * 0.05, optimalHeight), screenHeight * 0.5) - - - function setModel(model) { - icons.setModel(model); - } - - function modelChanged() { - icons.modelChanged(); - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - IconTabBox { - id: icons - iconSize: 16 - height: iconSize + background.topMargin + icons.margins.top + icons.margins.bottom - anchors { - top: parent.top - left: parent.left - right: parent.right - topMargin: background.topMargin - rightMargin: background.rightMargin - leftMargin: background.leftMargin - } - } - Item { - anchors { - top: icons.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - Text { - id: textItem - text: icons.currentItem ? icons.currentItem.data.caption : "" - height: paintedHeight - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: theme.textColor - elide: Text.ElideMiddle - font { - bold: true - } - anchors { - right: parent.right - left: parent.left - verticalCenter: parent.verticalCenter - } - } - } -} diff --git a/kwin/tabbox/qml/clients/small_icons/metadata.desktop b/kwin/tabbox/qml/clients/small_icons/metadata.desktop deleted file mode 100644 index c84fc1cd..00000000 --- a/kwin/tabbox/qml/clients/small_icons/metadata.desktop +++ /dev/null @@ -1,105 +0,0 @@ -[Desktop Entry] -Name=Small Icons -Name[bs]=Male ikone -Name[ca]=Icones petites -Name[ca@valencia]=Icones petites -Name[cs]=Malé ikony -Name[da]=Små ikoner -Name[de]=Kleine Symbole -Name[el]=Μικρά εικονίδια -Name[en_GB]=Small Icons -Name[es]=Iconos pequeños -Name[et]=Väikesed ikoonid -Name[eu]=Ikono txikiak -Name[fi]=Pienet kuvakkeet -Name[fr]=Petites icônes -Name[ga]=Deilbhíní Beaga -Name[gl]=Iconas pequenas -Name[he]=סמלים קטנים -Name[hu]=Kis ikonok -Name[ia]=Icones parve -Name[it]=Icone piccole -Name[kk]=Шағын таңбашалар -Name[km]=រូបតំណាង​តូច -Name[ko]=작은 아이콘 -Name[lt]=Maži ženkliukai -Name[mr]=लहान चिन्ह -Name[nb]=Små ikoner -Name[nds]=Lütt Lüttbiller -Name[nl]=Kleine pictogrammen -Name[pa]=ਛੋਟੇ ਆਈਕਾਨ -Name[pl]=Małe ikony -Name[pt]=Ícones Pequenos -Name[pt_BR]=Ícones pequenos -Name[ro]=Pictograme mici -Name[ru]=Маленькие значки -Name[sk]=Malé ikony -Name[sl]=Majhne ikone -Name[sr]=Мале иконе -Name[sr@ijekavian]=Мале иконе -Name[sr@ijekavianlatin]=Male ikone -Name[sr@latin]=Male ikone -Name[sv]=Små ikoner -Name[tr]=Küçük Simgeler -Name[uk]=Малі піктограми -Name[x-test]=xxSmall Iconsxx -Name[zh_CN]=小图标 -Name[zh_TW]=小圖示 -Comment=A window switcher layout using small icons to represent the window -Comment[bs]=Izgled prozora Switcher pomoću male ikone za predstavljanje prozora -Comment[ca]=Una disposició del commutador de finestres que utilitza icones petites per representar la finestra -Comment[ca@valencia]=Una disposició del commutador de finestres que utilitza icones petites per representar la finestra -Comment[cs]=Rozvržení přepínače oken používající malé ikony -Comment[da]=Et vinduesskifter-layout som bruger små ikoner til at repræsentere vinduet -Comment[de]=Ein Fensterwechsler-Layout, das kleine Symbole zur Darstellung der Fenster verwendet -Comment[el]=Μια διάταξη εναλλαγής παραθύρων με χρήση μικρών εικονιδίων που αναπαριστούν το παράθυρο -Comment[en_GB]=A window switcher layout using small icons to represent the window -Comment[es]=Un esquema de cambiador de ventanas que usa iconos pequeños para representar las ventanas -Comment[et]=Aknavahetaja paigutus väikeste, aknaid tähistavate ikoonidega -Comment[eu]=Leihoak irudikatzeko ikono txikiak erabiltzen dituen leiho-kommutadorearen diseinu bat -Comment[fi]=Ikkunanvalitsimen asettelu, jossa ikkunat esitetään pienillä kuvakkeilla -Comment[fr]=Une disposition de sélecteur de fenêtres utilisant de petites icônes pour représenter les fenêtres -Comment[gl]=Unha disposición do alternador de xanelas que usa iconas pequenas para representar a xanela -Comment[hu]=Egy ablakváltó elrendezés, amely kis ikonokat használ az ablak ábrázolásához -Comment[ia]=Un disposition de commutator de fenestra usante parve icones pro representar le fenestra -Comment[it]=Una disposizione dello scambiafinestre che usa icone piccole per rappresentare le finestre -Comment[kk]=Терезелерді шағын таңбашалармен белгілейтін терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​កម្មវិធី​ប្ដូរ​បង្អួច ដោយ​ប្រើ​រូបតំណាង​តូច ដើម្បី​បង្ហាញ​បង្អួច​ឡើង​វិញ -Comment[ko]=작은 아이콘으로 창을 나타내는 창 전환기 레이아웃 -Comment[lt]=Langų perjungimo išdėstymas naudojantis mažus ženkliukus reprezentuojančius langą -Comment[mr]=चौकटींचे प्रतिनिधित्व करणारी लहान चिन्हे वापरणारी एक चौकट बदल रचना -Comment[nb]=En vindusbytterutforming som bruker små ikoner for å representere vinduer -Comment[nds]=En Finsterwesseln mit lütt Lüttbiller för de Finstern -Comment[nl]=Een indeling van de vensterwisselaar die kleine pictogrammen gebruikt om vensters te representeren -Comment[pl]=Układ przełączania okien używający małych ikon do prezentowania okien -Comment[pt]=Uma disposição de mudança de janelas que usa ícones pequenos para representar a janela -Comment[pt_BR]=Um leiaute do seletor de janelas que usa ícones pequenos para representá-las -Comment[ro]=Aranjament pentru comutarea ferestrelor ce folosește pictograme mici pentru a reprezenta fereastra -Comment[ru]=Переключатель окон, показывающий маленькие значки окон -Comment[sk]=Rozloženie prepínača okien používajúce malé ikony na reprezentáciu okien -Comment[sl]=Razpored preklapljanja za predstavitev oken uporablja majhne ikone -Comment[sr]=Распоред мењача прозора који представља прозоре малим иконама -Comment[sr@ijekavian]=Распоред мењача прозора који представља прозоре малим иконама -Comment[sr@ijekavianlatin]=Raspored menjača prozora koji predstavlja prozore malim ikonama -Comment[sr@latin]=Raspored menjača prozora koji predstavlja prozore malim ikonama -Comment[sv]=En layout för fönsterbyte som använder små ikoner för att representera fönstret -Comment[tr]=Küçük simgeleri kullanan bir pencere değiştirme düzeni pencere temsilini gösteriyor -Comment[uk]=Компонування засобу перемикання вікон з малими піктограмами вікон -Comment[vi]=Một kiểu chuyển đổi cửa sổ sử dụng các biểu tượng để đại diện cho cửa sổ -Comment[x-test]=xxA window switcher layout using small icons to represent the windowxx -Comment[zh_CN]=一个用小图标表示窗口的窗口切换器布局 -Comment[zh_TW]=使用小圖示來表示視窗的視窗切換器佈局 -Icon=preferences-system-windows-switcher-small-icons - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=small_icons -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/clients/text/contents/ui/main.qml b/kwin/tabbox/qml/clients/text/contents/ui/main.qml deleted file mode 100644 index aac7387c..00000000 --- a/kwin/tabbox/qml/clients/text/contents/ui/main.qml +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: textTabBox - property int screenWidth : 0 - property int screenHeight : 0 - property string longestCaption: "" - property int optimalWidth: textListView.maxRowWidth - property int optimalHeight: textListView.rowHeight * textListView.count + background.topMargin + background.bottomMargin - property bool canStretchX: true - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) - height: Math.min(Math.max(screenHeight * 0.2, optimalHeight), screenHeight * 0.8) - focus: true - - property int textMargin: 2 - - onLongestCaptionChanged: { - textListView.maxRowWidth = textListView.calculateMaxRowWidth(); - } - - function setModel(model) { - textListView.model = model; - textListView.maxRowWidth = textListView.calculateMaxRowWidth(); - textListView.imageId++; - } - - function modelChanged() { - textListView.imageId++; - } - - PlasmaCore.Theme { - id: theme - } - - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - // delegate - Component { - id: listDelegate - Item { - id: delegateItem - width: textListView.width - height: textListView.rowHeight - Text { - id: captionItem - horizontalAlignment: Text.AlignHCenter - text: caption - color: theme.textColor - elide: Text.ElideMiddle - anchors { - left: parent.left - right: parent.right - top: parent.top - bottom: parent.bottom - topMargin: hoverItem.margins.top - rightMargin: hoverItem.margins.right - bottomMargin: hoverItem.margins.bottom - leftMargin: hoverItem.margins.left - } - } - MouseArea { - anchors.fill: parent - onClicked: { - textListView.currentIndex = index; - textListView.currentIndexChanged(textListView.currentIndex); - } - } - } - } - ListView { - function calculateMaxRowWidth() { - var width = 0; - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "' + textTabBox.longestCaption + '"\n' - + ' visible: false\n' - + '}', - textListView, "calculateMaxRowWidth"); - width = Math.max(textElement.width, width); - textElement.destroy(); - return width + hoverItem.margins.right + hoverItem.margins.left + background.leftMargin + background.rightMargin; - } - /** - * Calculates the height of one row based on the text height and icon size. - * @return Row height - **/ - function calcRowHeight() { - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "Some Text"\n' - + ' visible: false\n' - + '}', - textListView, "calcRowHeight"); - var height = textElement.height; - textElement.destroy(); - // icon size or two text elements and margins and hoverItem margins - return height + hoverItem.margins.top + hoverItem.margins.bottom; - } - signal currentIndexChanged(int index) - id: textListView - objectName: "listView" - // the maximum text width + icon item width (32 + 4 margin) + margins for hover item + margins for background - property int maxRowWidth: calculateMaxRowWidth() - property int rowHeight: calcRowHeight() - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - anchors { - fill: parent - topMargin: background.topMargin - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - clip: true - delegate: listDelegate - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: textListView.width - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Up) { - textListView.decrementCurrentIndex(); - textListView.currentIndexChanged(textListView.currentIndex); - } else if (event.key == Qt.Key_Down) { - textListView.incrementCurrentIndex(); - textListView.currentIndexChanged(textListView.currentIndex); - } - } -} diff --git a/kwin/tabbox/qml/clients/text/metadata.desktop b/kwin/tabbox/qml/clients/text/metadata.desktop deleted file mode 100644 index a9dcc800..00000000 --- a/kwin/tabbox/qml/clients/text/metadata.desktop +++ /dev/null @@ -1,103 +0,0 @@ -[Desktop Entry] -Name=Text Icons -Name[bs]=Tekst ikone -Name[ca]=Icones de text -Name[ca@valencia]=Icones de text -Name[cs]=Textové ikony -Name[da]=Tekstikoner -Name[de]=Text-Symbole -Name[el]=Εικονίδια κειμένου -Name[en_GB]=Text Icons -Name[es]=Iconos de texto -Name[et]=Tekstiikoonid -Name[eu]=Testu-ikonoak -Name[fi]=Tekstikuvakkeet -Name[fr]=Icônes textuelles -Name[ga]=Deilbhíní Téacs -Name[gl]=Iconas de texto -Name[he]=צבע הסמלים -Name[hu]=Szövegikonok -Name[ia]=Icones de texto -Name[kk]=Жазу таңбашалар -Name[km]=រូបតំណាង​អត្ថបទ -Name[ko]=텍스트 아이콘 -Name[lt]=Teksto ženkliukai -Name[mr]=पाठ्य चिन्ह -Name[nb]=Tekstikoner -Name[nds]=Text-Lüttbiller -Name[nl]=Tekstpictogrammen -Name[pa]=ਟੈਕਸਟ ਆਈਕਾਨ -Name[pl]=Ikony tekstowe -Name[pt]=Ícones de Texto -Name[pt_BR]=Texto dos ícones -Name[ro]=Pictograme textuale -Name[ru]=Текстовые значки -Name[sk]=Textové ikony -Name[sl]=Besedilo -Name[sr]=Текстуалне иконе -Name[sr@ijekavian]=Текстуалне иконе -Name[sr@ijekavianlatin]=Tekstualne ikone -Name[sr@latin]=Tekstualne ikone -Name[sv]=Textikoner -Name[tr]=Metin Simgeler -Name[uk]=Текстові піктограми -Name[x-test]=xxText Iconsxx -Name[zh_CN]=文本图标 -Name[zh_TW]=文字圖示 -Comment=A window switcher layout only showing window captions -Comment[bs]=Izgled prozora Switcher samo pokazuje prozora naslove -Comment[ca]=Una disposició del commutador de finestres que només mostra els títols de finestra -Comment[ca@valencia]=Una disposició del commutador de finestres que només mostra els títols de finestra -Comment[cs]=Rozvržení přepínače oken zobrazující pouze titulek okna -Comment[da]=Et vinduesskifter-layout som kun viser vinduestitler -Comment[de]=Ein Fensterwechsler-Layout, das nur die Titel der Fenster anzeigt -Comment[el]=Μια διάταξη εναλλαγής παραθύρων που εμφανίζει μόνο τίτλους παραθύρων -Comment[en_GB]=A window switcher layout only showing window captions -Comment[es]=Un esquema de cambiador de ventanas que solo muestra los títulos de las ventanas -Comment[et]=Aknavahetaja paigutus ainult aknatiitlite näitamisega -Comment[eu]=Leihoen tituluak soilik erakusten dituen leiho-kommutadorearen diseinu bat -Comment[fi]=Ikkunanvalitsimen asettelu, jossa näytetään vain ikkunoiden otsikot -Comment[fr]=Une disposition de sélecteur de fenêtres n'affichant que le titre des fenêtres -Comment[gl]=Unha disposición do alternador de xanelas que só mostra os títulos das xanelas -Comment[hu]=Egy ablakváltó elrendezés, amely csak az ablakfeliratokat jeleníti meg -Comment[ia]=Un disposition de commutator de fenestra monstrante solo legendas de fenestra -Comment[it]=Una disposizione dello scambiafinestre che mostra solo i titoli delle finestre -Comment[kk]=Тек атауын көрсететін терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​កម្មវិធី​បង្អួច បង្ហាញ​តែ​ចំណង​ជើង​បង្អួច -Comment[ko]=캡션만 보여 주는 창 전환기 -Comment[lt]=Langų perjungimo išdėstymas rodantis tik langų pavadinimus -Comment[mr]=फक्त चौकटींचे शिर्षक दर्शविणारी चौकट बदल रचना -Comment[nb]=En vindusbytterutforming som bare viser vindustekster -Comment[nds]=En Finsterwessel-Utsehn, dat bloots Finstertiteln wiest -Comment[nl]=Een indeling van de vensterwisselaar die alleen bijschriften van vensters toont -Comment[pl]=Układ przełączania okien pokazujący tylko tytuły okien -Comment[pt]=Uma disposição de mudança de janelas que só mostra os títulos das janelas -Comment[pt_BR]=Um leiaute do seletor de janelas que mostra apenas os títulos das janelas -Comment[ru]=Переключатель окон, показывающий только заголовки окон -Comment[sk]=Rozloženie prepínača okien zobrazujúce len popisky okien -Comment[sl]=Razpored preklapljanja med okni, ki prikazuje samo naslove oken -Comment[sr]=Распоред мењача прозора који приказује само наслове прозора -Comment[sr@ijekavian]=Распоред мењача прозора који приказује само наслове прозора -Comment[sr@ijekavianlatin]=Raspored menjača prozora koji prikazuje samo naslove prozora -Comment[sr@latin]=Raspored menjača prozora koji prikazuje samo naslove prozora -Comment[sv]=En layout för fönsterbyte som bara visar fönsterrubriker -Comment[tr]=Bir pencere değiştirme düzeni, sadece pencere başlıklarını gösteriyor -Comment[uk]=Компонування засобу перемикання вікон з показом лише підписів вікон -Comment[vi]=Một kiểu chuyển đổi cửa sổ chỉ hiển thị tiêu đề cửa sổ -Comment[x-test]=xxA window switcher layout only showing window captionsxx -Comment[zh_CN]=一个只显示窗口标题的窗口切换器布局 -Comment[zh_TW]=只顯示視窗標題的視窗切換器佈局 -Icon=preferences-system-windows-switcher-text - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=text -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/clients/thumbnails/contents/ui/main.qml b/kwin/tabbox/qml/clients/thumbnails/contents/ui/main.qml deleted file mode 100644 index 9cef0b44..00000000 --- a/kwin/tabbox/qml/clients/thumbnails/contents/ui/main.qml +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 -import org.kde.kwin 0.1 as KWin - -Item { - id: thumbnailTabBox - property int screenWidth : 1 - property int screenHeight : 1 - property real screenFactor: screenWidth/screenHeight - property int imagePathPrefix: (new Date()).getTime() - property int optimalWidth: (thumbnailListView.thumbnailWidth + hoverItem.margins.left + hoverItem.margins.right) * thumbnailListView.count + background.leftMargin + background.bottomMargin - property int optimalHeight: thumbnailListView.thumbnailWidth*(1.0/screenFactor) + hoverItem.margins.top + hoverItem.margins.bottom + background.topMargin + background.bottomMargin + 40 - property bool canStretchX: false - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.3, optimalWidth), screenWidth * 0.9) - height: Math.min(Math.max(screenHeight * 0.15, optimalHeight), screenHeight * 0.7) - clip: true - focus: true - - - function setModel(model) { - thumbnailListView.model = model; - thumbnailListView.imageId++; - } - - function modelChanged() { - thumbnailListView.imageId++; - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - PlasmaCore.Theme { - id: theme - } - - ListView { - signal currentIndexChanged(int index) - id: thumbnailListView - objectName: "listView" - orientation: ListView.Horizontal - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - property int thumbnailWidth: 300 - height: thumbnailWidth * (1.0/screenFactor) + hoverItem.margins.bottom + hoverItem.margins.top - spacing: 5 - highlightMoveDuration: 250 - width: Math.min(parent.width - (anchors.leftMargin + anchors.rightMargin) - (hoverItem.margins.left + hoverItem.margins.right), thumbnailWidth * count + 5 * (count - 1)) - anchors { - top: parent.top - topMargin: background.topMargin - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - horizontalCenter: parent.horizontalCenter - } - clip: true - delegate: Item { - property alias data: thumbnailItem.data - id: delegateItem - width: thumbnailListView.thumbnailWidth - height: thumbnailListView.thumbnailWidth*(1.0/screenFactor) - KWin.ThumbnailItem { - property variant data: model - id: thumbnailItem - wId: windowId - anchors { - fill: parent - leftMargin: hoverItem.margins.left - rightMargin: hoverItem.margins.right - topMargin: hoverItem.margins.top - bottomMargin: hoverItem.margins.bottom - } - } - MouseArea { - anchors.fill: parent - onClicked: { - thumbnailListView.currentIndex = index; - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } - } - } - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: thumbnailListView.thumbnailWidth - height: thumbnailListView.thumbnailWidth*(1.0/screenFactor) - } - boundsBehavior: Flickable.StopAtBounds - } - Item { - height: 40 - id: captionFrame - anchors { - top: thumbnailListView.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - topMargin: hoverItem.margins.bottom - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - Image { - id: iconItem - source: "image://client/" + thumbnailListView.currentIndex + "/" + thumbnailTabBox.imagePathPrefix + "-" + thumbnailListView.imageId - width: 32 - height: 32 - sourceSize { - width: 32 - height: 32 - } - anchors { - verticalCenter: parent.verticalCenter - right: textItem.left - rightMargin: 4 - } - } - Text { - function constrainWidth() { - if (textItem.width > textItem.maxWidth && textItem.width > 0 && textItem.maxWidth > 0) { - textItem.width = textItem.maxWidth; - } else { - textItem.width = undefined; - } - } - function calculateMaxWidth() { - textItem.maxWidth = thumbnailTabBox.width - captionFrame.anchors.leftMargin - captionFrame.anchors.rightMargin - iconItem.width * 2 - captionFrame.anchors.rightMargin; - } - id: textItem - property int maxWidth: 0 - text: thumbnailListView.currentItem ? thumbnailListView.currentItem.data.caption : "" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: theme.textColor - elide: Text.ElideMiddle - font { - bold: true - } - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - } - onTextChanged: textItem.constrainWidth() - Component.onCompleted: textItem.calculateMaxWidth() - Connections { - target: thumbnailTabBox - onWidthChanged: { - textItem.calculateMaxWidth(); - textItem.constrainWidth(); - } - } - } - } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Left) { - thumbnailListView.decrementCurrentIndex(); - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } else if (event.key == Qt.Key_Right) { - thumbnailListView.incrementCurrentIndex(); - thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex); - } - } -} diff --git a/kwin/tabbox/qml/clients/thumbnails/metadata.desktop b/kwin/tabbox/qml/clients/thumbnails/metadata.desktop deleted file mode 100644 index 32c6cb8e..00000000 --- a/kwin/tabbox/qml/clients/thumbnails/metadata.desktop +++ /dev/null @@ -1,103 +0,0 @@ -[Desktop Entry] -Name=Thumbnails -Name[bs]=Umanjeni prikazi -Name[ca]=Miniatures -Name[ca@valencia]=Miniatures -Name[cs]=Miniatury -Name[da]=Miniaturer -Name[de]=Vorschaubilder -Name[el]=Εικόνες επισκόπησης -Name[en_GB]=Thumbnails -Name[es]=Miniaturas -Name[et]=Pisipildid -Name[eu]=Koadro txikiak -Name[fi]=Pienoiskuvat -Name[fr]=Aperçus -Name[gl]=Miniaturas -Name[he]=תמונות ממוזערות -Name[hu]=Bélyegképek -Name[ia]=Miniaturas -Name[it]=Miniature -Name[kk]=Нобайлар -Name[km]=រូបភាព​តូចៗ -Name[ko]=미리 보기 그림 -Name[lt]=Miniatiūros -Name[mr]=लघुप्रतिमा -Name[nb]=Minibilder -Name[nds]=Vöransichten -Name[nl]=Miniaturen -Name[pa]=ਥੰਮਨੇਲ -Name[pl]=Miniatury -Name[pt]=Miniaturas -Name[pt_BR]=Miniaturas -Name[ro]=Miniaturi -Name[ru]=Миниатюры -Name[sk]=Miniatúry -Name[sl]=Sličice -Name[sr]=Сличице -Name[sr@ijekavian]=Сличице -Name[sr@ijekavianlatin]=Sličice -Name[sr@latin]=Sličice -Name[sv]=Miniatyrbilder -Name[tr]=Küçük Resimler -Name[uk]=Мініатюри -Name[x-test]=xxThumbnailsxx -Name[zh_CN]=缩略图 -Name[zh_TW]=縮圖 -Comment=A window switcher layout using live thumbnails -Comment[bs]=Izgled prozora Switcher pomoću žive sličice -Comment[ca]=Una disposició del commutador de finestres que utilitza miniatures animades -Comment[ca@valencia]=Una disposició del commutador de finestres que utilitza miniatures animades -Comment[cs]=Přepínač oken s živými náhledy -Comment[da]=Et vinduesskifter-layout som bruger aktive miniaturer -Comment[de]=Ein Fensterwechsler-Layout, das Live-Vorschauen verwendet -Comment[el]=Μια διάταξη εναλλαγής παραθύρων που χρησιμοποιεί ζωντανές εικόνες επισκόπησης -Comment[en_GB]=A window switcher layout using live thumbnails -Comment[es]=Un esquema de cambiador de ventanas que usa miniaturas en tiempo real -Comment[et]=Aknavahetaja paigutus reaalajas pisipiltidega -Comment[eu]=Denbora errealeko koadro txikiak erabiltzen dituen leiho-kommutadorearen diseinu bat -Comment[fi]=Ikkunanvalitsimen asettelu, joka käyttää pienoiskuvia -Comment[fr]=Une disposition de sélecteur de fenêtres utilisant des aperçus en temps réel -Comment[gl]=Unha disposición do alternador de xanelas que usa miniaturas ao vivo -Comment[hu]=Egy ablakváltó elrendezés, amely élő bélyegképeket használ -Comment[ia]=Un disposition de commutator de fenestra usante miniaturas vive -Comment[it]=Una disposizione dello scambiafinestre che usa miniature dinamiche -Comment[kk]="Тірі" нобайларын көрсететілін терезе ауыстырғышының қалыпы -Comment[km]=ប្លង់​កម្មវិធី​ប្ដូរ​បង្អួច ដោយ​ប្រើ​រូបភាព​តូចៗ​បន្ត​ផ្ទាល់ -Comment[ko]=현재 상태를 보여 주는 미리 보기 그림을 사용하는 창 전환기 -Comment[lt]=Langų perjungimo išdėstymas naudojant tikralaikes miniatiūras -Comment[mr]=जिवंत लघुप्रतिमा दर्शविणारी चौकट बदल रचना -Comment[nb]=En vindusbytterutforming som bruker sanntids minibilder -Comment[nds]=En Finsterwessel-Utsehn mit Finster-Vöransichten -Comment[nl]=Een indeling van de vensterwisselaar met levende miniaturen -Comment[pl]=Układ przełączania okien używający "żywych" miniatur -Comment[pt]=Uma disposição de mudança de janelas que usa miniaturas geradas na hora -Comment[pt_BR]=Um leiaute do seletor de janelas que usa miniaturas geradas na hora -Comment[ru]=Переключатель окон в виде «живых» миниатюр окон -Comment[sk]=Rozloženie prepínača okien používajúce živé miniatúry -Comment[sl]=Razpored preklapljanja med okni, ki uporablja žive sličice -Comment[sr]=Распоред мењача прозора са живим сличицама -Comment[sr@ijekavian]=Распоред мењача прозора са живим сличицама -Comment[sr@ijekavianlatin]=Raspored menjača prozora sa živim sličicama -Comment[sr@latin]=Raspored menjača prozora sa živim sličicama -Comment[sv]=En layout för fönsterbyte som använder direkta miniatyrbilder -Comment[tr]=Bir pencere değiştirme düzeni canlı küçük resimleri gösteriyor -Comment[uk]=Компонування засобу перемикання вікон з мініатюрами поточного стану вікон -Comment[vi]=Một kiểu chuyển đổi cửa sổ sử dụng các hình nhỏ của ứng dụng -Comment[x-test]=xxA window switcher layout using live thumbnailsxx -Comment[zh_CN]=一个显示实时窗口预览的窗口切换器布局 -Comment[zh_TW]=使用即時縮圖的視窗切換器佈局 -Icon=preferences-system-windows-switcher-thumbnails - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=thumbnails -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/WindowSwitcher -Type=Service diff --git a/kwin/tabbox/qml/desktops/informative/contents/ui/main.qml b/kwin/tabbox/qml/desktops/informative/contents/ui/main.qml deleted file mode 100644 index 0f43e37e..00000000 --- a/kwin/tabbox/qml/desktops/informative/contents/ui/main.qml +++ /dev/null @@ -1,234 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: desktopTabBox - property int screenWidth : 0 - property int screenHeight : 0 - property bool allDesktops: true - property string longestCaption: "" - property int optimalWidth: listView.maxRowWidth - property int optimalHeight: listView.rowHeight * listView.count + clientArea.height + 4 + background.topMargin + background.bottomMargin - property bool canStretchX: true - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) - height: Math.min(optimalHeight, screenHeight * 0.8) - - property int textMargin: 2 - - onLongestCaptionChanged: { - listView.maxRowWidth = listView.calculateMaxRowWidth(); - } - - function setModel(model) { - listView.model = model; - desktopClientModel.model = model; - desktopClientModel.imageId++; - listView.maxRowWidth = listView.calculateMaxRowWidth(); - } - - function modelChanged() { - listView.currentIndex = -1; - desktopClientModel.imageId++; - } - - PlasmaCore.Theme { - id: theme - } - - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - // delegate - Component { - id: listDelegate - Item { - id: delegateItem - width: listView.width - height: listView.rowHeight - QIconItem { - id: iconElement - icon: "user-desktop" - width: 32 - height: 32 - anchors { - topMargin: (listView.rowHeight - 32) / 2 - left: parent.left - top: parent.top - leftMargin: hoverItem.margins.left - } - } - Text { - id: captionItem - horizontalAlignment: Text.AlignHCenter - text: display - font.bold: true - color: theme.textColor - elide: Text.ElideMiddle - anchors { - left: iconElement.right - right: parent.right - top: parent.top - topMargin: desktopTabBox.textMargin + hoverItem.margins.top - rightMargin: hoverItem.margins.right - leftMargin: desktopTabBox.textMargin - } - } - MouseArea { - anchors.fill: parent - onClicked: { - listView.currentIndex = index; - listView.currentIndexChanged(listView.currentIndex); - } - } - } - } - ListView { - function calculateMaxRowWidth() { - var width = 0; - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "' + desktopTabBox.longestCaption + '"\n' - + ' font.bold: true\n' - + ' visible: false\n' - + '}', - listView, "calculateMaxRowWidth"); - width = Math.max(textElement.width, width); - textElement.destroy(); - return width + 32 + hoverItem.margins.right + hoverItem.margins.left + background.leftMargin + background.rightMargin; - } - /** - * Calculates the height of one row based on the text height and icon size. - * @return Row height - **/ - function calcRowHeight() { - var textElement = Qt.createQmlObject( - 'import QtQuick 1.0;' - + 'Text {\n' - + ' text: "Some Text"\n' - + ' font.bold: true\n' - + ' visible: false\n' - + '}', - listView, "calcRowHeight"); - var height = textElement.height; - textElement.destroy(); - // icon size or two text elements and margins and hoverItem margins - return Math.max(32, height + desktopTabBox.textMargin * 2 + hoverItem.margins.top + hoverItem.margins.bottom); - } - signal currentIndexChanged(int index) - id: listView - objectName: "listView" - // the maximum text width + icon item width (32 + 4 margin) + margins for hover item + margins for background - property int maxRowWidth: calculateMaxRowWidth() - property int rowHeight: calcRowHeight() - // used for image provider URL to trick Qt into reloading icons when the model changes - property int imageId: 0 - anchors { - top: parent.top - left: parent.left - right: parent.right - bottom: clientArea.top - topMargin: background.topMargin - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: clientArea.top - } - clip: true - delegate: listDelegate - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: listView.width - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - } - Component { - id: clientIconDelegate - Image { - sourceSize { - width: 16 - height: 16 - } - width: 16 - height: 16 - Component.onCompleted: { - source = "image://client/" + index + "/" + listView.currentIndex + "/" + desktopClientModel.imagePathPrefix + "-" + desktopClientModel.imageId; - } - } - } - Item { - id: clientArea - VisualDataModel { - property alias desktopIndex: listView.currentIndex - property int imagePathPrefix: (new Date()).getTime() - property int imageId: 0 - id: desktopClientModel - model: clientModel - delegate: clientIconDelegate - onDesktopIndexChanged: { - desktopClientModel.imageId++; - desktopClientModel.rootIndex = desktopClientModel.parentModelIndex(); - desktopClientModel.rootIndex = desktopClientModel.modelIndex(desktopClientModel.desktopIndex); - } - } - ListView { - id: iconsListView - model: desktopClientModel - clip: true - orientation: ListView.Horizontal - spacing: 4 - anchors { - fill: parent - leftMargin: 34 - } - } - height: 18 - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - topMargin: 2 - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - } -} diff --git a/kwin/tabbox/qml/desktops/informative/metadata.desktop b/kwin/tabbox/qml/desktops/informative/metadata.desktop deleted file mode 100644 index 6f05e438..00000000 --- a/kwin/tabbox/qml/desktops/informative/metadata.desktop +++ /dev/null @@ -1,103 +0,0 @@ -[Desktop Entry] -Name=Informative -Name[bs]=informativan -Name[ca]=Informativa -Name[ca@valencia]=Informativa -Name[cs]=Informativní -Name[da]=Informativt -Name[de]=Informativ -Name[el]=Ενημερωτικό -Name[en_GB]=Informative -Name[es]=Informativo -Name[et]=Informatiivne -Name[eu]=Informatzailea -Name[fi]=Informatiivinen -Name[fr]=Informatif -Name[ga]=Faisnéiseach -Name[gl]=Informativo -Name[he]=מלא מידע -Name[hu]=Informatív -Name[ia]=Informative -Name[it]=Informativo -Name[kk]=Мәліметті -Name[km]=ព័ត៌មាន -Name[ko]=정보성 -Name[lt]=Informatyvus -Name[mr]=माहितीजनक -Name[nb]=Informativ -Name[nds]=Informeren -Name[nl]=Informatief -Name[pa]=ਜਾਣਕਾਰੀ -Name[pl]=Informacyjny -Name[pt]=Informativa -Name[pt_BR]=Informativo -Name[ro]=Informativ -Name[ru]=Подробный -Name[sk]=Informatívne -Name[sl]=Podrobno -Name[sr]=Информативно -Name[sr@ijekavian]=Информативно -Name[sr@ijekavianlatin]=Informativno -Name[sr@latin]=Informativno -Name[sv]=Informativ -Name[tr]=Bilgilendirici -Name[uk]=Інформативне -Name[vi]=Thông tin -Name[x-test]=xxInformativexx -Name[zh_CN]=信息 -Name[zh_TW]=資訊提供 -Comment=An informative desktop switcher layout -Comment[bs]=Izgled informativnog prebacivača radnih površina -Comment[ca]=Una disposició informativa del commutador d'escriptoris -Comment[ca@valencia]=Una disposició informativa del commutador d'escriptoris -Comment[cs]=Informativní rozvržení přepínače oken -Comment[da]=Et informativt layout til skrivebordskift -Comment[de]=Ein ausführliches Fensterwechsler-Layout -Comment[el]=Ενημερωτική εναλλαγή επιφάνειας εργασίας -Comment[en_GB]=An informative desktop switcher layout -Comment[es]=Un esquema informativo del cambiador de escritorios -Comment[et]=Informatiivne töölauavahetaja paigutus -Comment[eu]=Mahaigain-aldatzaile diseinu informatibo bat -Comment[fi]=Informatiivinen työpöydänvalitsimen asettelu -Comment[fr]=Une disposition du sélecteur informative de bureaux -Comment[gl]=Unha disposición informativa do selector de escritorios -Comment[hu]=Egy informatív asztalváltó elrendezés -Comment[ia]=Un disposition de commutator de criptorio informative -Comment[it]=Una disposizione informativa dello scambiafinestre -Comment[kk]=Ақпаратты үстел ауыстырғышының қалыпы -Comment[ko]=정보가 있는 데스크톱 전환기 레이아웃 -Comment[lt]=Informatyvus darbastalio perjungimo išdėstymas -Comment[nb]=En kompakt utforming av skrivebordsbytter -Comment[nds]=En informeren Finsterwessel-Utsehn -Comment[nl]=Een informatieve indeling van de bureaubladwisselaar -Comment[pa]=ਜਾਣਕਾਰੀ ਭਰਪੂਰ ਡੈਸਕਟਾਪ ਸਵਿੱਚਰ ਲੇਆਉਟ -Comment[pl]=Informacyjny układ przełączania pulpitów -Comment[pt]=Uma disposição informativa de mudança de ecrãs -Comment[pt_BR]=Uma leiaute informativo do seletor de área de trabalho -Comment[ru]=Информативный переключатель рабочих столов -Comment[sk]=Informatívne rozloženie prepínača okien -Comment[sl]=Podroben razpored preklapljanja med okni -Comment[sr]=Информативни распоред мењача површи -Comment[sr@ijekavian]=Информативни распоред мењача површи -Comment[sr@ijekavianlatin]=Informativni raspored menjača površi -Comment[sr@latin]=Informativni raspored menjača površi -Comment[sv]=En informativ layout för skrivbordsbyte -Comment[tr]=Etkili bir pencere değiştirme düzeni -Comment[uk]=Інформативне компонування засобу перемикання стільниць -Comment[x-test]=xxAn informative desktop switcher layoutxx -Comment[zh_CN]=一个信息全面的桌面切换器布局 -Comment[zh_TW]=有較多資訊的桌面切換器佈局 -Icon=preferences-system-desktop-switcher-informative - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=informative -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/DesktopSwitcher -Type=Service diff --git a/kwin/tabbox/qml/desktops/previews/contents/ui/main.qml b/kwin/tabbox/qml/desktops/previews/contents/ui/main.qml deleted file mode 100644 index 65f76314..00000000 --- a/kwin/tabbox/qml/desktops/previews/contents/ui/main.qml +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 -import org.kde.kwin 0.1 as KWin - -Item { - id: desktopTabBox - property int screenWidth : 1 - property int screenHeight : 1 - property real screenFactor: screenWidth/screenHeight - property bool allDesktops: true - property int optimalWidth: (listView.thumbnailWidth + hoverItem.margins.left + hoverItem.margins.right) * listView.count + background.leftMargin + background.bottomMargin - property int optimalHeight: listView.thumbnailWidth*(1.0/screenFactor) + hoverItem.margins.top + hoverItem.margins.bottom + background.topMargin + background.bottomMargin + 40 - property bool canStretchX: true - property bool canStretchY: false - property string maskImagePath: background.maskImagePath - property double maskWidth: background.centerWidth - property double maskHeight: background.centerHeight - property int maskTopMargin: background.centerTopMargin - property int maskLeftMargin: background.centerLeftMargin - width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) - height: Math.min(optimalHeight, screenHeight * 0.8) - - property int textMargin: 2 - - function setModel(model) { - listView.model = model; - } - - function modelChanged() { - listView.currentIndex = -1; - } - - PlasmaCore.Theme { - id: theme - } - - // just to get the margin sizes - PlasmaCore.FrameSvgItem { - id: hoverItem - imagePath: "widgets/viewitem" - prefix: "hover" - visible: false - } - - ShadowedSvgItem { - id: background - anchors.fill: parent - } - - ListView { - signal currentIndexChanged(int index) - id: listView - property int thumbnailWidth: 600 - height: thumbnailWidth * (1.0/screenFactor) + hoverItem.margins.bottom + hoverItem.margins.top - width: Math.min(parent.width - (anchors.leftMargin + anchors.rightMargin) - (hoverItem.margins.left + hoverItem.margins.right), thumbnailWidth * count + 5 * (count - 1)) - spacing: 5 - orientation: ListView.Horizontal - objectName: "listView" - anchors { - top: parent.top - left: parent.left - right: parent.right - topMargin: background.topMargin - leftMargin: background.leftMargin - rightMargin: background.rightMargin - } - clip: true - highlight: PlasmaCore.FrameSvgItem { - id: highlightItem - imagePath: "widgets/viewitem" - prefix: "hover" - width: listView.thumbnailWidth - height: listView.thumbnailWidth*(1.0/screenFactor) - } - delegate: Item { - property alias data: thumbnailItem.data - width: listView.thumbnailWidth - height: listView.thumbnailWidth*(1.0/screenFactor) - KWin.DesktopThumbnailItem { - id: thumbnailItem - property variant data: model - clip: true - desktop: model.desktop - anchors { - fill: parent - leftMargin: hoverItem.margins.left - rightMargin: hoverItem.margins.right - topMargin: hoverItem.margins.top - bottomMargin: hoverItem.margins.bottom - } - } - MouseArea { - anchors.fill: parent - onClicked: { - listView.currentIndex = index; - listView.currentIndexChanged(listView.currentIndex); - } - } - } - highlightMoveDuration: 250 - boundsBehavior: Flickable.StopAtBounds - } - Item { - height: 40 - id: captionFrame - anchors { - top: listView.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - topMargin: hoverItem.margins.bottom - leftMargin: background.leftMargin - rightMargin: background.rightMargin - bottomMargin: background.bottomMargin - } - Text { - function constrainWidth() { - if (textItem.width > textItem.maxWidth && textItem.width > 0 && textItem.maxWidth > 0) { - textItem.width = textItem.maxWidth; - } else { - textItem.width = undefined; - } - } - function calculateMaxWidth() { - textItem.maxWidth = desktopTabBox.width - captionFrame.anchors.leftMargin - captionFrame.anchors.rightMargin - - captionFrame.anchors.rightMargin; - } - id: textItem - property int maxWidth: 0 - text: listView.currentItem ? listView.currentItem.data.caption : "" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: theme.textColor - elide: Text.ElideMiddle - font { - bold: true - } - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - } - onTextChanged: textItem.constrainWidth() - Component.onCompleted: textItem.calculateMaxWidth() - Connections { - target: desktopTabBox - onWidthChanged: { - textItem.calculateMaxWidth(); - textItem.constrainWidth(); - } - } - } - } -} diff --git a/kwin/tabbox/qml/desktops/previews/metadata.desktop b/kwin/tabbox/qml/desktops/previews/metadata.desktop deleted file mode 100644 index 5ad30d2b..00000000 --- a/kwin/tabbox/qml/desktops/previews/metadata.desktop +++ /dev/null @@ -1,98 +0,0 @@ -[Desktop Entry] -Name=Previews -Name[bs]=Pregledi -Name[ca]=Vistes prèvies -Name[ca@valencia]=Vistes prèvies -Name[cs]=Náhledy -Name[da]=Forhåndsvisninger -Name[de]=Vorschauen -Name[el]=Προεπισκοπήσεις -Name[en_GB]=Previews -Name[es]=Vistas previas -Name[et]=Eelvaatlused -Name[eu]=Aurrebistak -Name[fi]=Esikatselut -Name[fr]=Aperçus -Name[gl]=Vistas previas -Name[hu]=Előnézetek -Name[ia]=Vistas preliminar -Name[it]=Anteprima -Name[kk]=Алдын-ала қарау -Name[ko]=미리 보기 -Name[lt]=Peržiūros -Name[nb]=Forhåndsvisninger -Name[nds]=Vöransichten -Name[nl]=Voorbeelden -Name[pa]=ਝਲਕ -Name[pl]=Podglądy -Name[pt]=Antevisões -Name[pt_BR]=Visualizações -Name[ro]=Previzualizări -Name[ru]=Миниатюры -Name[sk]=Náhľady -Name[sl]=Predogledi -Name[sr]=Прегледи -Name[sr@ijekavian]=Прегледи -Name[sr@ijekavianlatin]=Pregledi -Name[sr@latin]=Pregledi -Name[sv]=Förhandsgranskningar -Name[tr]=Önizlemeler -Name[uk]=Ескізи -Name[x-test]=xxPreviewsxx -Name[zh_CN]=预览 -Name[zh_TW]=預覽 -Comment=A desktop switcher layout with previews of the desktops -Comment[bs]=Raspored preklapanja radnih površina s pregledima radnih površina -Comment[ca]=Una disposició del commutador d'escriptori amb vistes prèvies dels escriptoris -Comment[ca@valencia]=Una disposició del commutador d'escriptori amb vistes prèvies dels escriptoris -Comment[cs]=Přepínač oken s náhledy ploch -Comment[da]=Et layout til skrivebordsskift med forhåndsvisning af skrivebordene -Comment[de]=Ein Arbeitsflächenwechsler mit Vorschauen der Arbeitsflächen -Comment[el]=Εναλλαγή επιφάνειας εργασίας με προεπισκοπήσεις των επιφανειών -Comment[en_GB]=A desktop switcher layout with previews of the desktops -Comment[es]=Un esquema del cambiador de escritorios con vistas previas de los escritorios -Comment[et]=Töölauavahetaja paigutus töölaudade eelvaatlustega -Comment[eu]=Mahaigainen aurrebistak dituen mahaigain-aldatzaile diseinu bat -Comment[fi]=Työpöydänvalitsimen asettelu, jossa on esikatselut työpöydistä -Comment[fr]=Une disposition de sélecteur de bureaux avec des aperçus de bureaux -Comment[gl]=Unha disposición do selector de escritorios con vistas previas deles -Comment[hu]=Egy asztalváltó elrendezés az asztalok előnézetével -Comment[ia]=Un disposition de commutator de scriptorio con vistas preliminar de scriptorios -Comment[it]=Una disposizione con anteprima dello scambiafinestre -Comment[kk]=Үстелдер нобайларын көрсететін үстел ауыстырғышының қалыпы -Comment[ko]=데스크톱 미리 보기를 제공하는 데스크톱 전환기 레이아웃 -Comment[lt]=Darbastalio perjungimo išdėstymas su darbastalių peržiūromis -Comment[nb]=Utforming av KWin skrivebordsbytter med forhåndsvisning av skrivebordene -Comment[nds]=En Schriefdischwessel-Utsehn mit Vöransichten vun de Schriefdischen -Comment[nl]=Een indeling van bureaubladwisselaar met voorbeelden op de bureaubladen -Comment[pa]=ਡੈਸਕਟਾਪਾਂ ਦੀ ਝਲਕ ਨਾਲ ਡੈਸਕਟਾਪ ਬਦਲਣ ਵਾਲਾ ਲੇਆਉਟ -Comment[pl]=Układ przełączania pulpitów z podglądami pulpitów -Comment[pt]=Uma disposição de mudança de ecrã com antevisões dos mesmos -Comment[pt_BR]=Um leiaute do seletor de área de trabalho com visualizações -Comment[ru]=Переключатель с миниатюрами рабочих столов -Comment[sk]=Rozloženie prepínača plôch s náhľadmi týchto plôch -Comment[sl]=Razpored preklapljanja med namizji s predogledi namizij -Comment[sr]=Распоред мењача површи са њиховим прегледима -Comment[sr@ijekavian]=Распоред мењача површи са њиховим прегледима -Comment[sr@ijekavianlatin]=Raspored menjača površi sa njihovim pregledima -Comment[sr@latin]=Raspored menjača površi sa njihovim pregledima -Comment[sv]=En layout för skrivbordsbyte med förhandsgranskningar av skrivborden -Comment[tr]=Masaüstlerinin önizlemeleri ile bir masaüstü değiştirici düzeni -Comment[uk]=Компонування перемикача стільниць з ескізами стільниць -Comment[x-test]=xxA desktop switcher layout with previews of the desktopsxx -Comment[zh_CN]=带桌面预览的切换布局 -Comment[zh_TW]=有預覽的桌面切換器佈局 -Icon=preferences-system-desktop-switcher-previews - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml - -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=previews -X-KDE-PluginInfo-Version=1.0 - -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-ServiceTypes=KWin/DesktopSwitcher -Type=Service diff --git a/kwin/tabbox/qml/tabbox.qml b/kwin/tabbox/qml/tabbox.qml deleted file mode 100644 index 9fccc0bd..00000000 --- a/kwin/tabbox/qml/tabbox.qml +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.0 - -Loader { - id: loader - focus: true - property int screenWidth : 0 - property int screenHeight : 0 - property bool allDesktops: true - property string longestCaption: "" - property string maskImagePath: item && item.maskImagePath != undefined ? item.maskImagePath : "" - property double maskWidth: item && item.maskWidth != undefined ? item.maskWidth : 0 - property double maskHeight: item && item.maskHeight != undefined ? item.maskHeight : 0 - property int maskTopMargin: item && item.maskTopMargin != undefined ? item.maskTopMargin : 0 - property int maskLeftMargin: item && item.maskLeftMargin != undefined ? item.maskLeftMargin : 0 - onLoaded: { - if (item.screenWidth != undefined) { - item.screenWidth = screenWidth; - } - if (item.screenHeight != undefined) { - item.screenHeight = screenHeight; - } - if (item.allDesktops != undefined) { - item.allDesktops = allDesktops; - } - if (item.longestCaption != undefined) { - item.longestCaption = longestCaption; - } - if (item.setModel) { - item.setModel(clientModel); - } - } - onScreenWidthChanged: { - if (item && item.screenWidth != undefined) { - item.screenWidth = screenWidth; - } - } - onScreenHeightChanged: { - if (item && item.screenHeight != undefined) { - item.screenHeight = screenHeight; - } - } - onAllDesktopsChanged: { - if (item && item.allDesktops != undefined) { - item.allDesktops= allDesktops; - } - } - onLongestCaptionChanged: { - if (item && item.longestCaption != undefined) { - item.longestCaption = longestCaption; - } - } - Connections { - target: clientModel - onModelReset: { - if (item && item.modelChanged) { - item.modelChanged(); - } - } - } -} diff --git a/kwin/tabbox/tabbox.cpp b/kwin/tabbox/tabbox.cpp deleted file mode 100644 index 22ca21ff..00000000 --- a/kwin/tabbox/tabbox.cpp +++ /dev/null @@ -1,1582 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 1999, 2000 Matthias Ettrich -Copyright (C) 2003 Lubos Lunak -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -// own -#include "tabbox.h" -// tabbox -#include "tabbox/clientmodel.h" -#include "tabbox/desktopmodel.h" -#include "tabbox/tabboxconfig.h" -#include "tabbox/desktopchain.h" -// kwin -#include "client.h" -#include "effects.h" -#include "focuschain.h" -#ifdef KWIN_BUILD_SCREENEDGES -#include "screenedge.h" -#endif -#include "screens.h" -#include "unmanaged.h" -#include "virtualdesktops.h" -#include "workspace.h" -// Qt -#include -#include -#include -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -// X11 -#include -#include -#include - -// specify externals before namespace - -namespace KWin -{ - -namespace TabBox -{ - -TabBoxHandlerImpl::TabBoxHandlerImpl(TabBox* tabBox) - : TabBoxHandler() - , m_tabBox(tabBox) - , m_desktopFocusChain(new DesktopChainManager(this)) -{ - // connects for DesktopFocusChainManager - VirtualDesktopManager *vds = VirtualDesktopManager::self(); - connect(vds, SIGNAL(countChanged(uint,uint)), m_desktopFocusChain, SLOT(resize(uint,uint))); - connect(vds, SIGNAL(currentChanged(uint,uint)), m_desktopFocusChain, SLOT(addDesktop(uint,uint))); -} - -TabBoxHandlerImpl::~TabBoxHandlerImpl() -{ -} - -int TabBoxHandlerImpl::activeScreen() const -{ - return screens()->current(); -} - -int TabBoxHandlerImpl::currentDesktop() const -{ - return VirtualDesktopManager::self()->current(); -} - -QString TabBoxHandlerImpl::desktopName(TabBoxClient* client) const -{ - if (TabBoxClientImpl* c = static_cast< TabBoxClientImpl* >(client)) { - if (!c->client()->isOnAllDesktops()) - return VirtualDesktopManager::self()->name(c->client()->desktop()); - } - return VirtualDesktopManager::self()->name(VirtualDesktopManager::self()->current()); -} - -QString TabBoxHandlerImpl::desktopName(int desktop) const -{ - return VirtualDesktopManager::self()->name(desktop); -} - -QWeakPointer TabBoxHandlerImpl::nextClientFocusChain(TabBoxClient* client) const -{ - if (TabBoxClientImpl* c = static_cast< TabBoxClientImpl* >(client)) { - Client* next = FocusChain::self()->nextMostRecentlyUsed(c->client()); - if (next) - return next->tabBoxClient(); - } - return QWeakPointer(); -} - -QWeakPointer< TabBoxClient > TabBoxHandlerImpl::firstClientFocusChain() const -{ - if (Client *c = FocusChain::self()->firstMostRecentlyUsed()) { - return QWeakPointer(c->tabBoxClient()); - } else { - return QWeakPointer(); - } -} - -bool TabBoxHandlerImpl::isInFocusChain(TabBoxClient *client) const -{ - if (TabBoxClientImpl *c = static_cast(client)) { - return FocusChain::self()->contains(c->client()); - } - return false; -} - -int TabBoxHandlerImpl::nextDesktopFocusChain(int desktop) const -{ - return m_desktopFocusChain->next(desktop); -} - -int TabBoxHandlerImpl::numberOfDesktops() const -{ - return VirtualDesktopManager::self()->count(); -} - -QWeakPointer TabBoxHandlerImpl::activeClient() const -{ - if (Workspace::self()->activeClient()) - return Workspace::self()->activeClient()->tabBoxClient(); - else - return QWeakPointer(); -} - -bool TabBoxHandlerImpl::checkDesktop(TabBoxClient* client, int desktop) const -{ - Client* current = (static_cast< TabBoxClientImpl* >(client))->client(); - - switch (config().clientDesktopMode()) { - case TabBoxConfig::AllDesktopsClients: - return true; - case TabBoxConfig::ExcludeCurrentDesktopClients: - return !current->isOnDesktop(desktop); - default: // TabBoxConfig::OnlyCurrentDesktopClients - return current->isOnDesktop(desktop); - } -} - -bool TabBoxHandlerImpl::checkApplications(TabBoxClient* client) const -{ - Client* current = (static_cast< TabBoxClientImpl* >(client))->client(); - TabBoxClientImpl* c; - QListIterator< QWeakPointer > i(clientList()); - - switch (config().clientApplicationsMode()) { - case TabBoxConfig::OneWindowPerApplication: - // check if the list already contains an entry of this application - while (i.hasNext()) { - QSharedPointer client = i.next().toStrongRef(); - if (!client) { - continue; - } - if ((c = dynamic_cast< TabBoxClientImpl* >(client.data()))) { - if (c->client()->resourceClass() == current->resourceClass()) { - return false; - } - } - } - return true; - case TabBoxConfig::AllWindowsCurrentApplication: { - QSharedPointer pointer = tabBox->activeClient().toStrongRef(); - if (!pointer) { - return false; - } - if ((c = dynamic_cast< TabBoxClientImpl* >(pointer.data()))) { - if (c->client()->resourceClass() == current->resourceClass()) { - return true; - } - } - return false; - } - default: // TabBoxConfig::AllWindowsAllApplications - return true; - } -} - -bool TabBoxHandlerImpl::checkMinimized(TabBoxClient* client) const -{ - switch (config().clientMinimizedMode()) { - case TabBoxConfig::ExcludeMinimizedClients: - return !client->isMinimized(); - case TabBoxConfig::OnlyMinimizedClients: - return client->isMinimized(); - default: // TabBoxConfig::IgnoreMinimizedStatus - return true; - } -} - -bool TabBoxHandlerImpl::checkMultiScreen(TabBoxClient* client) const -{ - Client* current = (static_cast< TabBoxClientImpl* >(client))->client(); - - switch (config().clientMultiScreenMode()) { - case TabBoxConfig::IgnoreMultiScreen: - return true; - case TabBoxConfig::ExcludeCurrentScreenClients: - return current->screen() != screens()->current(); - default: // TabBoxConfig::OnlyCurrentScreenClients - return current->screen() == screens()->current(); - } -} - -QWeakPointer TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop) const -{ - if (!client) { - return QWeakPointer(); - } - Client* ret = NULL; - Client* current = (static_cast< TabBoxClientImpl* >(client))->client(); - - bool addClient = checkDesktop(client, desktop) - && checkApplications(client) - && checkMinimized(client) - && checkMultiScreen(client); - addClient = addClient && current->wantsTabFocus() && !current->skipSwitcher(); - if (addClient) { - // don't add windows that have modal dialogs - Client* modal = current->findModal(); - if (modal == NULL || modal == current) - ret = current; - else if (!clientList().contains(modal->tabBoxClient())) - ret = modal; - else { - // nothing - } - } - if (ret) - return ret->tabBoxClient(); - else - return QWeakPointer(); -} - -TabBoxClientList TabBoxHandlerImpl::stackingOrder() const -{ - ToplevelList stacking = Workspace::self()->stackingOrder(); - TabBoxClientList ret; - foreach (Toplevel *toplevel, stacking) { - if (Client *client = qobject_cast(toplevel)) { - ret.append(client->tabBoxClient()); - } - } - return ret; -} - -bool TabBoxHandlerImpl::isKWinCompositing() const { - return Workspace::self()->compositing(); -} - -void TabBoxHandlerImpl::raiseClient(TabBoxClient* c) const -{ - Workspace::self()->raiseClient(static_cast(c)->client()); -} - -void TabBoxHandlerImpl::restack(TabBoxClient *c, TabBoxClient *under) -{ - Workspace::self()->restack(static_cast(c)->client(), - static_cast(under)->client()); -} - -void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, WId tabbox, bool b) const -{ - Client *cl = static_cast(c)->client(); - cl->elevate(b); - if (Unmanaged *w = Workspace::self()->findUnmanaged(WindowMatchPredicate(tabbox))) - w->elevate(b); -} - - -QWeakPointer TabBoxHandlerImpl::desktopClient() const -{ - foreach (Toplevel *toplevel, Workspace::self()->stackingOrder()) { - Client *client = qobject_cast(toplevel); - if (client && client->isDesktop() && client->isOnCurrentDesktop() && client->screen() == screens()->current()) { - return client->tabBoxClient(); - } - } - return QWeakPointer(); -} - -void TabBoxHandlerImpl::activateAndClose() -{ - m_tabBox->accept(); -} - -/********************************************************* -* TabBoxClientImpl -*********************************************************/ - -TabBoxClientImpl::TabBoxClientImpl(Client *client) - : TabBoxClient() - , m_client(client) -{ -} - -TabBoxClientImpl::~TabBoxClientImpl() -{ -} - -QString TabBoxClientImpl::caption() const -{ - if (m_client->isDesktop()) - return i18nc("Special entry in alt+tab list for minimizing all windows", - "Show Desktop"); - return m_client->caption(); -} - -QPixmap TabBoxClientImpl::icon(const QSize& size) const -{ - if (m_client->isDesktop()) { - return KIcon("user-desktop").pixmap(size); - } - return m_client->icon(size); -} - -WId TabBoxClientImpl::window() const -{ - return m_client->window(); -} - -bool TabBoxClientImpl::isMinimized() const -{ - return m_client->isMinimized(); -} - -int TabBoxClientImpl::x() const -{ - return m_client->x(); -} - -int TabBoxClientImpl::y() const -{ - return m_client->y(); -} - -int TabBoxClientImpl::width() const -{ - return m_client->width(); -} - -int TabBoxClientImpl::height() const -{ - return m_client->height(); -} - -bool TabBoxClientImpl::isCloseable() const -{ - return m_client->isCloseable(); -} - -void TabBoxClientImpl::close() -{ - m_client->closeWindow(); -} - -bool TabBoxClientImpl::isFirstInTabBox() const -{ - return m_client->isFirstInTabBox(); -} - -/********************************************************* -* TabBox -*********************************************************/ -TabBox *TabBox::s_self = NULL; - -TabBox *TabBox::create(QObject *parent) -{ - Q_ASSERT(!s_self); - s_self = new TabBox(parent); - return s_self; -} - -TabBox::TabBox(QObject *parent) - : QObject(parent) - , m_displayRefcount(0) - , m_desktopGrab(false) - , m_tabGrab(false) - , m_noModifierGrab(false) - , m_forcedGlobalMouseGrab(false) - , m_ready(false) -{ - m_isShown = false; - m_defaultConfig = TabBoxConfig(); - m_defaultConfig.setTabBoxMode(TabBoxConfig::ClientTabBox); - m_defaultConfig.setClientDesktopMode(TabBoxConfig::OnlyCurrentDesktopClients); - m_defaultConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsAllApplications); - m_defaultConfig.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus); - m_defaultConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); - m_defaultConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); - m_defaultConfig.setClientSwitchingMode(TabBoxConfig::FocusChainSwitching); - - m_alternativeConfig = TabBoxConfig(); - m_alternativeConfig.setTabBoxMode(TabBoxConfig::ClientTabBox); - m_alternativeConfig.setClientDesktopMode(TabBoxConfig::AllDesktopsClients); - m_alternativeConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsAllApplications); - m_alternativeConfig.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus); - m_alternativeConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); - m_alternativeConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); - m_alternativeConfig.setClientSwitchingMode(TabBoxConfig::FocusChainSwitching); - - m_defaultCurrentApplicationConfig = m_defaultConfig; - m_defaultCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication); - - m_alternativeCurrentApplicationConfig = m_alternativeConfig; - m_alternativeCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication); - - m_desktopConfig = TabBoxConfig(); - m_desktopConfig.setTabBoxMode(TabBoxConfig::DesktopTabBox); - m_desktopConfig.setShowTabBox(true); - m_desktopConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); - m_desktopConfig.setDesktopSwitchingMode(TabBoxConfig::MostRecentlyUsedDesktopSwitching); - - m_desktopListConfig = TabBoxConfig(); - m_desktopListConfig.setTabBoxMode(TabBoxConfig::DesktopTabBox); - m_desktopListConfig.setShowTabBox(true); - m_desktopListConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); - m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching); - m_tabBox = new TabBoxHandlerImpl(this); - QTimer::singleShot(0, this, SLOT(handlerReady())); - connect(m_tabBox, SIGNAL(selectedIndexChanged()), SIGNAL(itemSelected())); - - m_tabBoxMode = TabBoxDesktopMode; // init variables - connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show())); - connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure())); - QDBusConnection::sessionBus().registerObject("/TabBox", this, QDBusConnection::ExportScriptableContents); -} - -TabBox::~TabBox() -{ - QDBusConnection::sessionBus().unregisterObject("/TabBox"); - s_self = NULL; -} - -void TabBox::handlerReady() -{ - m_tabBox->setConfig(m_defaultConfig); - reconfigure(); - m_ready = true; -} - -void TabBox::initShortcuts(KActionCollection* keys) -{ - KAction *a = NULL; - - // The setGlobalShortcut(shortcut); shortcut = a->globalShortcut() - // sequence is necessary in the case where the user has defined a - // custom key binding which KAction::setGlobalShortcut autoloads. - #define KEY( name, key, fnSlot, shortcut, shortcutSlot ) \ - a = keys->addAction( name ); \ - a->setText( i18n(name) ); \ - shortcut = KShortcut(key); \ - qobject_cast( a )->setGlobalShortcut(shortcut); \ - shortcut = a->globalShortcut(); \ - connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); \ - connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), SLOT(shortcutSlot)); - - KEY(I18N_NOOP("Walk Through Windows"), Qt::ALT + Qt::Key_Tab, slotWalkThroughWindows(), m_cutWalkThroughWindows, slotWalkThroughWindowsKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows (Reverse)"), Qt::ALT + Qt::SHIFT + Qt::Key_Backtab, slotWalkBackThroughWindows(), m_cutWalkThroughWindowsReverse, slotWalkBackThroughWindowsKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows Alternative"), 0, slotWalkThroughWindowsAlternative(), m_cutWalkThroughWindowsAlternative, slotWalkThroughWindowsAlternativeKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows Alternative (Reverse)"), 0, slotWalkBackThroughWindowsAlternative(), m_cutWalkThroughWindowsAlternativeReverse, slotWalkBackThroughWindowsAlternativeKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows of Current Application"), Qt::ALT + Qt::Key_QuoteLeft, slotWalkThroughCurrentAppWindows(), m_cutWalkThroughCurrentAppWindows, slotWalkThroughCurrentAppWindowsKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows of Current Application (Reverse)"), Qt::ALT + Qt::Key_AsciiTilde, slotWalkBackThroughCurrentAppWindows(), m_cutWalkThroughCurrentAppWindowsReverse, slotWalkBackThroughCurrentAppWindowsKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows of Current Application Alternative"), 0, slotWalkThroughCurrentAppWindowsAlternative(), m_cutWalkThroughCurrentAppWindowsAlternative, slotWalkThroughCurrentAppWindowsAlternativeKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Windows of Current Application Alternative (Reverse)"), 0, slotWalkBackThroughCurrentAppWindowsAlternative(), m_cutWalkThroughCurrentAppWindowsAlternativeReverse, slotWalkBackThroughCurrentAppWindowsAlternativeKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Desktops"), 0, slotWalkThroughDesktops(), m_cutWalkThroughDesktops, slotWalkThroughDesktopsKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Desktops (Reverse)"), 0, slotWalkBackThroughDesktops(), m_cutWalkThroughDesktopsReverse, slotWalkBackThroughDesktopsKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Desktop List"), 0, slotWalkThroughDesktopList(), m_cutWalkThroughDesktopList, slotWalkThroughDesktopListKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Desktop List (Reverse)"), 0, slotWalkBackThroughDesktopList(), m_cutWalkThroughDesktopListReverse, slotWalkBackThroughDesktopListKeyChanged(QKeySequence)) - #undef KEY -} - -/*! - Sets the current mode to \a mode, either TabBoxDesktopListMode or TabBoxWindowsMode - - \sa mode() - */ -void TabBox::setMode(TabBoxMode mode) -{ - m_tabBoxMode = mode; - switch(mode) { - case TabBoxWindowsMode: - m_tabBox->setConfig(m_defaultConfig); - break; - case TabBoxWindowsAlternativeMode: - m_tabBox->setConfig(m_alternativeConfig); - break; - case TabBoxCurrentAppWindowsMode: - m_tabBox->setConfig(m_defaultCurrentApplicationConfig); - break; - case TabBoxCurrentAppWindowsAlternativeMode: - m_tabBox->setConfig(m_alternativeCurrentApplicationConfig); - break; - case TabBoxDesktopMode: - m_tabBox->setConfig(m_desktopConfig); - break; - case TabBoxDesktopListMode: - m_tabBox->setConfig(m_desktopListConfig); - break; - } -} - -/*! - Resets the tab box to display the active client in TabBoxWindowsMode, or the - current desktop in TabBoxDesktopListMode - */ -void TabBox::reset(bool partial_reset) -{ - switch(m_tabBox->config().tabBoxMode()) { - case TabBoxConfig::ClientTabBox: - m_tabBox->createModel(partial_reset); - if (!partial_reset) { - if (Workspace::self()->activeClient()) - setCurrentClient(Workspace::self()->activeClient()); - // it's possible that the active client is not part of the model - // in that case the index is invalid - if (!m_tabBox->currentIndex().isValid()) - setCurrentIndex(m_tabBox->first()); - } else { - if (!m_tabBox->currentIndex().isValid() || !m_tabBox->client(m_tabBox->currentIndex())) - setCurrentIndex(m_tabBox->first()); - } - break; - case TabBoxConfig::DesktopTabBox: - m_tabBox->createModel(); - - if (!partial_reset) - setCurrentDesktop(VirtualDesktopManager::self()->current()); - break; - } - - emit tabBoxUpdated(); -} - -/*! - Shows the next or previous item, depending on \a next - */ -void TabBox::nextPrev(bool next) -{ - setCurrentIndex(m_tabBox->nextPrev(next), false); - emit tabBoxUpdated(); -} - -/*! - Returns the currently displayed client ( only works in TabBoxWindowsMode ). - Returns 0 if no client is displayed. - */ -Client* TabBox::currentClient() -{ - if (TabBoxClientImpl* client = static_cast< TabBoxClientImpl* >(m_tabBox->client(m_tabBox->currentIndex()))) { - if (!Workspace::self()->hasClient(client->client())) - return NULL; - return client->client(); - } else - return NULL; -} - -/*! - Returns the list of clients potentially displayed ( only works in - TabBoxWindowsMode ). - Returns an empty list if no clients are available. - */ -ClientList TabBox::currentClientList() -{ - TabBoxClientList list = m_tabBox->clientList(); - ClientList ret; - foreach (const QWeakPointer &clientPointer, list) { - QSharedPointer client = clientPointer.toStrongRef(); - if (!client) - continue; - if (const TabBoxClientImpl* c = static_cast< const TabBoxClientImpl* >(client.data())) - ret.append(c->client()); - } - return ret; -} - -/*! - Returns the currently displayed virtual desktop ( only works in - TabBoxDesktopListMode ) - Returns -1 if no desktop is displayed. - */ -int TabBox::currentDesktop() -{ - return m_tabBox->desktop(m_tabBox->currentIndex()); -} - -/*! - Returns the list of desktops potentially displayed ( only works in - TabBoxDesktopListMode ) - Returns an empty list if no are available. - */ -QList< int > TabBox::currentDesktopList() -{ - return m_tabBox->desktopList(); -} - -/*! - Change the currently selected client, and notify the effects. - - \sa setCurrentDesktop() - */ -void TabBox::setCurrentClient(Client* newClient) -{ - setCurrentIndex(m_tabBox->index(newClient->tabBoxClient())); -} - -/*! - Change the currently selected desktop, and notify the effects. - - \sa setCurrentClient() - */ -void TabBox::setCurrentDesktop(int newDesktop) -{ - setCurrentIndex(m_tabBox->desktopIndex(newDesktop)); -} - -void TabBox::setCurrentIndex(QModelIndex index, bool notifyEffects) -{ - if (!index.isValid()) - return; - m_tabBox->setCurrentIndex(index); - if (notifyEffects) { - emit tabBoxUpdated(); - } -} - -/*! - Notify effects that the tab box is being shown, and only display the - default tab box QFrame if no effect has referenced the tab box. -*/ -void TabBox::show() -{ - emit tabBoxAdded(m_tabBoxMode); - if (isDisplayed()) { - m_isShown = false; - return; - } - reference(); - m_isShown = true; - m_tabBox->show(); -} - -/*! - Notify effects that the tab box is being hidden. -*/ -void TabBox::hide(bool abort) -{ - m_delayedShowTimer.stop(); - if (m_isShown) { - m_isShown = false; - unreference(); - } - emit tabBoxClosed(); - if (isDisplayed()) - kDebug(1212) << "Tab box was not properly closed by an effect"; - m_tabBox->hide(abort); - QApplication::syncX(); - XEvent otherEvent; - while (XCheckTypedEvent(display(), EnterNotify, &otherEvent)) - ; -} - -void TabBox::reconfigure() -{ - KSharedConfigPtr c(KGlobal::config()); - KConfigGroup config = c->group("TabBox"); - - loadConfig(c->group("TabBox"), m_defaultConfig); - loadConfig(c->group("TabBoxAlternative"), m_alternativeConfig); - - m_defaultCurrentApplicationConfig = m_defaultConfig; - m_defaultCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication); - m_alternativeCurrentApplicationConfig = m_alternativeConfig; - m_alternativeCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication); - - m_tabBox->setConfig(m_defaultConfig); - - m_delayShow = config.readEntry("ShowDelay", true); - m_delayShowTime = config.readEntry("DelayTime", 90); - - m_desktopConfig.setLayoutName(config.readEntry("DesktopLayout", "informative")); - m_desktopListConfig.setLayoutName(config.readEntry("DesktopListLayout", "informative")); - -#ifdef KWIN_BUILD_SCREENEDGES - QList *borders = &m_borderActivate; - QString borderConfig = "BorderActivate"; - for (int i = 0; i < 2; ++i) { - foreach (const ElectricBorder border, *borders) { - ScreenEdges::self()->unreserve(border, this); - } - borders->clear(); - QStringList list = config.readEntry(borderConfig, QStringList()); - foreach (const QString &s, list) { - bool ok = false; - const int i = s.toInt(&ok); - if (!ok) - continue; - borders->append(ElectricBorder(i)); - ScreenEdges::self()->reserve(ElectricBorder(i), this, "toggle"); - } - borders = &m_borderAlternativeActivate; - borderConfig = "BorderAlternativeActivate"; - } -#endif -} - -void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig) -{ - tabBoxConfig.setClientDesktopMode(TabBoxConfig::ClientDesktopMode( - config.readEntry("DesktopMode", TabBoxConfig::defaultDesktopMode()))); - tabBoxConfig.setClientApplicationsMode(TabBoxConfig::ClientApplicationsMode( - config.readEntry("ApplicationsMode", TabBoxConfig::defaultApplicationsMode()))); - tabBoxConfig.setClientMinimizedMode(TabBoxConfig::ClientMinimizedMode( - config.readEntry("MinimizedMode", TabBoxConfig::defaultMinimizedMode()))); - tabBoxConfig.setShowDesktopMode(TabBoxConfig::ShowDesktopMode( - config.readEntry("ShowDesktopMode", TabBoxConfig::defaultShowDesktopMode()))); - tabBoxConfig.setClientMultiScreenMode(TabBoxConfig::ClientMultiScreenMode( - config.readEntry("MultiScreenMode", TabBoxConfig::defaultMultiScreenMode()))); - tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode( - config.readEntry("SwitchingMode", TabBoxConfig::defaultSwitchingMode()))); - - tabBoxConfig.setShowTabBox(config.readEntry("ShowTabBox", - TabBoxConfig::defaultShowTabBox())); - tabBoxConfig.setHighlightWindows(config.readEntry("HighlightWindows", - TabBoxConfig::defaultHighlightWindow())); - - tabBoxConfig.setLayoutName(config.readEntry("LayoutName", TabBoxConfig::defaultLayoutName())); -} - -/*! - Rikkus: please document! (Matthias) - - Ok, here's the docs :) - - You call delayedShow() instead of show() directly. - - If the 'ShowDelay' setting is false, show() is simply called. - - Otherwise, we start a timer for the delay given in the settings and only - do a show() when it times out. - - This means that you can alt-tab between windows and you don't see the - tab box immediately. Not only does this make alt-tabbing faster, it gives - less 'flicker' to the eyes. You don't need to see the tab box if you're - just quickly switching between 2 or 3 windows. It seems to work quite - nicely. - */ -void TabBox::delayedShow() -{ - if (isDisplayed() || m_delayedShowTimer.isActive()) - // already called show - no need to call it twice - return; - - if (!m_delayShowTime) { - show(); - return; - } - - m_delayedShowTimer.setSingleShot(true); - m_delayedShowTimer.start(m_delayShowTime); -} - - -bool TabBox::handleMouseEvent(XEvent* e) -{ - XAllowEvents(display(), AsyncPointer, xTime()); - if (!m_isShown && isDisplayed()) { - // tabbox has been replaced, check effects - if (effects && static_cast(effects)->checkInputWindowEvent(e)) - return true; - } - if (e->type == ButtonPress) { - // press outside Tabbox? - QPoint pos(e->xbutton.x_root, e->xbutton.y_root); - - if ((!m_isShown && isDisplayed()) - || (!m_tabBox->containsPos(pos) && - (e->xbutton.button == Button1 || e->xbutton.button == Button2 || e->xbutton.button == Button3))) { - close(); // click outside closes tab - return true; - } - if (e->xbutton.button == Button5 || e->xbutton.button == Button4) { - // mouse wheel event - const QModelIndex index = m_tabBox->nextPrev(e->xbutton.button == Button5); - if (index.isValid()) { - setCurrentIndex(index); - } - return true; - } - } - return false; -} - -void TabBox::grabbedKeyEvent(QKeyEvent* event) -{ - emit tabBoxKeyEvent(event); - if (!m_isShown && isDisplayed()) { - // tabbox has been replaced, check effects - return; - } - if (m_noModifierGrab) { - if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return || event->key() == Qt::Key_Space) { - accept(); - return; - } - } - m_tabBox->grabbedKeyEvent(event); -} - -/*! - Handles alt-tab / control-tab - */ -static bool areKeySymXsDepressed(bool bAll, const uint keySyms[], int nKeySyms) { - char keymap[32]; - ::memset(keymap, 0, sizeof(keymap) * sizeof(char)); - - kDebug(1212) << "areKeySymXsDepressed: " << (bAll ? "all of " : "any of ") << nKeySyms; - - XQueryKeymap(display(), keymap); - - for (int iKeySym = 0; iKeySym < nKeySyms; iKeySym++) { - uint keySymX = keySyms[ iKeySym ]; - uchar keyCodeX = XKeysymToKeycode(display(), keySymX); - int i = keyCodeX / 8; - char mask = 1 << (keyCodeX - (i * 8)); - - // Abort if bad index value, - if (i < 0 || i >= 32) - return false; - - kDebug(1212) << iKeySym << ": keySymX=0x" << QString::number(keySymX, 16) - << " i=" << i << " mask=0x" << QString::number(mask, 16) - << " keymap[i]=0x" << QString::number(keymap[i], 16); - - // If ALL keys passed need to be depressed, - if (bAll) { - if ((keymap[i] & mask) == 0) - return false; - } else { - // If we are looking for ANY key press, and this key is depressed, - if (keymap[i] & mask) - return true; - } - } - - // If we were looking for ANY key press, then none was found, return false, - // If we were looking for ALL key presses, then all were found, return true. - return bAll; -} - -static bool areModKeysDepressed(const QKeySequence& seq) { - uint rgKeySyms[10]; - int nKeySyms = 0; - if (seq.isEmpty()) - return false; - int mod = seq[seq.count()-1] & Qt::KeyboardModifierMask; - - if (mod & Qt::SHIFT) { - rgKeySyms[nKeySyms++] = XK_Shift_L; - rgKeySyms[nKeySyms++] = XK_Shift_R; - } - if (mod & Qt::CTRL) { - rgKeySyms[nKeySyms++] = XK_Control_L; - rgKeySyms[nKeySyms++] = XK_Control_R; - } - if (mod & Qt::ALT) { - rgKeySyms[nKeySyms++] = XK_Alt_L; - rgKeySyms[nKeySyms++] = XK_Alt_R; - } - if (mod & Qt::META) { - // It would take some code to determine whether the Win key - // is associated with Super or Meta, so check for both. - // See bug #140023 for details. - rgKeySyms[nKeySyms++] = XK_Super_L; - rgKeySyms[nKeySyms++] = XK_Super_R; - rgKeySyms[nKeySyms++] = XK_Meta_L; - rgKeySyms[nKeySyms++] = XK_Meta_R; - } - - return areKeySymXsDepressed(false, rgKeySyms, nKeySyms); -} - -static bool areModKeysDepressed(const KShortcut& cut) -{ - if (areModKeysDepressed(cut.primary()) || areModKeysDepressed(cut.alternate())) - return true; - - return false; -} - -void TabBox::navigatingThroughWindows(bool forward, const KShortcut& shortcut, TabBoxMode mode) -{ - if (!m_ready || isGrabbed()) { - return; - } - if (!options->focusPolicyIsReasonable()) { - //ungrabXKeyboard(); // need that because of accelerator raw mode - // CDE style raise / lower - CDEWalkThroughWindows(forward); - } else { - if (areModKeysDepressed(shortcut)) { - if (startKDEWalkThroughWindows(mode)) - KDEWalkThroughWindows(forward); - } else - // if the shortcut has no modifiers, don't show the tabbox, - // don't grab, but simply go to the next window - KDEOneStepThroughWindows(forward, mode); - } -} - -void TabBox::slotWalkThroughWindows() -{ - navigatingThroughWindows(true, m_cutWalkThroughWindows, TabBoxWindowsMode); -} - -void TabBox::slotWalkBackThroughWindows() -{ - navigatingThroughWindows(false, m_cutWalkThroughWindowsReverse, TabBoxWindowsMode); -} - -void TabBox::slotWalkThroughWindowsAlternative() -{ - navigatingThroughWindows(true, m_cutWalkThroughWindowsAlternative, TabBoxWindowsAlternativeMode); -} - -void TabBox::slotWalkBackThroughWindowsAlternative() -{ - navigatingThroughWindows(false, m_cutWalkThroughWindowsAlternativeReverse, TabBoxWindowsAlternativeMode); -} - -void TabBox::slotWalkThroughCurrentAppWindows() -{ - navigatingThroughWindows(true, m_cutWalkThroughCurrentAppWindows, TabBoxCurrentAppWindowsMode); -} - -void TabBox::slotWalkBackThroughCurrentAppWindows() -{ - navigatingThroughWindows(false, m_cutWalkThroughCurrentAppWindowsReverse, TabBoxCurrentAppWindowsMode); -} - -void TabBox::slotWalkThroughCurrentAppWindowsAlternative() -{ - navigatingThroughWindows(true, m_cutWalkThroughCurrentAppWindowsAlternative, TabBoxCurrentAppWindowsAlternativeMode); -} - -void TabBox::slotWalkBackThroughCurrentAppWindowsAlternative() -{ - navigatingThroughWindows(false, m_cutWalkThroughCurrentAppWindowsAlternativeReverse, TabBoxCurrentAppWindowsAlternativeMode); -} - -void TabBox::slotWalkThroughDesktops() -{ - if (!m_ready || isGrabbed()) { - return; - } - if (areModKeysDepressed(m_cutWalkThroughDesktops)) { - if (startWalkThroughDesktops()) - walkThroughDesktops(true); - } else { - oneStepThroughDesktops(true); - } -} - -void TabBox::slotWalkBackThroughDesktops() -{ - if (!m_ready || isGrabbed()) { - return; - } - if (areModKeysDepressed(m_cutWalkThroughDesktopsReverse)) { - if (startWalkThroughDesktops()) - walkThroughDesktops(false); - } else { - oneStepThroughDesktops(false); - } -} - -void TabBox::slotWalkThroughDesktopList() -{ - if (!m_ready || isGrabbed()) { - return; - } - if (areModKeysDepressed(m_cutWalkThroughDesktopList)) { - if (startWalkThroughDesktopList()) - walkThroughDesktops(true); - } else { - oneStepThroughDesktopList(true); - } -} - -void TabBox::slotWalkBackThroughDesktopList() -{ - if (!m_ready || isGrabbed()) { - return; - } - if (areModKeysDepressed(m_cutWalkThroughDesktopListReverse)) { - if (startWalkThroughDesktopList()) - walkThroughDesktops(false); - } else { - oneStepThroughDesktopList(false); - } -} - -void TabBox::slotWalkThroughDesktopsKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughDesktops = KShortcut(seq); -} - -void TabBox::slotWalkBackThroughDesktopsKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughDesktopsReverse = KShortcut(seq); -} - -void TabBox::slotWalkThroughDesktopListKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughDesktopList = KShortcut(seq); -} - -void TabBox::slotWalkBackThroughDesktopListKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughDesktopListReverse = KShortcut(seq); -} - -void TabBox::slotWalkThroughWindowsKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughWindows = KShortcut(seq); -} - -void TabBox::slotWalkBackThroughWindowsKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughWindowsReverse = KShortcut(seq); -} - -void TabBox::slotMoveToTabLeftKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughGroupWindows = KShortcut(seq); -} -void TabBox::slotMoveToTabRightKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughGroupWindowsReverse = KShortcut(seq); -} - -void TabBox::slotWalkThroughWindowsAlternativeKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughWindowsAlternative = KShortcut(seq); -} - -void TabBox::slotWalkBackThroughWindowsAlternativeKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughWindowsAlternativeReverse = KShortcut(seq); -} - -void TabBox::slotWalkThroughCurrentAppWindowsKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughCurrentAppWindows = KShortcut(seq); -} - -void TabBox::slotWalkBackThroughCurrentAppWindowsKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughCurrentAppWindowsReverse = KShortcut(seq); -} - -void TabBox::slotWalkThroughCurrentAppWindowsAlternativeKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughCurrentAppWindowsAlternative = KShortcut(seq); -} - -void TabBox::slotWalkBackThroughCurrentAppWindowsAlternativeKeyChanged(const QKeySequence& seq) -{ - m_cutWalkThroughCurrentAppWindowsAlternativeReverse = KShortcut(seq); -} - -void TabBox::modalActionsSwitch(bool enabled) -{ - QList collections; - collections.append(Workspace::self()->actionCollection()); - collections.append(Workspace::self()->disableShortcutsKeys()); - collections.append(Workspace::self()->clientKeys()); - foreach (KActionCollection * collection, collections) { - foreach (QAction * action, collection->actions()) - action->setEnabled(enabled); - } -} - -bool TabBox::toggle(ElectricBorder eb) -{ - if (!options->focusPolicyIsReasonable()) - return false; // not supported. - if (isDisplayed()) { - ungrabXKeyboard(); - accept(); - return true; - } - if (!grabXKeyboard()) - return false; - m_noModifierGrab = m_tabGrab = true; - if (m_borderAlternativeActivate.contains(eb)) - setMode(TabBoxWindowsAlternativeMode); - else - setMode(TabBoxWindowsMode); - reset(); - show(); - return true; -} - -void TabBox::open(bool modal, const QString &layout) -{ - if (isDisplayed()) { - return; - } - if (modal) { - if (!establishTabBoxGrab()) { - return; - } - m_tabGrab = true; - } else { - m_tabGrab = false; - } - m_noModifierGrab = !modal; - setMode(TabBoxWindowsMode); - if (!layout.isNull()) { - TabBoxConfig tempConfig; - tempConfig = tabBox->config(); - tempConfig.setLayoutName(layout); - tempConfig.setShowTabBox(true); - tabBox->setConfig(tempConfig); - } - reset(); - show(); -} - -void TabBox::openEmbedded(qulonglong wid, QPoint offset, QSize size, int horizontalAlignment, int verticalAlignment, const QString &layout) -{ - if (isDisplayed()) { - return; - } - m_tabGrab = false; - m_noModifierGrab = true; - tabBox->setEmbedded(static_cast(wid)); - tabBox->setEmbeddedOffset(offset); - tabBox->setEmbeddedSize(size); - tabBox->setEmbeddedAlignment(static_cast(horizontalAlignment) | static_cast(verticalAlignment)); - setMode(TabBoxWindowsMode); - if (!layout.isNull()) { - TabBoxConfig tempConfig; - tempConfig = tabBox->config(); - tempConfig.setLayoutName(layout); - tabBox->setConfig(tempConfig); - } - reset(); - show(); -} - -bool TabBox::startKDEWalkThroughWindows(TabBoxMode mode) -{ - if (!establishTabBoxGrab()) - return false; - m_tabGrab = true; - m_noModifierGrab = false; - tabBox->resetEmbedded(); - modalActionsSwitch(false); - setMode(mode); - reset(); - return true; -} - -bool TabBox::startWalkThroughDesktops(TabBoxMode mode) -{ - if (!establishTabBoxGrab()) - return false; - m_desktopGrab = true; - m_noModifierGrab = false; - modalActionsSwitch(false); - setMode(mode); - reset(); - return true; -} - -bool TabBox::startWalkThroughDesktops() -{ - return startWalkThroughDesktops(TabBoxDesktopMode); -} - -bool TabBox::startWalkThroughDesktopList() -{ - return startWalkThroughDesktops(TabBoxDesktopListMode); -} - -void TabBox::KDEWalkThroughWindows(bool forward) -{ - nextPrev(forward); - delayedShow(); -} - -void TabBox::walkThroughDesktops(bool forward) -{ - nextPrev(forward); - delayedShow(); -} - -void TabBox::CDEWalkThroughWindows(bool forward) -{ - Client* c = NULL; -// this function find the first suitable client for unreasonable focus -// policies - the topmost one, with some exceptions (can't be keepabove/below, -// otherwise it gets stuck on them) -// Q_ASSERT(Workspace::self()->block_stacking_updates == 0); - for (int i = Workspace::self()->stackingOrder().size() - 1; - i >= 0 ; - --i) { - Client* it = qobject_cast(Workspace::self()->stackingOrder().at(i)); - if (it && it->isOnCurrentDesktop() && !it->isSpecialWindow() - && it->isShown(false) && it->wantsTabFocus() - && !it->keepAbove() && !it->keepBelow()) { - c = it; - break; - } - } - Client* nc = c; - bool options_traverse_all; - { - KConfigGroup group(KGlobal::config(), "TabBox"); - options_traverse_all = group.readEntry("TraverseAll", false); - } - - Client* firstClient = 0; - do { - nc = forward ? nextClientStatic(nc) : previousClientStatic(nc); - if (!firstClient) { - // When we see our first client for the second time, - // it's time to stop. - firstClient = nc; - } else if (nc == firstClient) { - // No candidates found. - nc = 0; - break; - } - } while (nc && nc != c && - ((!options_traverse_all && !nc->isOnDesktop(currentDesktop())) || - nc->isMinimized() || !nc->wantsTabFocus() || nc->keepAbove() || nc->keepBelow())); - if (nc) { - if (c && c != nc) - Workspace::self()->lowerClient(c); - if (options->focusPolicyIsReasonable()) { - Workspace::self()->activateClient(nc); - if (nc->isShade() && options->isShadeHover()) - nc->setShade(ShadeActivated); - } else { - if (!nc->isOnDesktop(currentDesktop())) - setCurrentDesktop(nc->desktop()); - Workspace::self()->raiseClient(nc); - } - } -} - -void TabBox::KDEOneStepThroughWindows(bool forward, TabBoxMode mode) -{ - setMode(mode); - reset(); - nextPrev(forward); - if (Client* c = currentClient()) { - Workspace::self()->activateClient(c); - if (c->isShade() && options->isShadeHover()) - c->setShade(ShadeActivated); - } -} - -void TabBox::oneStepThroughDesktops(bool forward, TabBoxMode mode) -{ - setMode(mode); - reset(); - nextPrev(forward); - if (currentDesktop() != -1) - setCurrentDesktop(currentDesktop()); -} - -void TabBox::oneStepThroughDesktops(bool forward) -{ - oneStepThroughDesktops(forward, TabBoxDesktopMode); -} - -void TabBox::oneStepThroughDesktopList(bool forward) -{ - oneStepThroughDesktops(forward, TabBoxDesktopListMode); -} - -/*! - Handles holding alt-tab / control-tab - */ -void TabBox::keyPress(int keyQt) -{ - bool forward = false; - bool backward = false; - - if (m_tabGrab) { - KShortcut forwardShortcut; - KShortcut backwardShortcut; - switch (mode()) { - case TabBoxWindowsMode: - forwardShortcut = m_cutWalkThroughWindows; - backwardShortcut = m_cutWalkThroughWindowsReverse; - break; - case TabBoxWindowsAlternativeMode: - forwardShortcut = m_cutWalkThroughWindowsAlternative; - backwardShortcut = m_cutWalkThroughWindowsAlternativeReverse; - break; - case TabBoxCurrentAppWindowsMode: - forwardShortcut = m_cutWalkThroughCurrentAppWindows; - backwardShortcut = m_cutWalkThroughCurrentAppWindowsReverse; - break; - case TabBoxCurrentAppWindowsAlternativeMode: - forwardShortcut = m_cutWalkThroughCurrentAppWindowsAlternative; - backwardShortcut = m_cutWalkThroughCurrentAppWindowsAlternativeReverse; - break; - default: - kDebug(1212) << "Invalid TabBoxMode"; - return; - } - forward = forwardShortcut.contains(keyQt); - backward = backwardShortcut.contains(keyQt); - if ((keyQt & Qt::ShiftModifier) && !(forward || backward)) { - // if the shortcuts do not match, try matching again after filtering the shift key from keyQt - // it is needed to handle correctly the ALT+~ shorcut for example as it is coded as ALT+SHIFT+~ in keyQt - keyQt &= ~Qt::ShiftModifier; - forward = forwardShortcut.contains(keyQt); - backward = backwardShortcut.contains(keyQt); - if (!(forward || backward)) { - // the tabkey is however overly special and withdrawing the shift state will not turn backtab into tab - // yet kglobalaccel fires for both. since we ensure this is in a Shift condition, try the other key - // TODO: Check requirement regarding Qt5 - - // NOTICE: it is very important to restore the Shift modifier, since otherwise we can't distiguish - // between the regular alt+tab / alt+shift+tab anymore!! - if ((keyQt & Qt::Key_Backtab) == Qt::Key_Backtab) {// regular case - keyQt &= ~Qt::Key_Backtab; - keyQt |= (Qt::Key_Tab|Qt::ShiftModifier); - } else if ((keyQt & Qt::Key_Tab) == Qt::Key_Tab) { // just to be very sure ... :-( - keyQt &= ~Qt::Key_Tab; - keyQt |= (Qt::Key_Backtab|Qt::ShiftModifier); - } - forward = forwardShortcut.contains(keyQt); - backward = backwardShortcut.contains(keyQt); - } - } - if (forward || backward) { - kDebug(1212) << "== " << forwardShortcut.toString() - << " or " << backwardShortcut.toString(); - KDEWalkThroughWindows(forward); - } - } else if (m_desktopGrab) { - forward = m_cutWalkThroughDesktops.contains(keyQt) || - m_cutWalkThroughDesktopList.contains(keyQt); - backward = m_cutWalkThroughDesktopsReverse.contains(keyQt) || - m_cutWalkThroughDesktopListReverse.contains(keyQt); - if ((keyQt & Qt::ShiftModifier) && !(forward || backward)) { - // if the shortcuts do not match, try matching again after filtering the shift key from keyQt - // it is needed to handle correctly the ALT+~ shorcut for example as it is coded as ALT+SHIFT+~ in keyQt - keyQt &= ~Qt::ShiftModifier; - forward = m_cutWalkThroughDesktops.contains(keyQt) || - m_cutWalkThroughDesktopList.contains(keyQt); - backward = m_cutWalkThroughDesktopsReverse.contains(keyQt) || - m_cutWalkThroughDesktopListReverse.contains(keyQt); - if (!(forward || backward)) { - // the tabkey is however overly special and withdrawing the shift state will not turn backtab into tab - // yet kglobalaccel fires for both. since we ensure this is in a Shift condition, try the other key - // TODO: Check requirement regarding Qt5 - - // NOTICE: it is very important to restore the Shift modifier, since otherwise we can't distiguish - // between the regular alt+tab / alt+shift+tab anymore!! - if ((keyQt & Qt::Key_Backtab) == Qt::Key_Backtab) {// regular case - keyQt &= ~Qt::Key_Backtab; - keyQt |= (Qt::Key_Tab|Qt::ShiftModifier); - } else if ((keyQt & Qt::Key_Tab) == Qt::Key_Tab) { // just to be very sure ... :-( - keyQt &= ~Qt::Key_Tab; - keyQt |= (Qt::Key_Backtab|Qt::ShiftModifier); - } - forward = m_cutWalkThroughDesktops.contains(keyQt) || - m_cutWalkThroughDesktopList.contains(keyQt); - backward = m_cutWalkThroughDesktopsReverse.contains(keyQt) || - m_cutWalkThroughDesktopListReverse.contains(keyQt); - } - } - if (forward || backward) - walkThroughDesktops(forward); - } - - if (m_desktopGrab || m_tabGrab) { - if (((keyQt & ~Qt::KeyboardModifierMask) == Qt::Key_Escape) - && !(forward || backward)) { - // if Escape is part of the shortcut, don't cancel - close(true); - } else if (!(forward || backward)) { - QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, keyQt & ~Qt::KeyboardModifierMask, Qt::NoModifier); - grabbedKeyEvent(event); - } - } -} - -void TabBox::close(bool abort) -{ - if (isGrabbed()) { - removeTabBoxGrab(); - } - hide(abort); - modalActionsSwitch(true); - m_tabGrab = false; - m_desktopGrab = false; - m_noModifierGrab = false; -} - -void TabBox::accept() -{ - Client* c = currentClient(); - close(); - if (c) { - Workspace::self()->activateClient(c); - if (c->isShade() && options->isShadeHover()) - c->setShade(ShadeActivated); - if (c->isDesktop()) - Workspace::self()->setShowingDesktop(!Workspace::self()->showingDesktop()); - } -} - -void TabBox::reject() -{ - close(true); -} - -/*! - Handles alt-tab / control-tab releasing - */ -void TabBox::keyRelease(const XKeyEvent& ev) -{ - if (m_noModifierGrab) { - return; - } - unsigned int mk = ev.state & - (KKeyServer::modXShift() | - KKeyServer::modXCtrl() | - KKeyServer::modXAlt() | - KKeyServer::modXMeta()); - // ev.state is state before the key release, so just checking mk being 0 isn't enough - // using XQueryPointer() also doesn't seem to work well, so the check that all - // modifiers are released: only one modifier is active and the currently released - // key is this modifier - if yes, release the grab - int mod_index = -1; - for (int i = ShiftMapIndex; - i <= Mod5MapIndex; - ++i) - if ((mk & (1 << i)) != 0) { - if (mod_index >= 0) - return; - mod_index = i; - } - bool release = false; - if (mod_index == -1) - release = true; - else { - XModifierKeymap* xmk = XGetModifierMapping(display()); - for (int i = 0; i < xmk->max_keypermod; i++) - if (xmk->modifiermap[xmk->max_keypermod * mod_index + i] - == ev.keycode) - release = true; - XFreeModifiermap(xmk); - } - if (!release) - return; - if (m_tabGrab) { - bool old_control_grab = m_desktopGrab; - accept(); - m_desktopGrab = old_control_grab; - } - if (m_desktopGrab) { - bool old_tab_grab = m_tabGrab; - int desktop = currentDesktop(); - close(); - m_tabGrab = old_tab_grab; - if (desktop != -1) { - setCurrentDesktop(desktop); - VirtualDesktopManager::self()->setCurrent(desktop); - } - } -} - -int TabBox::nextDesktopStatic(int iDesktop) const -{ - DesktopNext functor; - return functor(iDesktop, true); -} - -int TabBox::previousDesktopStatic(int iDesktop) const -{ - DesktopPrevious functor; - return functor(iDesktop, true); -} - -/*! - auxiliary functions to travers all clients according to the static - order. Useful for the CDE-style Alt-tab feature. -*/ -Client* TabBox::nextClientStatic(Client* c) const -{ - if (!c || Workspace::self()->clientList().isEmpty()) - return 0; - int pos = Workspace::self()->clientList().indexOf(c); - if (pos == -1) - return Workspace::self()->clientList().first(); - ++pos; - if (pos == Workspace::self()->clientList().count()) - return Workspace::self()->clientList().first(); - return Workspace::self()->clientList()[ pos ]; -} - -/*! - auxiliary functions to travers all clients according to the static - order. Useful for the CDE-style Alt-tab feature. -*/ -Client* TabBox::previousClientStatic(Client* c) const -{ - if (!c || Workspace::self()->clientList().isEmpty()) - return 0; - int pos = Workspace::self()->clientList().indexOf(c); - if (pos == -1) - return Workspace::self()->clientList().last(); - if (pos == 0) - return Workspace::self()->clientList().last(); - --pos; - return Workspace::self()->clientList()[ pos ]; -} - -bool TabBox::establishTabBoxGrab() -{ - if (!grabXKeyboard()) - return false; - // Don't try to establish a global mouse grab using XGrabPointer, as that would prevent - // using Alt+Tab while DND (#44972). However force passive grabs on all windows - // in order to catch MouseRelease events and close the tabbox (#67416). - // All clients already have passive grabs in their wrapper windows, so check only - // the active client, which may not have it. - assert(!m_forcedGlobalMouseGrab); - m_forcedGlobalMouseGrab = true; - if (Workspace::self()->activeClient() != NULL) - Workspace::self()->activeClient()->updateMouseGrab(); - return true; -} - -void TabBox::removeTabBoxGrab() -{ - ungrabXKeyboard(); - assert(m_forcedGlobalMouseGrab); - m_forcedGlobalMouseGrab = false; - if (Workspace::self()->activeClient() != NULL) - Workspace::self()->activeClient()->updateMouseGrab(); -} -} // namespace TabBox -} // namespace - -#include "moc_tabbox.cpp" diff --git a/kwin/tabbox/tabbox.h b/kwin/tabbox/tabbox.h deleted file mode 100644 index 30725296..00000000 --- a/kwin/tabbox/tabbox.h +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 1999, 2000 Matthias Ettrich -Copyright (C) 2003 Lubos Lunak -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef KWIN_TABBOX_H -#define KWIN_TABBOX_H - -#include -#include -#include -#include "utils.h" -#include "tabbox/tabboxhandler.h" - -class KActionCollection; -class KConfigGroup; -#include - -namespace KWin -{ - -class Workspace; -class Client; -namespace TabBox -{ -class DesktopChainManager; -class TabBoxConfig; -class TabBox; -class TabBoxHandlerImpl : public TabBoxHandler -{ -public: - explicit TabBoxHandlerImpl(TabBox* tabBox); - virtual ~TabBoxHandlerImpl(); - - virtual int activeScreen() const; - virtual QWeakPointer< TabBoxClient > activeClient() const; - virtual int currentDesktop() const; - virtual QString desktopName(TabBoxClient* client) const; - virtual QString desktopName(int desktop) const; - virtual bool isKWinCompositing() const; - virtual QWeakPointer< TabBoxClient > nextClientFocusChain(TabBoxClient* client) const; - virtual QWeakPointer< TabBoxClient > firstClientFocusChain() const; - virtual bool isInFocusChain (TabBoxClient* client) const; - virtual int nextDesktopFocusChain(int desktop) const; - virtual int numberOfDesktops() const; - virtual TabBoxClientList stackingOrder() const; - virtual void elevateClient(TabBoxClient* c, WId tabbox, bool elevate) const; - virtual void raiseClient(TabBoxClient *client) const; - virtual void restack(TabBoxClient *c, TabBoxClient *under); - virtual QWeakPointer< TabBoxClient > clientToAddToList(KWin::TabBox::TabBoxClient* client, int desktop) const; - virtual QWeakPointer< TabBoxClient > desktopClient() const; - virtual void activateAndClose(); - -private: - bool checkDesktop(TabBoxClient* client, int desktop) const; - bool checkApplications(TabBoxClient* client) const; - bool checkMinimized(TabBoxClient* client) const; - bool checkMultiScreen(TabBoxClient* client) const; - - TabBox* m_tabBox; - DesktopChainManager* m_desktopFocusChain; -}; - -class TabBoxClientImpl : public TabBoxClient -{ -public: - explicit TabBoxClientImpl(Client *client); - virtual ~TabBoxClientImpl(); - - virtual QString caption() const; - virtual QPixmap icon(const QSize& size = QSize(32, 32)) const; - virtual WId window() const; - virtual bool isMinimized() const; - virtual int x() const; - virtual int y() const; - virtual int width() const; - virtual int height() const; - virtual bool isCloseable() const; - virtual void close(); - virtual bool isFirstInTabBox() const; - - Client* client() const { - return m_client; - } - -private: - Client* m_client; -}; - -class TabBox : public QObject -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.kwin") -public: - ~TabBox(); - - Client* currentClient(); - ClientList currentClientList(); - int currentDesktop(); - QList< int > currentDesktopList(); - - void setCurrentClient(Client* newClient); - void setCurrentDesktop(int newDesktop); - - void setMode(TabBoxMode mode); - TabBoxMode mode() const { - return m_tabBoxMode; - } - - void reset(bool partial_reset = false); - void nextPrev(bool next = true); - - void delayedShow(); - void hide(bool abort = false); - - /*! - Increase the reference count, preventing the default tabbox from showing. - - \sa unreference(), isDisplayed() - */ - void reference() { - ++m_displayRefcount; - } - /*! - Decrease the reference count. Only when the reference count is 0 will - the default tab box be shown. - */ - void unreference() { - --m_displayRefcount; - } - /*! - Returns whether the tab box is being displayed, either natively or by an - effect. - - \sa reference(), unreference() - */ - bool isDisplayed() const { - return m_displayRefcount > 0; - }; - - bool handleMouseEvent(XEvent* e); - void grabbedKeyEvent(QKeyEvent* event); - - bool isGrabbed() const { - return m_tabGrab || m_desktopGrab; - }; - - void initShortcuts(KActionCollection* keys); - - Client* nextClientStatic(Client*) const; - Client* previousClientStatic(Client*) const; - int nextDesktopStatic(int iDesktop) const; - int previousDesktopStatic(int iDesktop) const; - void keyPress(int key); - void keyRelease(const XKeyEvent& ev); - - static TabBox *self(); - static TabBox *create(QObject *parent); - -public slots: - void show(); - /** - * Only for DBus Interface to start primary KDE Walk through windows. - * @param modal Whether the TabBox should grab keyboard and mouse, that is go into modal - * mode or whether the TabBox is controlled externally (e.g. through an effect). - * @param layout The name of the layout to use, if null string (default) the configured layout is used - **/ - Q_SCRIPTABLE void open(bool modal = true, const QString &layout = QString()); - /** - * Opens the TabBox view embedded on a different window. This implies non-modal mode. - * The geometry of the TabBox is determined by offset, size and the alignment flags. - * If the alignment flags are set to center the view scales with the container. That is if - * the window where the TabBox is embedded onto resizes, the TabBox resizes, too. - * The alignment in combination with the offset determines to what border the TabBox is snapped. - * E.g. if horizontal alignment is right the offset is interpreted as the offset between right - * corner of TabBox view and the container view. When the container changes its geometry this - * offset is kept. So the offset on the left side would increase. - * @param wid The window Id the TabBox should be embedded onto - * @param offset The offset to one of the size borders - * @param size The size of the TabBox. To use the same size as the container, set alignment to center - * @param horizontalAlignment Either Qt::AlignLeft, Qt::AlignHCenter or Qt::AlignRight - * @param verticalAlignment Either Qt::AlignTop, Qt::AlignVCenter or Qt::AlignBottom - * @param layout The name of the layout to use, if null string (default) the configured layout is used - **/ - Q_SCRIPTABLE void openEmbedded(qulonglong wid, QPoint offset, QSize size, int horizontalAlignment, int verticalAlignment, const QString &layout = QString()); - Q_SCRIPTABLE void close(bool abort = false); - Q_SCRIPTABLE void accept(); - Q_SCRIPTABLE void reject(); - void slotWalkThroughDesktops(); - void slotWalkBackThroughDesktops(); - void slotWalkThroughDesktopList(); - void slotWalkBackThroughDesktopList(); - void slotWalkThroughWindows(); - void slotWalkBackThroughWindows(); - void slotWalkThroughWindowsAlternative(); - void slotWalkBackThroughWindowsAlternative(); - void slotWalkThroughCurrentAppWindows(); - void slotWalkBackThroughCurrentAppWindows(); - void slotWalkThroughCurrentAppWindowsAlternative(); - void slotWalkBackThroughCurrentAppWindowsAlternative(); - - void slotWalkThroughDesktopsKeyChanged(const QKeySequence& seq); - void slotWalkBackThroughDesktopsKeyChanged(const QKeySequence& seq); - void slotWalkThroughDesktopListKeyChanged(const QKeySequence& seq); - void slotWalkBackThroughDesktopListKeyChanged(const QKeySequence& seq); - void slotWalkThroughWindowsKeyChanged(const QKeySequence& seq); - void slotWalkBackThroughWindowsKeyChanged(const QKeySequence& seq); - void slotMoveToTabLeftKeyChanged(const QKeySequence& seq); - void slotMoveToTabRightKeyChanged(const QKeySequence& seq); - void slotWalkThroughWindowsAlternativeKeyChanged(const QKeySequence& seq); - void slotWalkBackThroughWindowsAlternativeKeyChanged(const QKeySequence& seq); - void slotWalkThroughCurrentAppWindowsKeyChanged(const QKeySequence& seq); - void slotWalkBackThroughCurrentAppWindowsKeyChanged(const QKeySequence& seq); - void slotWalkThroughCurrentAppWindowsAlternativeKeyChanged(const QKeySequence& seq); - void slotWalkBackThroughCurrentAppWindowsAlternativeKeyChanged(const QKeySequence& seq); - - void handlerReady(); - - bool toggle(ElectricBorder eb); - -signals: - void tabBoxAdded(int); - Q_SCRIPTABLE void tabBoxClosed(); - Q_SCRIPTABLE void itemSelected(); - void tabBoxUpdated(); - void tabBoxKeyEvent(QKeyEvent*); - -private: - explicit TabBox(QObject *parent); - void setCurrentIndex(QModelIndex index, bool notifyEffects = true); - void loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig); - - bool startKDEWalkThroughWindows(TabBoxMode mode); // TabBoxWindowsMode | TabBoxWindowsAlternativeMode - bool startWalkThroughDesktops(TabBoxMode mode); // TabBoxDesktopMode | TabBoxDesktopListMode - bool startWalkThroughDesktops(); - bool startWalkThroughDesktopList(); - void navigatingThroughWindows(bool forward, const KShortcut& shortcut, TabBoxMode mode); // TabBoxWindowsMode | TabBoxWindowsAlternativeMode - void KDEWalkThroughWindows(bool forward); - void CDEWalkThroughWindows(bool forward); - void walkThroughDesktops(bool forward); - void KDEOneStepThroughWindows(bool forward, TabBoxMode mode); // TabBoxWindowsMode | TabBoxWindowsAlternativeMode - void oneStepThroughDesktops(bool forward, TabBoxMode mode); // TabBoxDesktopMode | TabBoxDesktopListMode - void oneStepThroughDesktops(bool forward); - void oneStepThroughDesktopList(bool forward); - bool establishTabBoxGrab(); - void removeTabBoxGrab(); - void modalActionsSwitch(bool enabled); - -private Q_SLOTS: - void reconfigure(); - -private: - TabBoxMode m_tabBoxMode; - TabBoxHandlerImpl* m_tabBox; - bool m_delayShow; - int m_delayShowTime; - - QTimer m_delayedShowTimer; - int m_displayRefcount; - - TabBoxConfig m_defaultConfig; - TabBoxConfig m_alternativeConfig; - TabBoxConfig m_defaultCurrentApplicationConfig; - TabBoxConfig m_alternativeCurrentApplicationConfig; - TabBoxConfig m_desktopConfig; - TabBoxConfig m_desktopListConfig; - // false if an effect has referenced the tabbox - // true if tabbox is active (independent on showTabbox setting) - bool m_isShown; - bool m_desktopGrab; - bool m_tabGrab; - // true if tabbox is in modal mode which does not require holding a modifier - bool m_noModifierGrab; - KShortcut m_cutWalkThroughDesktops, m_cutWalkThroughDesktopsReverse; - KShortcut m_cutWalkThroughDesktopList, m_cutWalkThroughDesktopListReverse; - KShortcut m_cutWalkThroughWindows, m_cutWalkThroughWindowsReverse; - KShortcut m_cutWalkThroughGroupWindows, m_cutWalkThroughGroupWindowsReverse; - KShortcut m_cutWalkThroughWindowsAlternative, m_cutWalkThroughWindowsAlternativeReverse; - KShortcut m_cutWalkThroughCurrentAppWindows, m_cutWalkThroughCurrentAppWindowsReverse; - KShortcut m_cutWalkThroughCurrentAppWindowsAlternative, m_cutWalkThroughCurrentAppWindowsAlternativeReverse; - bool m_forcedGlobalMouseGrab; - bool m_ready; // indicates whether the config is completely loaded - QList m_borderActivate, m_borderAlternativeActivate; - - static TabBox *s_self; -}; - -inline -TabBox *TabBox::self() -{ - return s_self; -} - -} // namespace TabBox -} // namespace -#endif diff --git a/kwin/tabbox/tabboxconfig.cpp b/kwin/tabbox/tabboxconfig.cpp deleted file mode 100644 index 647347cb..00000000 --- a/kwin/tabbox/tabboxconfig.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#include "tabboxconfig.h" - -namespace KWin -{ -namespace TabBox -{ -class TabBoxConfigPrivate -{ -public: - TabBoxConfigPrivate() - : showTabBox(TabBoxConfig::defaultShowTabBox()) - , highlightWindows(TabBoxConfig::defaultHighlightWindow()) - , tabBoxMode(TabBoxConfig::ClientTabBox) - , clientDesktopMode(TabBoxConfig::defaultDesktopMode()) - , clientApplicationsMode(TabBoxConfig::defaultApplicationsMode()) - , clientMinimizedMode(TabBoxConfig::defaultMinimizedMode()) - , showDesktopMode(TabBoxConfig::defaultShowDesktopMode()) - , clientMultiScreenMode(TabBoxConfig::defaultMultiScreenMode()) - , clientSwitchingMode(TabBoxConfig::defaultSwitchingMode()) - , desktopSwitchingMode(TabBoxConfig::MostRecentlyUsedDesktopSwitching) - , layoutName(TabBoxConfig::defaultLayoutName()) { - } - ~TabBoxConfigPrivate() { - } - bool showTabBox; - bool highlightWindows; - - TabBoxConfig::TabBoxMode tabBoxMode; - TabBoxConfig::ClientDesktopMode clientDesktopMode; - TabBoxConfig::ClientApplicationsMode clientApplicationsMode; - TabBoxConfig::ClientMinimizedMode clientMinimizedMode; - TabBoxConfig::ShowDesktopMode showDesktopMode; - TabBoxConfig::ClientMultiScreenMode clientMultiScreenMode; - TabBoxConfig::ClientSwitchingMode clientSwitchingMode; - TabBoxConfig::DesktopSwitchingMode desktopSwitchingMode; - QString layoutName; -}; - -TabBoxConfig::TabBoxConfig() - : d(new TabBoxConfigPrivate) -{ -} - -TabBoxConfig::~TabBoxConfig() -{ - delete d; -} - -TabBoxConfig& TabBoxConfig::operator=(const KWin::TabBox::TabBoxConfig& object) -{ - d->showTabBox = object.isShowTabBox(); - d->highlightWindows = object.isHighlightWindows(); - d->tabBoxMode = object.tabBoxMode(); - d->clientDesktopMode = object.clientDesktopMode(); - d->clientApplicationsMode = object.clientApplicationsMode(); - d->clientMinimizedMode = object.clientMinimizedMode(); - d->showDesktopMode = object.showDesktopMode(); - d->clientMultiScreenMode = object.clientMultiScreenMode(); - d->clientSwitchingMode = object.clientSwitchingMode(); - d->desktopSwitchingMode = object.desktopSwitchingMode(); - d->layoutName = object.layoutName(); - return *this; -} - -void TabBoxConfig::setHighlightWindows(bool highlight) -{ - d->highlightWindows = highlight; -} - -bool TabBoxConfig::isHighlightWindows() const -{ - return d->highlightWindows; -} - -void TabBoxConfig::setShowTabBox(bool show) -{ - d->showTabBox = show; -} - -bool TabBoxConfig::isShowTabBox() const -{ - return d->showTabBox; -} - -void TabBoxConfig::setTabBoxMode(TabBoxConfig::TabBoxMode mode) -{ - d->tabBoxMode = mode; -} - -TabBoxConfig::TabBoxMode TabBoxConfig::tabBoxMode() const -{ - return d->tabBoxMode; -} - -TabBoxConfig::ClientDesktopMode TabBoxConfig::clientDesktopMode() const -{ - return d->clientDesktopMode; -} - -void TabBoxConfig::setClientDesktopMode(ClientDesktopMode desktopMode) -{ - d->clientDesktopMode = desktopMode; -} - -TabBoxConfig::ClientApplicationsMode TabBoxConfig::clientApplicationsMode() const -{ - return d->clientApplicationsMode; -} - -void TabBoxConfig::setClientApplicationsMode(ClientApplicationsMode applicationsMode) -{ - d->clientApplicationsMode = applicationsMode; -} - -TabBoxConfig::ClientMinimizedMode TabBoxConfig::clientMinimizedMode() const -{ - return d->clientMinimizedMode; -} - -void TabBoxConfig::setClientMinimizedMode(ClientMinimizedMode minimizedMode) -{ - d->clientMinimizedMode = minimizedMode; -} - -TabBoxConfig::ShowDesktopMode TabBoxConfig::showDesktopMode() const -{ - return d->showDesktopMode; -} - -void TabBoxConfig::setShowDesktopMode(ShowDesktopMode showDesktopMode) -{ - d->showDesktopMode = showDesktopMode; -} - -TabBoxConfig::ClientMultiScreenMode TabBoxConfig::clientMultiScreenMode() const -{ - return d->clientMultiScreenMode; -} - -void TabBoxConfig::setClientMultiScreenMode(ClientMultiScreenMode multiScreenMode) -{ - d->clientMultiScreenMode = multiScreenMode; -} - -TabBoxConfig::ClientSwitchingMode TabBoxConfig::clientSwitchingMode() const -{ - return d->clientSwitchingMode; -} - -void TabBoxConfig::setClientSwitchingMode(ClientSwitchingMode switchingMode) -{ - d->clientSwitchingMode = switchingMode; -} - -TabBoxConfig::DesktopSwitchingMode TabBoxConfig::desktopSwitchingMode() const -{ - return d->desktopSwitchingMode; -} - -void TabBoxConfig::setDesktopSwitchingMode(DesktopSwitchingMode switchingMode) -{ - d->desktopSwitchingMode = switchingMode; -} - -QString& TabBoxConfig::layoutName() const -{ - return d->layoutName; -} - -void TabBoxConfig::setLayoutName(const QString& name) -{ - d->layoutName = name; -} - -} // namespace TabBox -} // namespace KWin diff --git a/kwin/tabbox/tabboxconfig.h b/kwin/tabbox/tabboxconfig.h deleted file mode 100644 index 4f495cbd..00000000 --- a/kwin/tabbox/tabboxconfig.h +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef TABBOXCONFIG_H -#define TABBOXCONFIG_H - -#include - -/** -* @file -* This file defines the class TabBoxConfig. -* -* @author Martin Gräßlin -* @since 4.4 -*/ - -namespace KWin -{ -namespace TabBox -{ -class TabBoxConfigPrivate; - -/** -* The TabBoxConfig class holds all configuration options for the TabBox. -* The TabBoxHandler contains a pointer to an object of this class and is -* used by all classes of TabBox. The config defines what kind of data the -* TabBox is displaying and how the layout looks like. There can be different -* Config sets and by setting a new config in the TabBoxHandler the behaviour -* of the TabBox is changed immediately. -* -* @author Martin Gräßlin -* @since 4.4 -*/ -class TabBoxConfig -{ -public: - /** - * ClientDesktopMode defines whether windows from the current desktop or from all - * desktops are included in the TabBoxClient List in the TabBoxClientModel - */ - enum ClientDesktopMode { - AllDesktopsClients, ///< TabBoxClients from all desktops are included. - OnlyCurrentDesktopClients, ///< Only TabBoxClients on current desktop are included - ExcludeCurrentDesktopClients ///< Exclude TabBoxClients on current desktop - }; - /** - * ClientApplicationsMode defines which windows from the current application or from all - * applications are included in the TabBoxClient List in the TabBoxClientModel - */ - enum ClientApplicationsMode { - AllWindowsAllApplications, ///< TabBoxClients from all applications are included - OneWindowPerApplication, ///< Only one TabBoxClient for each application is included - AllWindowsCurrentApplication ///< Only TabBoxClients for the current application are included - }; - /** - * ClientMinimizedMode defines which windows are included in the TabBoxClient List - * in the TabBoxClientModel based on whether they are minimized or not - */ - enum ClientMinimizedMode { - IgnoreMinimizedStatus, ///< TabBoxClients are included no matter they are minimized or not - ExcludeMinimizedClients, ///< Exclude minimized TabBoxClients - OnlyMinimizedClients ///< Only minimized TabBoxClients are included - }; - /** - * ShowDesktopMode defines whether a TabBoxClient representing the desktop - * is included in the TabBoxClient List in the TabBoxClientModel - */ - enum ShowDesktopMode { - DoNotShowDesktopClient, ///< A TabBoxClient representing the desktop is not included - ShowDesktopClient ///< A TabBoxClient representing the desktop is included - }; - /** - * ClientActivitiesMode defines whether windows from the current activity or from all - * activities are included in the TabBoxClient List in the TabBoxClientModel - */ - enum ClientMultiScreenMode { - IgnoreMultiScreen, ///< TabBoxClients are included independently of the screen they are on - OnlyCurrentScreenClients, ///< Only TabBoxClients on current screen are included - ExcludeCurrentScreenClients ///< Exclude TabBoxClients from the current screen - }; - /** - * ClientSwitchingMode defines the sorting of the TabBoxClients in the - * TabBoxClientModel. - */ - enum ClientSwitchingMode { - FocusChainSwitching, ///< Sort by recently used. Most recently used TabBoxClient is the first - StackingOrderSwitching ///< Sort by current stacking order - }; - /** - * DesktopSwitchingMode defines the sorting of the desktops in the - * TabBoxDesktopModel. - */ - enum DesktopSwitchingMode { - MostRecentlyUsedDesktopSwitching,///< Sort by recently used. Most recently used desktop is the first - StaticDesktopSwitching///< Static sorting in numerical ascending order - }; - /** - * TabBoxMode defines what kind of items the TabBox is displaying and which - * Model is used - */ - enum TabBoxMode { - ClientTabBox,///< TabBox uses TabBoxClientModel - DesktopTabBox///< TabBox uses TabBoxDesktopModel - }; - TabBoxConfig(); - ~TabBoxConfig(); - TabBoxConfig& operator=(const TabBoxConfig& object); - - // getters - /** - * @return If the TabBox should be shown or not - * This option does not apply for TabBoxMode DesktopTabBox. - * @see setShowTabBox - * @see defaultShowTabBox - */ - bool isShowTabBox() const; - /** - * @return If Highlight Window effect should be used. - * This option does not apply for TabBoxMode DesktopTabBox. - * @see setHighlightWindows - * @see defaultHighlightWindows - */ - bool isHighlightWindows() const; - /** - * @return The current TabBoxMode - * @see setTabBoxMode - */ - TabBoxMode tabBoxMode() const; - /** - * @return The current ClientDesktopMode - * This option only applies for TabBoxMode ClientTabBox. - * @see setClientDesktopMode - * @see defaultDesktopMode - */ - ClientDesktopMode clientDesktopMode() const; - /** - * @return The current ClientApplicationsMode - * This option only applies for TabBoxMode ClientTabBox. - * @see setClientApplicationsMode - * @see defaultApplicationsMode - */ - ClientApplicationsMode clientApplicationsMode() const; - /** - * @return The current ClientMinimizedMode - * This option only applies for TabBoxMode ClientTabBox. - * @see setClientMinimizedMode - * @see defaultMinimizedMode - */ - ClientMinimizedMode clientMinimizedMode() const; - /** - * @return The current ShowDesktopMode - * This option only applies for TabBoxMode ClientTabBox. - * @see setShowDesktopMode - * @see defaultShowDesktopMode - */ - ShowDesktopMode showDesktopMode() const; - /** - * @return The current ClientMultiScreenMode - * This option only applies for TabBoxMode ClientTabBox. - * @see setClientMultiScreenMode - * @see defaultMultiScreenMode - */ - ClientMultiScreenMode clientMultiScreenMode() const; - /** - * @return The current ClientSwitchingMode. - * This option only applies for TabBoxMode ClientTabBox. - * @see setClientSwitchingMode - * @see defaultSwitchingMode - */ - ClientSwitchingMode clientSwitchingMode() const; - /** - * @return The current DesktopSwitchingMode - * This option only applies for TabBoxMode DesktopTabBox. - * @see setDesktopSwitchingMode - */ - DesktopSwitchingMode desktopSwitchingMode() const; - /** - * @return Then name of the current ItemLayout - * @see setlayoutName - */ - QString& layoutName() const; - - // setters - /** - * @param show The tabbox should be shown or not. - * This option does not apply for TabBoxMode DesktopTabBox. - * @see isShowTabBox - */ - void setShowTabBox(bool show); - /** - * @param highlight Highlight Windows effect should be used or not. - * This option does not apply for TabBoxMode DesktopTabBox. - * @see isHighlightWindows - */ - void setHighlightWindows(bool highlight); - /** - * @param mode The new TabBoxMode to be used. - * @see tabBoxMode - */ - void setTabBoxMode(TabBoxMode mode); - /** - * @param desktopMode The new ClientDesktopMode to be used. - * This option only applies for TabBoxMode ClientTabBox. - * @see clientDesktopMode - */ - void setClientDesktopMode(ClientDesktopMode desktopMode); - /** - * @param applicationsMode The new ClientApplicationsMode to be used. - * This option only applies for TabBoxMode ClientTabBox. - * @see clientApplicationsMode - */ - void setClientApplicationsMode(ClientApplicationsMode applicationsMode); - /** - * @param minimizedMode The new ClientMinimizedMode to be used. - * This option only applies for TabBoxMode ClientTabBox. - * @see clientMinimizedMode - */ - void setClientMinimizedMode(ClientMinimizedMode minimizedMode); - /** - * @param showDesktopMode The new ShowDesktopMode to be used. - * This option only applies for TabBoxMode ClientTabBox. - * @see showDesktopMode - */ - void setShowDesktopMode(ShowDesktopMode showDesktopMode); - /** - * @param multiScreenMode The new ClientMultiScreenMode to be used. - * This option only applies for TabBoxMode ClientTabBox. - * @see clientMultiScreenMode - */ - void setClientMultiScreenMode(ClientMultiScreenMode multiScreenMode); - /** - * @param switchingMode The new ClientSwitchingMode to be used. - * This option only applies for TabBoxMode ClientTabBox. - * @see clientSwitchingMode - */ - void setClientSwitchingMode(ClientSwitchingMode switchingMode); - /** - * @param switchingMode The new DesktopSwitchingMode to be used. - * This option only applies for TabBoxMode DesktopTabBox. - * @see desktopSwitchingMode - */ - void setDesktopSwitchingMode(DesktopSwitchingMode switchingMode); - /** - * @param name The new ItemLayout config name - * @see layoutName - */ - void setLayoutName(const QString& name); - - // some static methods to access default values - static ClientDesktopMode defaultDesktopMode() { - return OnlyCurrentDesktopClients; - } - static ClientApplicationsMode defaultApplicationsMode() { - return AllWindowsAllApplications; - } - static ClientMinimizedMode defaultMinimizedMode() { - return IgnoreMinimizedStatus; - } - static ShowDesktopMode defaultShowDesktopMode() { - return DoNotShowDesktopClient; - } - static ClientMultiScreenMode defaultMultiScreenMode() { - return IgnoreMultiScreen; - } - static ClientSwitchingMode defaultSwitchingMode() { - return FocusChainSwitching; - } - static bool defaultShowTabBox() { - return true; - } - static bool defaultHighlightWindow() { - return true; - } - static QString defaultLayoutName() { - return QString("thumbnails"); - } -private: - TabBoxConfigPrivate* d; -}; - -} // namespace TabBox -} // namespace KWin - -#endif // TABBOXCONFIG_H diff --git a/kwin/tabbox/tabboxhandler.cpp b/kwin/tabbox/tabboxhandler.cpp deleted file mode 100644 index 726a66e5..00000000 --- a/kwin/tabbox/tabboxhandler.cpp +++ /dev/null @@ -1,532 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -// own -#include "tabboxhandler.h" -// tabbox -#include "clientmodel.h" -#include "declarative.h" -#include "desktopmodel.h" -#include "tabboxconfig.h" -// Qt -#include -#include -#include -#include -#include -#include -// KDE -#include -#include - -namespace KWin -{ -namespace TabBox -{ - -class TabBoxHandlerPrivate -{ -public: - TabBoxHandlerPrivate(TabBoxHandler *q); - - ~TabBoxHandlerPrivate(); - - /** - * Updates the current highlight window state - */ - void updateHighlightWindows(); - /** - * Ends window highlighting - */ - void endHighlightWindows(bool abort = false); - - ClientModel* clientModel() const; - DesktopModel* desktopModel() const; - - TabBoxHandler *q; // public pointer - // members - TabBoxConfig config; - DeclarativeView *m_declarativeView; - DeclarativeView *m_declarativeDesktopView; - ClientModel* m_clientModel; - DesktopModel* m_desktopModel; - QModelIndex index; - /** - * Indicates if the tabbox is shown. - */ - bool isShown; - TabBoxClient *lastRaisedClient, *lastRaisedClientSucc; - WId m_embedded; - QPoint m_embeddedOffset; - QSize m_embeddedSize; - Qt::Alignment m_embeddedAlignment; -}; - -TabBoxHandlerPrivate::TabBoxHandlerPrivate(TabBoxHandler *q) - : m_declarativeView(NULL) - , m_declarativeDesktopView(NULL) - , m_embedded(0) - , m_embeddedOffset(QPoint(0, 0)) - , m_embeddedSize(QSize(0, 0)) -{ - this->q = q; - isShown = false; - lastRaisedClient = 0; - lastRaisedClientSucc = 0; - config = TabBoxConfig(); - m_clientModel = new ClientModel(q); - m_desktopModel = new DesktopModel(q); -} - -TabBoxHandlerPrivate::~TabBoxHandlerPrivate() -{ - delete m_declarativeView; - delete m_declarativeDesktopView; -} - -ClientModel* TabBoxHandlerPrivate::clientModel() const -{ - return m_clientModel; -} - -DesktopModel* TabBoxHandlerPrivate::desktopModel() const -{ - return m_desktopModel; -} - -void TabBoxHandlerPrivate::updateHighlightWindows() -{ - if (!isShown || config.tabBoxMode() != TabBoxConfig::ClientTabBox) - return; - - Display *dpy = QX11Info::display(); - TabBoxClient *currentClient = q->client(index); - QWidget *w = NULL; - if (m_declarativeView && m_declarativeView->isVisible()) { - w = m_declarativeView; - } - - if (q->isKWinCompositing()) { - if (lastRaisedClient) - q->elevateClient(lastRaisedClient, m_declarativeView ? m_declarativeView->winId() : 0, false); - lastRaisedClient = currentClient; - if (currentClient) - q->elevateClient(currentClient, m_declarativeView ? m_declarativeView->winId() : 0, true); - } else { - if (lastRaisedClient) { - if (lastRaisedClientSucc) - q->restack(lastRaisedClient, lastRaisedClientSucc); - // TODO lastRaisedClient->setMinimized( lastRaisedClientWasMinimized ); - } - - lastRaisedClient = currentClient; - if (lastRaisedClient) { - // TODO if ( (lastRaisedClientWasMinimized = lastRaisedClient->isMinimized()) ) - // lastRaisedClient->setMinimized( false ); - TabBoxClientList order = q->stackingOrder(); - int succIdx = order.count() + 1; - for (int i=0; iraiseClient(lastRaisedClient); - } - } - - WId wId; - QVector< WId > data; - if (config.isShowTabBox() && w) { - wId = w->winId(); - data.resize(2); - data[ 1 ] = wId; - } else { - wId = QX11Info::appRootWindow(); - data.resize(1); - } - data[ 0 ] = currentClient ? currentClient->window() : 0L; - Atom atom = XInternAtom(dpy, "_KDE_WINDOW_HIGHLIGHT", False); - XChangeProperty(dpy, wId, atom, atom, 32, PropModeReplace, - reinterpret_cast(data.data()), data.size()); -} - -void TabBoxHandlerPrivate::endHighlightWindows(bool abort) -{ - TabBoxClient *currentClient = q->client(index); - if (currentClient) - q->elevateClient(currentClient, m_declarativeView ? m_declarativeView->winId() : 0, false); - if (abort && lastRaisedClient && lastRaisedClientSucc) - q->restack(lastRaisedClient, lastRaisedClientSucc); - lastRaisedClient = 0; - lastRaisedClientSucc = 0; - // highlight windows - Display *dpy = QX11Info::display(); - Atom atom = XInternAtom(dpy, "_KDE_WINDOW_HIGHLIGHT", False); - XDeleteProperty(dpy, config.isShowTabBox() && m_declarativeView ? m_declarativeView->winId() : QX11Info::appRootWindow(), atom); -} - -/*********************************************** -* TabBoxHandler -***********************************************/ - -TabBoxHandler::TabBoxHandler() - : QObject() -{ - KWin::TabBox::tabBox = this; - d = new TabBoxHandlerPrivate(this); -} - -TabBoxHandler::~TabBoxHandler() -{ - delete d; -} - -const KWin::TabBox::TabBoxConfig& TabBoxHandler::config() const -{ - return d->config; -} - -void TabBoxHandler::setConfig(const TabBoxConfig& config) -{ - d->config = config; - emit configChanged(); -} - -void TabBoxHandler::show() -{ - d->isShown = true; - d->lastRaisedClient = 0; - d->lastRaisedClientSucc = 0; - if (d->config.isShowTabBox()) { - DeclarativeView *dv(NULL); - if (d->config.tabBoxMode() == TabBoxConfig::ClientTabBox) { - // use declarative view - if (!d->m_declarativeView) { - d->m_declarativeView = new DeclarativeView(d->clientModel(), TabBoxConfig::ClientTabBox); - } - dv = d->m_declarativeView; - } else { - if (!d->m_declarativeDesktopView) { - d->m_declarativeDesktopView = new DeclarativeView(d->desktopModel(), TabBoxConfig::DesktopTabBox); - } - dv = d->m_declarativeDesktopView; - } - if (dv->status() == QDeclarativeView::Ready && dv->rootObject()) { - dv->show(); - dv->setCurrentIndex(d->index, d->config.tabBoxMode() == TabBoxConfig::ClientTabBox); - } else { - QStringList args; - args << "--passivepopup" << /*i18n*/("The Window Switcher installation is broken, resources are missing.\n" - "Contact your distribution about this.") << "20"; - QProcess::startDetached("kdialog", args); - hide(); - return; - } - } - if (d->config.isHighlightWindows()) { - XSync(QX11Info::display(), false); - // TODO this should be - // QMetaObject::invokeMethod(this, "updateHighlightWindows", Qt::QueuedConnection); - // but we somehow need to cross > 1 event cycle (likely because of queued invocation in the effects) - // to ensure the EffectWindow is present when updateHighlightWindows, thus elevating the window/tabbox - QTimer::singleShot(1, this, SLOT(updateHighlightWindows())); - } -} - -void TabBoxHandler::updateHighlightWindows() -{ - d->updateHighlightWindows(); -} - -void TabBoxHandler::hide(bool abort) -{ - d->isShown = false; - if (d->config.isHighlightWindows()) { - d->endHighlightWindows(abort); - } - if (d->m_declarativeView) { - d->m_declarativeView->hide(); - } - if (d->m_declarativeDesktopView) { - d->m_declarativeDesktopView->hide(); - } -} - -QModelIndex TabBoxHandler::nextPrev(bool forward) const -{ - QModelIndex ret; - QAbstractItemModel* model; - switch(d->config.tabBoxMode()) { - case TabBoxConfig::ClientTabBox: - model = d->clientModel(); - break; - case TabBoxConfig::DesktopTabBox: - model = d->desktopModel(); - break; - default: - return d->index; - } - if (forward) { - int column = d->index.column() + 1; - int row = d->index.row(); - if (column == model->columnCount()) { - column = 0; - row++; - if (row == model->rowCount()) - row = 0; - } - ret = model->index(row, column); - if (!ret.isValid()) - ret = model->index(0, 0); - } else { - int column = d->index.column() - 1; - int row = d->index.row(); - if (column < 0) { - column = model->columnCount() - 1; - row--; - if (row < 0) - row = model->rowCount() - 1; - } - ret = model->index(row, column); - if (!ret.isValid()) { - row = model->rowCount() - 1; - for (int i = model->columnCount() - 1; i >= 0; i--) { - ret = model->index(row, i); - if (ret.isValid()) - break; - } - } - } - if (ret.isValid()) - return ret; - else - return d->index; -} - -QModelIndex TabBoxHandler::desktopIndex(int desktop) const -{ - if (d->config.tabBoxMode() != TabBoxConfig::DesktopTabBox) - return QModelIndex(); - return d->desktopModel()->desktopIndex(desktop); -} - -QList< int > TabBoxHandler::desktopList() const -{ - if (d->config.tabBoxMode() != TabBoxConfig::DesktopTabBox) - return QList< int >(); - return d->desktopModel()->desktopList(); -} - -int TabBoxHandler::desktop(const QModelIndex& index) const -{ - if (!index.isValid() || (d->config.tabBoxMode() != TabBoxConfig::DesktopTabBox)) - return -1; - QVariant ret = d->desktopModel()->data(index, DesktopModel::DesktopRole); - if (ret.isValid()) - return ret.toInt(); - else - return -1; -} - -void TabBoxHandler::setCurrentIndex(const QModelIndex& index) -{ - if (d->index == index) { - return; - } - if (!index.isValid()) { - return; - } - if (d->m_declarativeView) { - d->m_declarativeView->setCurrentIndex(index); - } - if (d->m_declarativeDesktopView) { - d->m_declarativeDesktopView->setCurrentIndex(index); - } - d->index = index; - if (d->config.tabBoxMode() == TabBoxConfig::ClientTabBox) { - if (d->config.isHighlightWindows()) { - d->updateHighlightWindows(); - } - } - emit selectedIndexChanged(); -} - -const QModelIndex& TabBoxHandler::currentIndex() const -{ - return d->index; -} - -void TabBoxHandler::grabbedKeyEvent(QKeyEvent* event) const -{ - if (d->m_declarativeView && d->m_declarativeView->isVisible()) { - d->m_declarativeView->sendKeyEvent(event); - } else if (d->m_declarativeDesktopView && d->m_declarativeDesktopView->isVisible()) { - d->m_declarativeDesktopView->sendKeyEvent(event); - } -} - -bool TabBoxHandler::containsPos(const QPoint& pos) const -{ - QWidget *w = NULL; - if (d->m_declarativeView && d->m_declarativeView->isVisible()) { - w = d->m_declarativeView; - } else if (d->m_declarativeDesktopView && d->m_declarativeDesktopView->isVisible()) { - w = d->m_declarativeDesktopView; - } else { - return false; - } - return w->geometry().contains(pos); -} - -QModelIndex TabBoxHandler::index(QWeakPointer client) const -{ - return d->clientModel()->index(client); -} - -TabBoxClientList TabBoxHandler::clientList() const -{ - if (d->config.tabBoxMode() != TabBoxConfig::ClientTabBox) - return TabBoxClientList(); - return d->clientModel()->clientList(); -} - -TabBoxClient* TabBoxHandler::client(const QModelIndex& index) const -{ - if ((!index.isValid()) || - (d->config.tabBoxMode() != TabBoxConfig::ClientTabBox)) - return NULL; - TabBoxClient* c = static_cast< TabBoxClient* >( - d->clientModel()->data(index, ClientModel::ClientRole).value()); - return c; -} - -void TabBoxHandler::createModel(bool partialReset) -{ - switch(d->config.tabBoxMode()) { - case TabBoxConfig::ClientTabBox: { - d->clientModel()->createClientList(partialReset); - bool lastRaised = false; - bool lastRaisedSucc = false; - foreach (const QWeakPointer &clientPointer, stackingOrder()) { - QSharedPointer client = clientPointer.toStrongRef(); - if (!client) { - continue; - } - if (client.data() == d->lastRaisedClient) { - lastRaised = true; - } - if (client.data() == d->lastRaisedClientSucc) { - lastRaisedSucc = true; - } - } - if (d->lastRaisedClient && !lastRaised) - d->lastRaisedClient = 0; - if (d->lastRaisedClientSucc && !lastRaisedSucc) - d->lastRaisedClientSucc = 0; - break; - } - case TabBoxConfig::DesktopTabBox: - d->desktopModel()->createDesktopList(); - break; - } -} - -QModelIndex TabBoxHandler::first() const -{ - QAbstractItemModel* model; - switch(d->config.tabBoxMode()) { - case TabBoxConfig::ClientTabBox: - model = d->clientModel(); - break; - case TabBoxConfig::DesktopTabBox: - model = d->desktopModel(); - break; - default: - return QModelIndex(); - } - return model->index(0, 0); -} - -WId TabBoxHandler::embedded() const -{ - return d->m_embedded; -} - -void TabBoxHandler::setEmbedded(WId wid) -{ - d->m_embedded = wid; - emit embeddedChanged(wid != 0); -} - -void TabBoxHandler::setEmbeddedOffset(const QPoint &offset) -{ - d->m_embeddedOffset = offset; -} - -void TabBoxHandler::setEmbeddedSize(const QSize &size) -{ - d->m_embeddedSize = size; -} - -const QPoint &TabBoxHandler::embeddedOffset() const -{ - return d->m_embeddedOffset; -} - -const QSize &TabBoxHandler::embeddedSize() const -{ - return d->m_embeddedSize; -} - -Qt::Alignment TabBoxHandler::embeddedAlignment() const -{ - return d->m_embeddedAlignment; -} - -void TabBoxHandler::setEmbeddedAlignment(Qt::Alignment alignment) -{ - d->m_embeddedAlignment = alignment; -} - -void TabBoxHandler::resetEmbedded() -{ - if (d->m_embedded == 0) { - return; - } - d->m_embedded = 0; - d->m_embeddedOffset = QPoint(0, 0); - d->m_embeddedSize = QSize(0, 0); - emit embeddedChanged(false); -} - -TabBoxHandler* tabBox = 0; - -TabBoxClient::TabBoxClient() -{ -} - -TabBoxClient::~TabBoxClient() -{ -} - -} // namespace TabBox -} // namespace KWin diff --git a/kwin/tabbox/tabboxhandler.h b/kwin/tabbox/tabboxhandler.h deleted file mode 100644 index 5fba884e..00000000 --- a/kwin/tabbox/tabboxhandler.h +++ /dev/null @@ -1,398 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef TABBOXHANDLER_H -#define TABBOXHANDLER_H - -#include "tabboxconfig.h" - -#include -#include -#include -#include - -/** -* @file -* This file contains the classes which hide KWin core from tabbox. -* It defines the pure virtual classes TabBoxHandler and TabBoxClient. -* The classes have to be implemented in KWin Core. -* -* @author Martin Gräßlin -* @since 4.4 -*/ - -namespace KWin -{ -/** -* The TabBox is a model based view for displaying a list while switching windows or desktops. -* This functionality is mostly referred as Alt+Tab. TabBox itself does not provide support for -* switching windows or desktops. This has to be done outside of TabBox inside an independent controller. -* -* The main entrance point to TabBox is the class TabBoxHandler, which has to be subclassed and implemented. -* The class TabBoxClient, which represents a window client inside TabBox, has to be implemented as well. -* -* The behavior of the TabBox is defined by the TabBoxConfig and has to be set in the TabBoxHandler. -* If the TabBox should be used to switch desktops as well as clients it is sufficient to just provide -* different TabBoxConfig objects instead of creating an own handler for each mode. -* -* In order to use the TabBox the TabBoxConfig has to be set. This defines if the model for desktops or for -* clients will be used. The model has to be initialized by calling TabBoxHandler::createModel(), as the -* model is undefined when the TabBox is not active. The TabBox is activated by TabBoxHandler::show(). -* Depending on the current set TabBoxConfig it is possible that the -* highlight windows effect activated and that the view is not displayed at all. As already mentioned -* the TabBox does not handle any updating of the selected item. This has to be done by invoking -* TabBoxHandler::setCurrentIndex(). Nevertheless the TabBoxHandler provides methods to query for the -* model index or the next or previous item, for a cursor position or for a given item (that is -* TabBoxClient or desktop). By invoking TabBoxHandler::hide() the view, the -* optional highlight windows effect are removed. The model is invalidated immediately. So if it is -* necessary to retrieve the last selected item this has to be done before calling the hide method. -* -* The layout of the TabBox View and the items is completely customizable. Therefore TabBox provides -* a widget LayoutConfig which includes a live preview (in kcmkwin/kwintabbox). The layout of items -* can be defined by an xml document. That way the user is able to define own custom layouts. The view -* itself is made up of two widgets: one to show the complete list and one to show only the selected -* item. This way it is possible to have a view which shows for example a list containing only small -* icons and nevertheless show the title of the currently selected client. -*/ -namespace TabBox -{ -class DesktopModel; -class ClientModel; -class TabBoxConfig; -class TabBoxClient; -class TabBoxHandlerPrivate; -typedef QList< QWeakPointer< TabBoxClient > > TabBoxClientList; - -/** -* This class is a wrapper around KWin Workspace. It is used for accessing the -* required core methods from inside TabBox and has to be implemented in KWin core. -* -* @author Martin Gräßlin -* @since 4.4 -*/ -class TabBoxHandler : public QObject -{ - Q_OBJECT -public: - TabBoxHandler(); - virtual ~TabBoxHandler(); - - /** - * @return The id of the active screen - */ - virtual int activeScreen() const = 0; - /** - * @return The current active TabBoxClient or NULL - * if there is no active client. - */ - virtual QWeakPointer activeClient() const = 0; - /** - * @param client The client which is starting point to find the next client - * @return The next TabBoxClient in focus chain - */ - virtual QWeakPointer nextClientFocusChain(TabBoxClient* client) const = 0; - /** - * This method is used by the ClientModel to find an entrance into the focus chain in case - * there is no active Client. - * - * @return The first Client of the focus chain - * @since 4.9.1 - **/ - virtual QWeakPointer firstClientFocusChain() const = 0; - /** - * Checks whether the given @p client is part of the focus chain at all. - * This is useful to figure out whether the currently active Client can be used - * as a starting point to construct the recently used list. - * - * In case the @p client is not in the focus chain it is recommended to use the - * Client returned by @link firstClientFocusChain. - * - * The method accepts a @c null Client and in that case @c false is returned. - * @param client The Client to check whether it is in the Focus Chain - * @return @c true in case the Client is part of the focus chain, @c false otherwise. - * @since 4.9.2 - **/ - virtual bool isInFocusChain(TabBoxClient* client) const = 0; - /** - * @param client The client whose desktop name should be retrieved - * @return The desktop name of the given TabBoxClient. If the client is - * on all desktops the name of current desktop will be returned. - */ - virtual QString desktopName(TabBoxClient* client) const = 0; - /** - * @param desktop The desktop whose name should be retrieved - * @return The desktop name of given desktop - */ - virtual QString desktopName(int desktop) const = 0; - /** - * @return The number of current desktop - */ - virtual int currentDesktop() const = 0; - /** - * @return The number of virtual desktops - */ - virtual int numberOfDesktops() const = 0; - /** - * @param desktop The desktop which is the starting point to find the next desktop - * @return The next desktop in the current focus chain. - */ - virtual int nextDesktopFocusChain(int desktop) const = 0; - - /** - * whether KWin is currently compositing and it's related features (elevating) can be used - */ - virtual bool isKWinCompositing() const = 0; - - /** - * De-/Elevate a client using the compositor (if enabled) - */ - virtual void elevateClient(TabBoxClient* c, WId tabbox, bool elevate) const = 0; - - /** - * Raise a client (w/o activating it) - */ - virtual void raiseClient(TabBoxClient* c) const = 0; - - /** - * @param c The client to be restacked - * @param under The client the other one will be placed below - */ - virtual void restack(TabBoxClient *c, TabBoxClient *under) = 0; - - /** - * @return The current stacking order of TabBoxClients - */ - virtual TabBoxClientList stackingOrder() const = 0; - /** - * Determines if given client will be added to the list: - *
    - *
  • Depends on desktop
  • - *
  • if the client wants to have tab focus.
  • - *
  • The client won't be added if it has modal dialogs
  • - *
  • In that case the modal dialog will be returned if it isn't already - * included
  • - *
  • Won't be added if it isn't on active screen when using separate - * screen focus
  • - *
- * @param client The client to be checked for inclusion - * @param desktop The desktop the client should be on. This is irrelevant if allDesktops is set - * @param allDesktops Add clients from all desktops or only from current - * @return The client to be included in the list or NULL if it isn't to be included - */ - virtual QWeakPointer clientToAddToList(TabBoxClient* client, int desktop) const = 0; - /** - * @return The first desktop window in the stacking order. - */ - virtual QWeakPointer desktopClient() const = 0; - /** - * Activates the currently selected client and closes the TabBox. - **/ - virtual void activateAndClose() = 0; - - /** - * @return The currently used TabBoxConfig - */ - const TabBoxConfig& config() const; - /** - * Call this method when you want to change the currently used TabBoxConfig. - * It fires the signal configChanged. - * @param config Updates the currently used TabBoxConfig to config - */ - void setConfig(const TabBoxConfig& config); - - /** - * Call this method to show the TabBoxView. Depending on current - * configuration this method might not do anything. - * If highlight windows effect is to be used it will be activated. - * Highlight windows and outline are not shown if - * TabBoxConfig::TabBoxMode is TabBoxConfig::DesktopTabBox. - * @see TabBoxConfig::isShowTabBox - * @see TabBoxConfig::isHighlightWindows - */ - void show(); - /** - * Hides the TabBoxView if shown. - * Deactivates highlight windows effect if active. - * @see show - */ - void hide(bool abort = false); - - /** - * Sets the current model index in the view and updates - * highlight windows if active. - * @param index The current Model index - */ - void setCurrentIndex(const QModelIndex& index); - /** - * @returns the current index - **/ - const QModelIndex ¤tIndex() const; - - /** - * Retrieves the next or previous item of the current item. - * @param forward next or previous item - * @return The next or previous item. If there is no matching item - * the current item will be returned. - */ - QModelIndex nextPrev(bool forward) const; - - /** - * Initializes the model based on the current config. - * This method has to be invoked before showing the TabBox. - * It can also be invoked when clients are added or removed. - * In that case partialReset has to be true. - * - * @param partialReset Keep the currently selected item or regenerate everything - */ - void createModel(bool partialReset = false); - - /** - * @param desktop The desktop whose index should be retrieved - * @return The model index of given desktop. If TabBoxMode is not - * TabBoxConfig::DesktopTabBox an invalid model index will be returned. - */ - QModelIndex desktopIndex(int desktop) const; - /** - * @return The current list of desktops. - * If TabBoxMode is not TabBoxConfig::DesktopTabBox an empty list will - * be returned. - * @see DesktopModel::desktopList - */ - QList< int > desktopList() const; - /** - * @return The desktop for given model index. If the index is not valid - * or TabBoxMode is not TabBoxConfig::DesktopTabBox -1 will be returned. - * @see DesktopModel::desktopIndex - */ - int desktop(const QModelIndex& index) const; - - /** - * Handles additional grabbed key events by the TabBox controller. - * @param event The key event which has been grabbed - */ - virtual void grabbedKeyEvent(QKeyEvent* event) const; - /** - * @param pos The position to be tested in global coordinates - * @return True if the view contains the point, otherwise false. - */ - bool containsPos(const QPoint& pos) const; - /** - * @param client The TabBoxClient whose index should be returned - * @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex - * if the model does not contain the given TabBoxClient. - * @see ClientModel::index - */ - QModelIndex index(QWeakPointer client) const; - /** - * @return Returns the current list of TabBoxClients. - * If TabBoxMode is not TabBoxConfig::ClientTabBox an empty list will - * be returned. - * @see ClientModel::clientList - */ - TabBoxClientList clientList() const; - /** - * @param index The index of the client to be returned - * @return Returns the TabBoxClient at given model index. If - * the index is invalid, does not point to a Client or the list - * is empty, NULL will be returned. - */ - TabBoxClient* client(const QModelIndex& index) const; - /** - * @return The first model index. That is the model index at position 0, 0. - * It is valid, as desktop has at least one desktop and if there are no - * clients an empty item is created. - */ - QModelIndex first() const; - - void setEmbedded(WId wid); - WId embedded() const; - void setEmbeddedOffset(const QPoint &offset); - const QPoint &embeddedOffset() const; - void setEmbeddedSize(const QSize &size); - const QSize &embeddedSize() const; - void setEmbeddedAlignment(Qt::Alignment alignment); - Qt::Alignment embeddedAlignment() const; - void resetEmbedded(); - -signals: - /** - * This signal is fired when the TabBoxConfig changes - * @see setConfig - */ - void configChanged(); - void embeddedChanged(bool enabled); - void selectedIndexChanged(); - -private slots: - void updateHighlightWindows(); - -private: - friend class TabBoxHandlerPrivate; - TabBoxHandlerPrivate* d; -}; - -/** -* This class is a wrapper around a KWin Client. It is used for accessing the -* required client methods from inside TabBox and has to be implemented in KWin core. -* -* @author Martin Gräßlin -* @since 4.4 -*/ -class TabBoxClient -{ -public: - TabBoxClient(); - virtual ~TabBoxClient(); - - /** - * @return The caption of the client - */ - virtual QString caption() const = 0; - /** - * @param size Requested size of the icon - * @return The icon of the client - */ - virtual QPixmap icon(const QSize& size = QSize(32, 32)) const = 0; - /** - * @return The window Id of the client - */ - virtual WId window() const = 0; - /** - * @return Minimized state of the client - */ - virtual bool isMinimized() const = 0; - virtual int x() const = 0; - virtual int y() const = 0; - virtual int width() const = 0; - virtual int height() const = 0; - virtual bool isCloseable() const = 0; - virtual void close() = 0; - virtual bool isFirstInTabBox() const = 0; -}; - -/** - * Pointer to the global TabBoxHandler object. - **/ -extern TabBoxHandler* tabBox; - -} // namespace TabBox -} // namespace KWin - -#endif // TABBOXHANDLER_H diff --git a/kwin/tabbox/tests/CMakeLists.txt b/kwin/tabbox/tests/CMakeLists.txt deleted file mode 100644 index 15944b79..00000000 --- a/kwin/tabbox/tests/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -######################################################## -# Test TabBox::ClientModel -######################################################## -set( testTabBoxClientModel_SRCS - ../clientmodel.cpp - ../desktopmodel.cpp - ../tabboxconfig.cpp - ../tabboxhandler.cpp - test_tabbox_clientmodel.cpp - mock_declarative.cpp - mock_tabboxhandler.cpp - mock_tabboxclient.cpp -) - -kde4_add_test(kwin-testTabBoxClientModel ${testTabBoxClientModel_SRCS} ) - -target_link_libraries(kwin-testTabBoxClientModel KDE4::kdeui ${QT_QTDECLARATIVE_LIBRARY} ${X11_LIBRARIES} ${QT_QTTEST_LIBRARY} ) - -######################################################## -# Test TabBox::TabBoxHandler -######################################################## -set( testTabBoxHandler_SRCS - ../clientmodel.cpp - ../desktopmodel.cpp - ../tabboxconfig.cpp - ../tabboxhandler.cpp - test_tabbox_handler.cpp - mock_declarative.cpp - mock_tabboxhandler.cpp - mock_tabboxclient.cpp -) - -kde4_add_test(kwin-testTabBoxHandler ${testTabBoxHandler_SRCS}) - -target_link_libraries(kwin-testTabBoxHandler - KDE4::kdeui - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTTEST_LIBRARY} - ${X11_LIBRARIES} -) - -######################################################## -# Test TabBox::TabBoxConfig -######################################################## -set( testTabBoxConfig_SRCS - ../tabboxconfig.cpp - test_tabbox_config.cpp -) - -kde4_add_test(kwin-testTabBoxConfig ${testTabBoxConfig_SRCS}) -target_link_libraries(kwin-testTabBoxConfig ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) - - -######################################################## -# Test TabBox::DesktopChainManager -######################################################## -set( testDesktopChain_SRCS - ../desktopchain.cpp - test_desktopchain.cpp -) - -kde4_add_test(kwin-testDesktopChain ${testDesktopChain_SRCS} ) -target_link_libraries(kwin-testDesktopChain ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) diff --git a/kwin/tabbox/tests/mock_declarative.cpp b/kwin/tabbox/tests/mock_declarative.cpp deleted file mode 100644 index d25d5e76..00000000 --- a/kwin/tabbox/tests/mock_declarative.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "declarative.h" - -namespace KWin -{ -namespace TabBox -{ -DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent) - : QDeclarativeView(parent) -{ - Q_UNUSED(model) - Q_UNUSED(mode) -} - -void DeclarativeView::currentIndexChanged(int row) -{ - Q_UNUSED(row) -} - -void DeclarativeView::updateQmlSource(bool force) -{ - Q_UNUSED(force) -} - -void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnimation) -{ - Q_UNUSED(index) - Q_UNUSED(disableAnimation) -} - -bool DeclarativeView::sendKeyEvent(QKeyEvent *e) -{ - Q_UNUSED(e) - return false; -} - -void DeclarativeView::slotEmbeddedChanged(bool enabled) -{ - Q_UNUSED(enabled) -} - -void DeclarativeView::slotUpdateGeometry() -{ -} - -void DeclarativeView::slotWindowChanged(WId wId, unsigned int properties) -{ - Q_UNUSED(wId) - Q_UNUSED(properties) -} - -void DeclarativeView::showEvent(QShowEvent *event) -{ - Q_UNUSED(event) -} - -void DeclarativeView::hideEvent(QHideEvent *event) -{ - Q_UNUSED(event) -} - -bool DeclarativeView::x11Event(XEvent *e) -{ - Q_UNUSED(e) - return false; -} - -} // namespace Tabbox -} // namespace KWin - -#include "../moc_declarative.cpp" diff --git a/kwin/tabbox/tests/mock_tabboxclient.cpp b/kwin/tabbox/tests/mock_tabboxclient.cpp deleted file mode 100644 index 5b5f09ec..00000000 --- a/kwin/tabbox/tests/mock_tabboxclient.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "mock_tabboxclient.h" -#include "mock_tabboxhandler.h" - -namespace KWin -{ - -MockTabBoxClient::MockTabBoxClient(QString caption, WId id) - : TabBoxClient() - , m_caption(caption) - , m_wId(id) -{ -} - -void MockTabBoxClient::close() -{ - static_cast(TabBox::tabBox)->closeWindow(this); -} - -} // namespace KWin diff --git a/kwin/tabbox/tests/mock_tabboxclient.h b/kwin/tabbox/tests/mock_tabboxclient.h deleted file mode 100644 index ec438e60..00000000 --- a/kwin/tabbox/tests/mock_tabboxclient.h +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_MOCK_TABBOX_CLIENT_H -#define KWIN_MOCK_TABBOX_CLIENT_H - -#include "../tabboxhandler.h" -namespace KWin -{ -class MockTabBoxClient : public TabBox::TabBoxClient -{ -public: - explicit MockTabBoxClient(QString caption, WId id); - virtual bool isMinimized() const { - return false; - } - virtual QString caption() const { - return m_caption; - } - virtual void close(); - virtual int height() const { - return 100; - } - virtual QPixmap icon(const QSize &size = QSize(32, 32)) const { - return QPixmap(size); - } - virtual bool isCloseable() const { - return true; - } - virtual bool isFirstInTabBox() const { - return false; - } - virtual int width() const { - return 100; - } - virtual WId window() const { - return m_wId; - } - virtual int x() const { - return 0; - } - virtual int y() const { - return 0; - } - -private: - QString m_caption; - WId m_wId; -}; -} // namespace KWin -#endif diff --git a/kwin/tabbox/tests/mock_tabboxhandler.cpp b/kwin/tabbox/tests/mock_tabboxhandler.cpp deleted file mode 100644 index 20fe8e89..00000000 --- a/kwin/tabbox/tests/mock_tabboxhandler.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "mock_tabboxhandler.h" -#include "mock_tabboxclient.h" - -namespace KWin -{ - -MockTabBoxHandler::MockTabBoxHandler() - : TabBoxHandler() -{ -} - -MockTabBoxHandler::~MockTabBoxHandler() -{ -} - -void MockTabBoxHandler::grabbedKeyEvent(QKeyEvent *event) const -{ - Q_UNUSED(event) -} - -QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::activeClient() const -{ - return m_activeClient; -} - -void MockTabBoxHandler::setActiveClient(const QWeakPointer< TabBox::TabBoxClient >& client) -{ - m_activeClient = client; -} - -QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::clientToAddToList(TabBox::TabBoxClient *client, int desktop) const -{ - Q_UNUSED(desktop) - QList< QSharedPointer< TabBox::TabBoxClient > >::const_iterator it = m_windows.constBegin(); - for (; it != m_windows.constEnd(); ++it) { - if ((*it).data() == client) { - return QWeakPointer< TabBox::TabBoxClient >(*it); - } - } - return QWeakPointer< TabBox::TabBoxClient >(); -} - -QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::nextClientFocusChain(TabBox::TabBoxClient *client) const -{ - QList< QSharedPointer< TabBox::TabBoxClient > >::const_iterator it = m_windows.constBegin(); - for (; it != m_windows.constEnd(); ++it) { - if ((*it).data() == client) { - ++it; - if (it == m_windows.constEnd()) { - return QWeakPointer< TabBox::TabBoxClient >(m_windows.first()); - } else { - return QWeakPointer< TabBox::TabBoxClient >(*it); - } - } - } - if (!m_windows.isEmpty()) { - return QWeakPointer< TabBox::TabBoxClient >(m_windows.last()); - } - return QWeakPointer< TabBox::TabBoxClient >(); -} - -QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::firstClientFocusChain() const -{ - if (m_windows.isEmpty()) { - return QWeakPointer(); - } - return m_windows.first(); -} - -bool MockTabBoxHandler::isInFocusChain(TabBox::TabBoxClient *client) const -{ - if (!client) { - return false; - } - QList< QSharedPointer< TabBox::TabBoxClient > >::const_iterator it = m_windows.constBegin(); - for (; it != m_windows.constEnd(); ++it) { - if ((*it).data() == client) { - return true; - } - } - return false; -} - -QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::createMockWindow(const QString &caption, WId id) -{ - QSharedPointer< TabBox::TabBoxClient > client(new MockTabBoxClient(caption, id)); - m_windows.append(client); - m_activeClient = client; - return QWeakPointer< TabBox::TabBoxClient >(client); -} - -void MockTabBoxHandler::closeWindow(TabBox::TabBoxClient *client) -{ - QList< QSharedPointer< TabBox::TabBoxClient > >::iterator it = m_windows.begin(); - for (; it != m_windows.end(); ++it) { - if ((*it).data() == client) { - m_windows.erase(it); - return; - } - } -} - -} // namespace KWin diff --git a/kwin/tabbox/tests/mock_tabboxhandler.h b/kwin/tabbox/tests/mock_tabboxhandler.h deleted file mode 100644 index 15806db2..00000000 --- a/kwin/tabbox/tests/mock_tabboxhandler.h +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_MOCK_TABBOX_HANDLER_H -#define KWIN_MOCK_TABBOX_HANDLER_H - -#include "../tabboxhandler.h" -namespace KWin -{ -class MockTabBoxHandler : public TabBox::TabBoxHandler -{ - Q_OBJECT -public: - MockTabBoxHandler(); - virtual ~MockTabBoxHandler(); - virtual void activateAndClose() { - } - virtual QWeakPointer< TabBox::TabBoxClient > activeClient() const; - void setActiveClient(const QWeakPointer &client); - virtual int activeScreen() const { - return 0; - } - virtual QWeakPointer< TabBox::TabBoxClient > clientToAddToList(TabBox::TabBoxClient *client, int desktop) const; - virtual int currentDesktop() const { - return 1; - } - virtual QWeakPointer< TabBox::TabBoxClient > desktopClient() const { - return QWeakPointer(); - } - virtual QString desktopName(int desktop) const { - Q_UNUSED(desktop) - return "desktop 1"; - } - virtual QString desktopName(TabBox::TabBoxClient *client) const { - Q_UNUSED(client) - return "desktop"; - } - virtual void elevateClient(TabBox::TabBoxClient *c, WId tabbox, bool elevate) const { - Q_UNUSED(c) - Q_UNUSED(tabbox) - Q_UNUSED(elevate) - } - virtual void hideOutline() { - } - virtual QWeakPointer< TabBox::TabBoxClient > nextClientFocusChain(TabBox::TabBoxClient *client) const; - virtual QWeakPointer firstClientFocusChain() const; - virtual bool isInFocusChain (TabBox::TabBoxClient* client) const; - virtual int nextDesktopFocusChain(int desktop) const { - Q_UNUSED(desktop) - return 1; - } - virtual int numberOfDesktops() const { - return 1; - } - virtual bool isKWinCompositing() const { - return false; - } - virtual void raiseClient(TabBox::TabBoxClient *c) const { - Q_UNUSED(c) - } - virtual void restack(TabBox::TabBoxClient *c, TabBox::TabBoxClient *under) { - Q_UNUSED(c) - Q_UNUSED(under) - } - virtual void showOutline(const QRect &outline) { - Q_UNUSED(outline) - } - virtual TabBox::TabBoxClientList stackingOrder() const { - return TabBox::TabBoxClientList(); - } - virtual void grabbedKeyEvent(QKeyEvent *event) const; - - // mock methods - QWeakPointer createMockWindow(const QString &caption, WId id); - void closeWindow(TabBox::TabBoxClient *client); -private: - QList< QSharedPointer > m_windows; - QWeakPointer m_activeClient; -}; -} // namespace KWin -#endif diff --git a/kwin/tabbox/tests/test_desktopchain.cpp b/kwin/tabbox/tests/test_desktopchain.cpp deleted file mode 100644 index eb69c5bf..00000000 --- a/kwin/tabbox/tests/test_desktopchain.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ - -// KWin -#include "../desktopchain.h" - -#include - -using namespace KWin::TabBox; - -class TestDesktopChain : public QObject -{ - Q_OBJECT -private slots: - void chainInit_data(); - void chainInit(); - void chainAdd_data(); - void chainAdd(); - void resize_data(); - void resize(); - void resizeAdd(); - void useChain(); -}; - -void TestDesktopChain::chainInit_data() -{ - QTest::addColumn("size"); - QTest::addColumn("next"); - QTest::addColumn("result"); - - QTest::newRow("0/1") << (uint)0 << (uint)1 << (uint)1; - QTest::newRow("0/5") << (uint)0 << (uint)5 << (uint)1; - QTest::newRow("1/1") << (uint)1 << (uint)1 << (uint)1; - QTest::newRow("1/2") << (uint)1 << (uint)2 << (uint)1; - QTest::newRow("4/1") << (uint)4 << (uint)1 << (uint)2; - QTest::newRow("4/2") << (uint)4 << (uint)2 << (uint)3; - QTest::newRow("4/3") << (uint)4 << (uint)3 << (uint)4; - QTest::newRow("4/4") << (uint)4 << (uint)4 << (uint)1; - QTest::newRow("4/5") << (uint)4 << (uint)5 << (uint)1; - QTest::newRow("4/7") << (uint)4 << (uint)7 << (uint)1; -} - -void TestDesktopChain::chainInit() -{ - QFETCH(uint, size); - QFETCH(uint, next); - DesktopChain chain(size); - QTEST(chain.next(next), "result"); - - DesktopChainManager manager(this); - manager.resize(0, size); - QTEST(manager.next(next), "result"); -} - -void TestDesktopChain::chainAdd_data() -{ - QTest::addColumn("size"); - QTest::addColumn("add"); - QTest::addColumn("next"); - QTest::addColumn("result"); - - // invalid size, should not crash - QTest::newRow("0/1/1/1") << (uint)0 << (uint)1 << (uint)1 << (uint)1; - // moving first element to the front, shouldn't change the chain - QTest::newRow("4/1/1/2") << (uint)4 << (uint)1 << (uint)1 << (uint)2; - QTest::newRow("4/1/2/3") << (uint)4 << (uint)1 << (uint)2 << (uint)3; - QTest::newRow("4/1/3/4") << (uint)4 << (uint)1 << (uint)3 << (uint)4; - QTest::newRow("4/1/4/1") << (uint)4 << (uint)1 << (uint)4 << (uint)1; - // moving an element from middle to front, should reorder - QTest::newRow("4/3/1/1") << (uint)4 << (uint)3 << (uint)1 << (uint)2; - QTest::newRow("4/3/2/4") << (uint)4 << (uint)3 << (uint)2 << (uint)4; - QTest::newRow("4/3/3/1") << (uint)4 << (uint)3 << (uint)3 << (uint)1; - QTest::newRow("4/3/4/3") << (uint)4 << (uint)3 << (uint)4 << (uint)3; - // adding an element which does not exist - should leave the chain untouched - QTest::newRow("4/5/1/2") << (uint)4 << (uint)5 << (uint)1 << (uint)2; - QTest::newRow("4/5/2/3") << (uint)4 << (uint)5 << (uint)2 << (uint)3; - QTest::newRow("4/5/3/4") << (uint)4 << (uint)5 << (uint)3 << (uint)4; - QTest::newRow("4/5/4/1") << (uint)4 << (uint)5 << (uint)4 << (uint)1; -} - -void TestDesktopChain::chainAdd() -{ - QFETCH(uint, size); - QFETCH(uint, add); - QFETCH(uint, next); - DesktopChain chain(size); - chain.add(add); - QTEST(chain.next(next), "result"); - - DesktopChainManager manager(this); - manager.resize(0, size); - manager.addDesktop(0, add); - QTEST(manager.next(next), "result"); -} - -void TestDesktopChain::resize_data() -{ - QTest::addColumn("size"); - QTest::addColumn("add"); - QTest::addColumn("newSize"); - QTest::addColumn("next"); - QTest::addColumn("result"); - - // basic test - increment by one - QTest::newRow("1->2/1") << (uint)1 << (uint)1 << (uint)2 << (uint)1 << (uint)2; - QTest::newRow("1->2/2") << (uint)1 << (uint)1 << (uint)2 << (uint)2 << (uint)1; - // more complex test - increment by three, keep chain untouched - QTest::newRow("3->6/1") << (uint)3 << (uint)1 << (uint)6 << (uint)1 << (uint)2; - QTest::newRow("3->6/2") << (uint)3 << (uint)1 << (uint)6 << (uint)2 << (uint)3; - QTest::newRow("3->6/3") << (uint)3 << (uint)1 << (uint)6 << (uint)3 << (uint)4; - QTest::newRow("3->6/4") << (uint)3 << (uint)1 << (uint)6 << (uint)4 << (uint)5; - QTest::newRow("3->6/5") << (uint)3 << (uint)1 << (uint)6 << (uint)5 << (uint)6; - QTest::newRow("3->6/6") << (uint)3 << (uint)1 << (uint)6 << (uint)6 << (uint)1; - // increment by three, but change it before - QTest::newRow("3->6/3/1") << (uint)3 << (uint)3 << (uint)6 << (uint)1 << (uint)2; - QTest::newRow("3->6/3/2") << (uint)3 << (uint)3 << (uint)6 << (uint)2 << (uint)4; - QTest::newRow("3->6/3/3") << (uint)3 << (uint)3 << (uint)6 << (uint)3 << (uint)1; - QTest::newRow("3->6/3/4") << (uint)3 << (uint)3 << (uint)6 << (uint)4 << (uint)5; - QTest::newRow("3->6/3/5") << (uint)3 << (uint)3 << (uint)6 << (uint)5 << (uint)6; - QTest::newRow("3->6/3/6") << (uint)3 << (uint)3 << (uint)6 << (uint)6 << (uint)3; - - // basic test - decrement by one - QTest::newRow("2->1/1") << (uint)2 << (uint)1 << (uint)1 << (uint)1 << (uint)1; - QTest::newRow("2->1/2") << (uint)2 << (uint)2 << (uint)1 << (uint)1 << (uint)1; - // more complex test - decrement by three, keep chain untouched - QTest::newRow("6->3/1") << (uint)6 << (uint)1 << (uint)3 << (uint)1 << (uint)2; - QTest::newRow("6->3/2") << (uint)6 << (uint)1 << (uint)3 << (uint)2 << (uint)3; - QTest::newRow("6->3/3") << (uint)6 << (uint)1 << (uint)3 << (uint)3 << (uint)1; - // more complex test - decrement by three, move element to front - QTest::newRow("6->3/6/1") << (uint)6 << (uint)6 << (uint)3 << (uint)1 << (uint)2; - QTest::newRow("6->3/6/2") << (uint)6 << (uint)6 << (uint)3 << (uint)2 << (uint)3; - QTest::newRow("6->3/6/3") << (uint)6 << (uint)6 << (uint)3 << (uint)3 << (uint)1; -} - -void TestDesktopChain::resize() -{ - QFETCH(uint, size); - DesktopChain chain(size); - QFETCH(uint, add); - chain.add(add); - QFETCH(uint, newSize); - chain.resize(size, newSize); - QFETCH(uint, next); - QTEST(chain.next(next), "result"); - - DesktopChainManager manager(this); - manager.resize(0, size); - manager.addDesktop(0, add); - manager.resize(size, newSize); - QTEST(manager.next(next), "result"); -} - -void TestDesktopChain::resizeAdd() -{ - // test that verifies that add works after shrinking the chain - DesktopChain chain(6); - DesktopChainManager manager(this); - manager.resize(0, 6); - chain.add(4); - manager.addDesktop(0, 4); - chain.add(5); - manager.addDesktop(4, 5); - chain.add(6); - manager.addDesktop(5, 6); - QCOMPARE(chain.next(6), (uint)5); - QCOMPARE(manager.next(6), (uint)5); - QCOMPARE(chain.next(5), (uint)4); - QCOMPARE(manager.next(5), (uint)4); - QCOMPARE(chain.next(4), (uint)1); - QCOMPARE(manager.next(4), (uint)1); - chain.resize(6, 3); - manager.resize(6, 3); - QCOMPARE(chain.next(3), (uint)3); - QCOMPARE(manager.next(3), (uint)3); - QCOMPARE(chain.next(1), (uint)3); - QCOMPARE(manager.next(1), (uint)3); - QCOMPARE(chain.next(2), (uint)3); - QCOMPARE(manager.next(2), (uint)3); - // add - chain.add(1); - manager.addDesktop(3, 1); - QCOMPARE(chain.next(3), (uint)3); - QCOMPARE(manager.next(3), (uint)3); - QCOMPARE(chain.next(1), (uint)3); - QCOMPARE(manager.next(1), (uint)3); - chain.add(2); - manager.addDesktop(1, 2); - QCOMPARE(chain.next(1), (uint)3); - QCOMPARE(manager.next(1), (uint)3); - QCOMPARE(chain.next(2), (uint)1); - QCOMPARE(manager.next(2), (uint)1); - QCOMPARE(chain.next(3), (uint)2); - QCOMPARE(manager.next(3), (uint)2); -} - -void TestDesktopChain::useChain() -{ - DesktopChainManager manager(this); - manager.resize(0, 4); - manager.addDesktop(0, 3); - // creating the first chain, should keep it unchanged - manager.useChain("test"); - QCOMPARE(manager.next(3), (uint)1); - QCOMPARE(manager.next(1), (uint)2); - QCOMPARE(manager.next(2), (uint)4); - QCOMPARE(manager.next(4), (uint)3); - // but creating a second chain, should create an empty one - manager.useChain("second chain"); - QCOMPARE(manager.next(1), (uint)2); - QCOMPARE(manager.next(2), (uint)3); - QCOMPARE(manager.next(3), (uint)4); - QCOMPARE(manager.next(4), (uint)1); - // adding a desktop should only affect the currently used one - manager.addDesktop(3, 2); - QCOMPARE(manager.next(1), (uint)3); - QCOMPARE(manager.next(2), (uint)1); - QCOMPARE(manager.next(3), (uint)4); - QCOMPARE(manager.next(4), (uint)2); - // verify by switching back - manager.useChain("test"); - QCOMPARE(manager.next(3), (uint)1); - QCOMPARE(manager.next(1), (uint)2); - QCOMPARE(manager.next(2), (uint)4); - QCOMPARE(manager.next(4), (uint)3); - manager.addDesktop(3, 1); - // use second chain again and put 4th desktop to front - manager.useChain("second chain"); - manager.addDesktop(3, 4); - // just for the fun a third chain, and let's shrink it - manager.useChain("third chain"); - manager.resize(4, 3); - QCOMPARE(manager.next(1), (uint)2); - QCOMPARE(manager.next(2), (uint)3); - // it must have affected all chains - manager.useChain("test"); - QCOMPARE(manager.next(1), (uint)3); - QCOMPARE(manager.next(3), (uint)2); - QCOMPARE(manager.next(2), (uint)1); - manager.useChain("second chain"); - QCOMPARE(manager.next(3), (uint)2); - QCOMPARE(manager.next(1), (uint)3); - QCOMPARE(manager.next(2), (uint)1); -} - -QTEST_MAIN(TestDesktopChain) -#include "test_desktopchain.moc" diff --git a/kwin/tabbox/tests/test_tabbox_clientmodel.cpp b/kwin/tabbox/tests/test_tabbox_clientmodel.cpp deleted file mode 100644 index cee9860d..00000000 --- a/kwin/tabbox/tests/test_tabbox_clientmodel.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "test_tabbox_clientmodel.h" -#include "mock_tabboxhandler.h" -#include "clientmodel.h" - -#include -using namespace KWin; - -void TestTabBoxClientModel::testLongestCaptionWithNullClient() -{ - MockTabBoxHandler tabboxhandler; - TabBox::ClientModel *clientModel = new TabBox::ClientModel(&tabboxhandler); - clientModel->createClientList(); - QCOMPARE(clientModel->longestCaption(), QString()); - // add a window to the mock - tabboxhandler.createMockWindow(QString("test"), 1); - clientModel->createClientList(); - QCOMPARE(clientModel->longestCaption(), QString("test")); - // delete the one client in the list - QModelIndex index = clientModel->index(0, 0); - QVERIFY(index.isValid()); - TabBox::TabBoxClient *client = static_cast(clientModel->data(index, TabBox::ClientModel::ClientRole).value()); - client->close(); - // internal model of ClientModel now contains a deleted pointer - // longestCaption should behave just as if the window were not in the list - QCOMPARE(clientModel->longestCaption(), QString()); -} - -void TestTabBoxClientModel::testCreateClientListNoActiveClient() -{ - MockTabBoxHandler tabboxhandler; - tabboxhandler.setConfig(TabBox::TabBoxConfig()); - TabBox::ClientModel *clientModel = new TabBox::ClientModel(&tabboxhandler); - clientModel->createClientList(); - QCOMPARE(clientModel->rowCount(), 0); - // create two windows, rowCount() should go to two - QWeakPointer client = tabboxhandler.createMockWindow(QString("test"), 1); - tabboxhandler.createMockWindow(QString("test2"), 2); - clientModel->createClientList(); - QCOMPARE(clientModel->rowCount(), 2); - // let's ensure there is no active client - tabboxhandler.setActiveClient(QWeakPointer()); - // now it should still have two members in the list - clientModel->createClientList(); - QCOMPARE(clientModel->rowCount(), 2); -} - -void TestTabBoxClientModel::testCreateClientListActiveClientNotInFocusChain() -{ - MockTabBoxHandler tabboxhandler; - tabboxhandler.setConfig(TabBox::TabBoxConfig()); - TabBox::ClientModel *clientModel = new TabBox::ClientModel(&tabboxhandler); - // create two windows, rowCount() should go to two - QWeakPointer client = tabboxhandler.createMockWindow(QString("test"), 1); - client = tabboxhandler.createMockWindow(QString("test2"), 2); - clientModel->createClientList(); - QCOMPARE(clientModel->rowCount(), 2); - - // simulate that the active client is not in the focus chain - // for that we use the closeWindow of the MockTabBoxHandler which - // removes the Client from the Focus Chain but leaves the active window as it is - QSharedPointer clientOwner = client.toStrongRef(); - tabboxhandler.closeWindow(client.data()); - clientModel->createClientList(); - QCOMPARE(clientModel->rowCount(), 1); -} - -QTEST_MAIN(TestTabBoxClientModel) diff --git a/kwin/tabbox/tests/test_tabbox_clientmodel.h b/kwin/tabbox/tests/test_tabbox_clientmodel.h deleted file mode 100644 index fad79874..00000000 --- a/kwin/tabbox/tests/test_tabbox_clientmodel.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef TEST_TABBOX_CLIENT_MODEL_H -#define TEST_TABBOX_CLIENT_MODEL_H -#include - -class TestTabBoxClientModel : public QObject -{ - Q_OBJECT -private slots: - /** - * Tests that calculating the longest caption does not - * crash in case the internal m_clientList contains a weak - * pointer to a deleted TabBoxClient. - * - * See bug #303840 - **/ - void testLongestCaptionWithNullClient(); - /** - * Tests the creation of the Client list for the case that - * there is no active Client, but that Clients actually exist. - * - * See BUG: 305449 - **/ - void testCreateClientListNoActiveClient(); - /** - * Tests the creation of the Client list for the case that - * the active Client is not in the Focus chain. - * - * See BUG: 306260 - **/ - void testCreateClientListActiveClientNotInFocusChain(); -}; - -#endif diff --git a/kwin/tabbox/tests/test_tabbox_config.cpp b/kwin/tabbox/tests/test_tabbox_config.cpp deleted file mode 100644 index be63bfbb..00000000 --- a/kwin/tabbox/tests/test_tabbox_config.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "../tabboxconfig.h" -#include -using namespace KWin; -using namespace KWin::TabBox; - -class TestTabBoxConfig : public QObject -{ - Q_OBJECT -private slots: - void testDefaultCtor(); - void testAssignmentOperator(); -}; - -void TestTabBoxConfig::testDefaultCtor() -{ - TabBoxConfig config; - QCOMPARE(config.isShowTabBox(), TabBoxConfig::defaultShowTabBox()); - QCOMPARE(config.isHighlightWindows(), TabBoxConfig::defaultHighlightWindow()); - QCOMPARE(config.tabBoxMode(), TabBoxConfig::ClientTabBox); - QCOMPARE(config.clientDesktopMode(), TabBoxConfig::defaultDesktopMode()); - QCOMPARE(config.clientApplicationsMode(), TabBoxConfig::defaultApplicationsMode()); - QCOMPARE(config.clientMinimizedMode(), TabBoxConfig::defaultMinimizedMode()); - QCOMPARE(config.showDesktopMode(), TabBoxConfig::defaultShowDesktopMode()); - QCOMPARE(config.clientMultiScreenMode(), TabBoxConfig::defaultMultiScreenMode()); - QCOMPARE(config.clientSwitchingMode(), TabBoxConfig::defaultSwitchingMode()); - QCOMPARE(config.desktopSwitchingMode(), TabBoxConfig::MostRecentlyUsedDesktopSwitching); - QCOMPARE(config.layoutName(), TabBoxConfig::defaultLayoutName()); -} - -void TestTabBoxConfig::testAssignmentOperator() -{ - TabBoxConfig config; - // changing all values of the config object - config.setShowTabBox(!TabBoxConfig::defaultShowTabBox()); - config.setHighlightWindows(!TabBoxConfig::defaultHighlightWindow()); - config.setTabBoxMode(TabBoxConfig::DesktopTabBox); - config.setClientDesktopMode(TabBoxConfig::AllDesktopsClients); - config.setClientApplicationsMode(TabBoxConfig::OneWindowPerApplication); - config.setClientMinimizedMode(TabBoxConfig::ExcludeMinimizedClients); - config.setShowDesktopMode(TabBoxConfig::ShowDesktopClient); - config.setClientMultiScreenMode(TabBoxConfig::ExcludeCurrentScreenClients); - config.setClientSwitchingMode(TabBoxConfig::StackingOrderSwitching); - config.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching); - config.setLayoutName(QString("grid")); - TabBoxConfig config2; - config2 = config; - // verify the config2 values - QCOMPARE(config2.isShowTabBox(), !TabBoxConfig::defaultShowTabBox()); - QCOMPARE(config2.isHighlightWindows(), !TabBoxConfig::defaultHighlightWindow()); - QCOMPARE(config2.tabBoxMode(), TabBoxConfig::DesktopTabBox); - QCOMPARE(config2.clientDesktopMode(), TabBoxConfig::AllDesktopsClients); - QCOMPARE(config2.clientApplicationsMode(), TabBoxConfig::OneWindowPerApplication); - QCOMPARE(config2.clientMinimizedMode(), TabBoxConfig::ExcludeMinimizedClients); - QCOMPARE(config2.showDesktopMode(), TabBoxConfig::ShowDesktopClient); - QCOMPARE(config2.clientMultiScreenMode(), TabBoxConfig::ExcludeCurrentScreenClients); - QCOMPARE(config2.clientSwitchingMode(), TabBoxConfig::StackingOrderSwitching); - QCOMPARE(config2.desktopSwitchingMode(), TabBoxConfig::StaticDesktopSwitching); - QCOMPARE(config2.layoutName(), QString("grid")); -} - -QTEST_MAIN(TestTabBoxConfig) - -#include "test_tabbox_config.moc" diff --git a/kwin/tabbox/tests/test_tabbox_handler.cpp b/kwin/tabbox/tests/test_tabbox_handler.cpp deleted file mode 100644 index ff624ab8..00000000 --- a/kwin/tabbox/tests/test_tabbox_handler.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "mock_tabboxhandler.h" -#include "clientmodel.h" -#include - -using namespace KWin; - -class TestTabBoxHandler : public QObject -{ - Q_OBJECT -private slots: - /** - * Test to verify that update outline does not crash - * if the ModelIndex for which the outline should be - * shown is not valid. That is accessing the Pointer - * to the Client returns an invalid QVariant. - * BUG: 304620 - **/ - void testDontCrashUpdateOutlineNullClient(); -}; - -void TestTabBoxHandler::testDontCrashUpdateOutlineNullClient() -{ - MockTabBoxHandler tabboxhandler; - TabBox::TabBoxConfig config; - config.setTabBoxMode(TabBox::TabBoxConfig::ClientTabBox); - config.setShowTabBox(false); - config.setHighlightWindows(false); - tabboxhandler.setConfig(config); - // now show the tabbox which will attempt to show the outline - tabboxhandler.show(); -} - -QTEST_MAIN(TestTabBoxHandler) - -#include "test_tabbox_handler.moc" diff --git a/kwin/tabgroup.cpp b/kwin/tabgroup.cpp index 30538d07..844454a2 100644 --- a/kwin/tabgroup.cpp +++ b/kwin/tabgroup.cpp @@ -102,10 +102,6 @@ bool TabGroup::add(Client* c, Client *other, bool after, bool becomeVisible) // Actually add to new group ---------------------------------------- - // Notify effects of merge - if (effects) - static_cast(effects)->slotTabAdded(c->effectWindow(), other->effectWindow()); - // next: aling the client states BEFORE adding it to the group // otherwise the caused indirect state changes would be taken as the dominating ones and break // the main client @@ -171,15 +167,8 @@ bool TabGroup::remove(Client* c) if (c == m_current) { m_current = index < m_clients.count() ? m_clients.at(index) : m_clients.last(); m_current->setClientShown(true); - - if (effects) // "c -> m_current" because c was m_current - static_cast(effects)->slotCurrentTabAboutToChange(c->effectWindow(), m_current->effectWindow()); } - // Notify effects of removal - if (effects) - static_cast(effects)->slotTabRemoved(c->effectWindow(), m_current->effectWindow()); - m_current->triggerDecorationRepaint(); return true; } @@ -232,10 +221,6 @@ void TabGroup::setCurrent(Client* c, bool force) if ((c == m_current && !force) || !contains(c)) return; - // Notify effects of switch - if (effects) - static_cast(effects)->slotCurrentTabAboutToChange(m_current->effectWindow(), c->effectWindow()); - m_current = c; c->setClientShown(true); // reduce flicker? for (ClientList::const_iterator i = m_clients.constBegin(), end = m_clients.constEnd(); i != end; ++i) diff --git a/kwin/tests/test_update_kwin_49.cpp b/kwin/tests/test_update_kwin_49.cpp deleted file mode 100644 index 4042259d..00000000 --- a/kwin/tests/test_update_kwin_49.cpp +++ /dev/null @@ -1,543 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "../data/update_kwin_49.h" -#include "../tabbox/tabboxconfig.h" - -#include - -#include - -class TestUpdateKWin49 : public QObject -{ - Q_OBJECT -private slots: - /** - * Tests that migrating the Present Windows TabBox settings - * does not affect an empty configuration. - **/ - void testEmptyKConfigPW(); - /** - * Tests that the migration of Present Windows TabBox settings for a - * disabled Present Windows effect does not affect the configuration. - **/ - void testPWDisabled(); - /** - * Tests that the migration of Present Window TabBox settings for an - * enabled Present Windows effect with disabled TabBox does not affect the configuration. - **/ - void testPWEnabledTabBoxDisabled(); - /** - * Tests that the migration of Present Windows TabBox settings - * properly sets the layout in TabBox. - **/ - void testPWTabBoxEnabled(); - /** - * Tests that the migration of Present Windows TabBox settings - * properly sets the layout in TabBoxAlternative. - **/ - void testPWTabBoxAlternativeEnabled(); - /** - * Tests that the migration of Present Windows TabBox settings - * properly sets the layout in both TabBox and TabBoxAlternative. - **/ - void testPWBothEnabled(); - /** - * Test that migrating the Desktop Change OSD settings - * does not affect an empty configuration - **/ - void testEmptyKConfigOSD(); - /** - * Tests that migrating the Desktop Change OSD settings - * with a disabled PopupInfo does not affect KConfig. - **/ - void testPopupInfoDisabled(); - /** - * Tests that migrating the Desktop Change OSD settings - * with a disabled PopupInfo migrates only the config parameters. - **/ - void testPopupInfoDisabledAdditionalKeys(); - /** - * Tests that migrating the Desktop Change OSD settings - * with a disabled PopupInfo migrates only the config parameters which have default values. - **/ - void testPopupInfoDisabledAdditionalKeysDefault(); - /** - * Tests that migrating the Desktop Change OSD settings - * enables the script. - **/ - void testPopupInfoEnabled(); - /** - * Tests that migrating the Desktop Change OSD settings - * enables the script and migrates the settings. - **/ - void testPopupInfoEnabledAdditionalKeys(); - /** - * Tests that attempting to migrate Desktop Change OSD settings - * again will not overwrite existing settings. - **/ - void testPopupInfoAlreadyMigrated(); - /** - * Tests that migrating TabBox does not change an empty KConfig. - **/ - void testEmptyKConfigTabBox(); - /** - * Tests the migration of TabBox setting show desktop. - **/ - void testTabBoxShowDesktopEnabled(); - /** - * Tests the migration of TabBox setting show desktop. - **/ - void testTabBoxShowDesktopDisabled(); - /** - * Tests the migration of the various TabBox ListMode settings. - **/ - void testTabBoxCurrentDesktopClientList(); - void testTabBoxCurrentDesktopApplicationList(); - void testTabBoxAllDesktopsClientList(); - void testTabBoxAllDesktopsApplicationList(); - /** - * Tests that attempting to migrate TabBox settings again will not - * overwrite existing settings. - **/ - void testTabBoxAlreadyMigrated(); -}; - -void TestUpdateKWin49::testEmptyKConfigPW() -{ - KConfig config(QString(), KConfig::SimpleConfig); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testPWDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup plugins = config.group("Plugins"); - plugins.writeEntry("kwin4_effect_presentwindowsEnabled", false); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(!plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(!plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testPWEnabledTabBoxDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup plugins = config.group("Plugins"); - plugins.writeEntry("kwin4_effect_presentwindowsEnabled", true); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - // same with TabBox explicitly disabled - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBox", false); - pw.writeEntry("TabBoxAlternative", false); - QVERIFY(pw.hasKey("TabBox")); - QVERIFY(pw.hasKey("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testPWTabBoxEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBox", true); - QVERIFY(pw.hasKey("TabBox")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(config.hasGroup("TabBox")); - KConfigGroup tabBox = config.group("TabBox"); - QVERIFY(tabBox.hasKey("LayoutName")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - // test same with an explicit layout set - tabBox.writeEntry("LayoutName", "informative"); - pw.writeEntry("TabBox", true); - migratePresentWindowsTabBox(config); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); -} - -void TestUpdateKWin49::testPWTabBoxAlternativeEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBoxAlternative", true); - QVERIFY(pw.hasKey("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(config.hasGroup("TabBoxAlternative")); - KConfigGroup tabBox = config.group("TabBoxAlternative"); - QVERIFY(tabBox.hasKey("LayoutName")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - QVERIFY(!config.hasGroup("TabBox")); - // test same with an explicit layout set - tabBox.writeEntry("LayoutName", "informative"); - pw.writeEntry("TabBoxAlternative", true); - migratePresentWindowsTabBox(config); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); -} - -void TestUpdateKWin49::testPWBothEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBox", true); - pw.writeEntry("TabBoxAlternative", true); - QVERIFY(pw.hasKey("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - QVERIFY(pw.hasKey("TabBox")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(config.hasGroup("TabBox")); - QVERIFY(config.hasGroup("TabBoxAlternative")); - KConfigGroup tabBox = config.group("TabBox"); - QVERIFY(tabBox.hasKey("LayoutName")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - QVERIFY(tabBoxAlternative.hasKey("LayoutName")); - QVERIFY(tabBoxAlternative.readEntry("LayoutName", "thumbnails") == "present_windows"); - // test same with an explicit layout set - tabBox.writeEntry("LayoutName", "informative"); - tabBoxAlternative.writeEntry("LayoutName", "informative"); - pw.writeEntry("TabBox", true); - pw.writeEntry("TabBoxAlternative", true); - migratePresentWindowsTabBox(config); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - QVERIFY(tabBoxAlternative.readEntry("LayoutName", "thumbnails") == "present_windows"); -} - -void TestUpdateKWin49::testEmptyKConfigOSD() -{ - KConfig config(QString(), KConfig::SimpleConfig); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); -} - -void TestUpdateKWin49::testPopupInfoDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", false); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(popupInfo.hasKey("ShowPopup")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); -} - -void TestUpdateKWin49::testPopupInfoDisabledAdditionalKeys() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("TextOnly", false); - popupInfo.writeEntry("PopupHideDelay", 1000); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(popupInfo.hasKey("TextOnly")); - QVERIFY(popupInfo.hasKey("PopupHideDelay")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!popupInfo.hasKey("TextOnly")); - QVERIFY(!popupInfo.hasKey("PopupHideDelay")); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - QVERIFY(osd.hasKey("TextOnly")); - QVERIFY(osd.hasKey("PopupHideDelay")); - QVERIFY(!osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 1000); -} - -void TestUpdateKWin49::testPopupInfoDisabledAdditionalKeysDefault() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("TextOnly", true); - popupInfo.writeEntry("PopupHideDelay", 200); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(popupInfo.hasKey("TextOnly")); - QVERIFY(popupInfo.hasKey("PopupHideDelay")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!popupInfo.hasKey("TextOnly")); - QVERIFY(!popupInfo.hasKey("PopupHideDelay")); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - QVERIFY(osd.hasKey("TextOnly")); - QVERIFY(osd.hasKey("PopupHideDelay")); - QVERIFY(osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 200); -} - -void TestUpdateKWin49::testPopupInfoEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", true); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(popupInfo.hasKey("ShowPopup")); - migrateDesktopChangeOSD(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - KConfigGroup plugins = config.group("Plugins"); - QVERIFY(plugins.hasKey("desktopchangeosdEnabled")); - QVERIFY(plugins.readEntry("desktopchangeosdEnabled", false)); -} - -void TestUpdateKWin49::testPopupInfoEnabledAdditionalKeys() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", true); - popupInfo.writeEntry("TextOnly", true); - popupInfo.writeEntry("PopupHideDelay", 2000); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(popupInfo.hasKey("ShowPopup")); - QVERIFY(popupInfo.hasKey("TextOnly")); - QVERIFY(popupInfo.hasKey("PopupHideDelay")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!popupInfo.hasKey("TextOnly")); - QVERIFY(!popupInfo.hasKey("PopupHideDelay")); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - QVERIFY(osd.hasKey("TextOnly")); - QVERIFY(osd.hasKey("PopupHideDelay")); - QVERIFY(osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 2000); - KConfigGroup plugins = config.group("Plugins"); - QVERIFY(plugins.hasKey("desktopchangeosdEnabled")); - QVERIFY(plugins.readEntry("desktopchangeosdEnabled", false)); -} - -void TestUpdateKWin49::testPopupInfoAlreadyMigrated() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", true); - popupInfo.writeEntry("TextOnly", false); - popupInfo.writeEntry("PopupHideDelay", 2000); - KConfigGroup plugins = config.group("Plugins"); - plugins.writeEntry("desktopchangeosdEnabled", false); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - osd.writeEntry("TextOnly", true); - osd.writeEntry("PopupHideDelay", 200); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!plugins.readEntry("desktopchangeosdEnabled", false)); - QVERIFY(osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 200); -} - -void TestUpdateKWin49::testEmptyKConfigTabBox() -{ - KConfig config(QString(), KConfig::SimpleConfig); - QVERIFY(!config.hasGroup("TabBox")); - migrateTabBoxConfig(config.group("TabBox")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migrateTabBoxConfig(config.group("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testTabBoxShowDesktopDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ShowDesktop", false); - tabBoxAlternative.writeEntry("ShowDesktop", false); - QVERIFY(!tabBox.hasKey("ShowDesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ShowDesktop")); - QVERIFY(tabBox.hasKey("ShowDesktopMode")); - QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient); - QVERIFY(tabBoxAlternative.hasKey("ShowDesktop")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); -} - -void TestUpdateKWin49::testTabBoxShowDesktopEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ShowDesktop", true); - tabBoxAlternative.writeEntry("ShowDesktop", true); - QVERIFY(!tabBox.hasKey("ShowDesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ShowDesktop")); - QVERIFY(tabBox.hasKey("ShowDesktopMode")); - QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::ShowDesktopClient); - QVERIFY(tabBoxAlternative.hasKey("ShowDesktop")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); -} - -void TestUpdateKWin49::testTabBoxAllDesktopsApplicationList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 3); - tabBoxAlternative.writeEntry("ListMode", 3); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxAllDesktopsClientList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 1); - tabBoxAlternative.writeEntry("ListMode", 1); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxCurrentDesktopApplicationList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 2); - tabBoxAlternative.writeEntry("ListMode", 2); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::OnlyCurrentDesktopClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxCurrentDesktopClientList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 0); - tabBoxAlternative.writeEntry("ListMode", 0); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::OnlyCurrentDesktopClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxAlreadyMigrated() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - tabBox.writeEntry("ListMode", 0); - tabBox.writeEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::AllDesktopsClients)); - tabBox.writeEntry("ShowDesktop", true); - tabBox.writeEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient)); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(!tabBox.hasKey("ShowDesktop")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients); - QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient); -} - -QTEST_MAIN(TestUpdateKWin49) -#include "test_update_kwin_49.moc" diff --git a/kwin/thumbnailitem.cpp b/kwin/thumbnailitem.cpp deleted file mode 100644 index 2dbfc624..00000000 --- a/kwin/thumbnailitem.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ - -#include "thumbnailitem.h" -// KWin -#include "client.h" -#include "composite.h" -#include "effects.h" -#include "workspace.h" -#include "composite.h" -// Qt -#include -#include -#include -// KDE -#include - -namespace KWin -{ - -AbstractThumbnailItem::AbstractThumbnailItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_clip(true) - , m_parent(QWeakPointer()) - , m_parentWindow(0) - , m_brightness(1.0) - , m_saturation(1.0) -{ - setFlags(flags() & ~QGraphicsItem::ItemHasNoContents); - Q_ASSERT(Compositor::isCreated()); - connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingToggled())); - compositingToggled(); - QTimer::singleShot(0, this, SLOT(init())); -} - -AbstractThumbnailItem::~AbstractThumbnailItem() -{ -} - -void AbstractThumbnailItem::compositingToggled() -{ - m_parent.clear(); - if (effects) { - connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), SLOT(effectWindowAdded())); - connect(effects, SIGNAL(windowDamaged(KWin::EffectWindow*,QRect)), SLOT(repaint(KWin::EffectWindow*))); - effectWindowAdded(); - } -} - -void AbstractThumbnailItem::init() -{ - findParentEffectWindow(); - if (!m_parent.isNull()) { - m_parent.data()->registerThumbnail(this); - } -} - -void AbstractThumbnailItem::setParentWindow(qulonglong parentWindow) -{ - m_parentWindow = parentWindow; - findParentEffectWindow(); - if (!m_parent.isNull()) { - m_parent.data()->registerThumbnail(this); - } -} - -void AbstractThumbnailItem::findParentEffectWindow() -{ - if (effects) { - if (m_parentWindow) { - if (EffectWindowImpl *w = static_cast(effects->findWindow(m_parentWindow))) { - m_parent = QWeakPointer(w); - return; - } - } - QDeclarativeContext *ctx = QDeclarativeEngine::contextForObject(this); - if (!ctx) { - kDebug(1212) << "No Context"; - return; - } - const QVariant variant = ctx->engine()->rootContext()->contextProperty("viewId"); - if (!variant.isValid()) { - kDebug(1212) << "Required context property 'viewId' not found"; - return; - } - if (EffectWindowImpl *w = static_cast(effects->findWindow(variant.value()))) { - m_parent = QWeakPointer(w); - m_parentWindow = variant.value(); - } - } -} - -void AbstractThumbnailItem::setClip(bool clip) -{ - m_clip = clip; - emit clipChanged(clip); -} - -void AbstractThumbnailItem::effectWindowAdded() -{ - // the window might be added before the EffectWindow is created - // by using this slot we can register the thumbnail when it is finally created - if (m_parent.isNull()) { - findParentEffectWindow(); - if (!m_parent.isNull()) { - m_parent.data()->registerThumbnail(this); - } - } -} - -void AbstractThumbnailItem::setBrightness(qreal brightness) -{ - if (qFuzzyCompare(brightness, m_brightness)) { - return; - } - m_brightness = brightness; - update(); - emit brightnessChanged(); -} - -void AbstractThumbnailItem::setSaturation(qreal saturation) -{ - if (qFuzzyCompare(saturation, m_saturation)) { - return; - } - m_saturation = saturation; - update(); - emit saturationChanged(); -} - - -WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent) - : AbstractThumbnailItem(parent) - , m_wId(0) - , m_client(NULL) -{ -} - -WindowThumbnailItem::~WindowThumbnailItem() -{ -} - -void WindowThumbnailItem::setWId(qulonglong wId) -{ - if (m_wId == wId) { - return; - } - m_wId = wId; - if (m_wId != 0) { - setClient(Workspace::self()->findClient(WindowMatchPredicate(m_wId))); - } else if (m_client) { - m_client = NULL; - emit clientChanged(); - } - emit wIdChanged(wId); -} - -void WindowThumbnailItem::setClient(Client *client) -{ - if (m_client == client) { - return; - } - m_client = client; - if (m_client) { - setWId(m_client->window()); - } else { - setWId(0); - } - emit clientChanged(); -} - -void WindowThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - if (effects) { - QDeclarativeItem::paint(painter, option, widget); - return; - } - Client *client = Workspace::self()->findClient(WindowMatchPredicate(m_wId)); - if (!client) { - QDeclarativeItem::paint(painter, option, widget); - return; - } - QPixmap pixmap = client->icon(boundingRect().size().toSize()); - const QSize size(boundingRect().size().toSize() - pixmap.size()); - painter->drawPixmap(boundingRect().adjusted(size.width()/2.0, size.height()/2.0, -size.width()/2.0, -size.height()/2.0).toRect(), - pixmap); -} - -void WindowThumbnailItem::repaint(KWin::EffectWindow *w) -{ - if (static_cast(w)->window()->window() == m_wId) { - update(); - } -} - -DesktopThumbnailItem::DesktopThumbnailItem(QDeclarativeItem *parent) - : AbstractThumbnailItem(parent) - , m_desktop(0) -{ -} - -DesktopThumbnailItem::~DesktopThumbnailItem() -{ -} - -void DesktopThumbnailItem::setDesktop(int desktop) -{ - desktop = qBound(1, desktop, VirtualDesktopManager::self()->count()); - if (desktop == m_desktop) { - return; - } - m_desktop = desktop; - update(); - emit desktopChanged(m_desktop); -} - -void DesktopThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - if (effects) { - QDeclarativeItem::paint(painter, option, widget); - return; - } - // TODO: render icon -} - -void DesktopThumbnailItem::repaint(EffectWindow *w) -{ - if (w->isOnDesktop(m_desktop)) { - update(); - } -} - -} // namespace KWin diff --git a/kwin/thumbnailitem.h b/kwin/thumbnailitem.h deleted file mode 100644 index 0e75709a..00000000 --- a/kwin/thumbnailitem.h +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2011 Martin Gräßlin - -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, see . -*********************************************************************/ - -#ifndef KWIN_THUMBNAILITEM_H -#define KWIN_THUMBNAILITEM_H - -#include -#include - -namespace KWin -{ - -class Client; -class EffectWindow; -class EffectWindowImpl; - -class AbstractThumbnailItem : public QDeclarativeItem -{ - Q_OBJECT - Q_PROPERTY(bool clip READ isClip WRITE setClip NOTIFY clipChanged SCRIPTABLE true) - Q_PROPERTY(qulonglong parentWindow READ parentWindow WRITE setParentWindow) - Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) - Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) -public: - virtual ~AbstractThumbnailItem(); - bool isClip() const { - return m_clip; - } - void setClip(bool clip); - qulonglong parentWindow() const { - return m_parentWindow; - } - void setParentWindow(qulonglong parentWindow); - qreal brightness() const; - qreal saturation() const; - -public Q_SLOTS: - void setBrightness(qreal brightness); - void setSaturation(qreal saturation); - -Q_SIGNALS: - void clipChanged(bool clipped); - void brightnessChanged(); - void saturationChanged(); - -protected: - explicit AbstractThumbnailItem(QDeclarativeItem *parent = 0); - -protected Q_SLOTS: - virtual void repaint(KWin::EffectWindow* w) = 0; - -private Q_SLOTS: - void init(); - void effectWindowAdded(); - void compositingToggled(); - -private: - void findParentEffectWindow(); - bool m_clip; - QWeakPointer m_parent; - qulonglong m_parentWindow; - qreal m_brightness; - qreal m_saturation; -}; - -class WindowThumbnailItem : public AbstractThumbnailItem -{ - Q_OBJECT - Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) - Q_PROPERTY(KWin::Client *client READ client WRITE setClient NOTIFY clientChanged) -public: - explicit WindowThumbnailItem(QDeclarativeItem *parent = 0); - virtual ~WindowThumbnailItem(); - - qulonglong wId() const { - return m_wId; - } - void setWId(qulonglong wId); - Client *client() const; - void setClient(Client *client); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); -Q_SIGNALS: - void wIdChanged(qulonglong wid); - void clientChanged(); -protected Q_SLOTS: - virtual void repaint(KWin::EffectWindow* w); -private: - qulonglong m_wId; - Client *m_client; -}; - -class DesktopThumbnailItem : public AbstractThumbnailItem -{ - Q_OBJECT - Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged) -public: - DesktopThumbnailItem(QDeclarativeItem *parent = 0); - virtual ~DesktopThumbnailItem(); - - int desktop() const { - return m_desktop; - } - void setDesktop(int desktop); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); -Q_SIGNALS: - void desktopChanged(int desktop); -protected Q_SLOTS: - virtual void repaint(KWin::EffectWindow* w); -private: - int m_desktop; -}; - -inline -qreal AbstractThumbnailItem::brightness() const -{ - return m_brightness; -} - -inline -qreal AbstractThumbnailItem::saturation() const -{ - return m_saturation; -} - -inline -Client *WindowThumbnailItem::client() const -{ - return m_client; -} - -} // KWin - -#endif // KWIN_THUMBNAILITEM_H diff --git a/kwin/useractions.cpp b/kwin/useractions.cpp index 4618aa4b..d7d86723 100755 --- a/kwin/useractions.cpp +++ b/kwin/useractions.cpp @@ -72,9 +72,6 @@ along with this program. If not, see . #include #include "killwindow.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif namespace KWin { @@ -215,9 +212,6 @@ static QStringList configModules() args << "kwindecoration"; args << "kwinactions" << "kwinfocus" << "kwinmoving" << "kwinadvanced" << "kwinrules" << "kwincompositing" -#ifdef KWIN_BUILD_TABBOX - << "kwintabbox" -#endif #ifdef KWIN_BUILD_SCREENEDGES << "kwinscreenedges" #endif @@ -827,9 +821,6 @@ void Workspace::initShortcuts() //disable_shortcuts_keys->disableBlocking( true ); #define IN_KWIN #include "kwinbindings.cpp" -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox::self()->initShortcuts(actionCollection); -#endif VirtualDesktopManager::self()->initShortcuts(actionCollection); m_userActionsMenu->discard(); // so that it's recreated next time } diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp index 7a214c33..8d55e831 100644 --- a/kwin/workspace.cpp +++ b/kwin/workspace.cpp @@ -41,9 +41,6 @@ along with this program. If not, see . #include "screenedge.h" #endif #include "screens.h" -#ifdef KWIN_BUILD_TABBOX -#include "tabbox.h" -#endif #include "unmanaged.h" #include "useractions.h" #include "virtualdesktops.h" @@ -178,15 +175,9 @@ Workspace::Workspace(bool restore) #endif // VirtualDesktopManager needs to be created prior to init shortcuts - // and prior to TabBox, due to TabBox connecting to signals - // actual initialization happens in init() + // due to actual initialization happening in init() VirtualDesktopManager::create(this); -#ifdef KWIN_BUILD_TABBOX - // need to create the tabbox before compositing scene is setup - TabBox::TabBox::create(this); -#endif - m_compositor = Compositor::create(this); connect(this, SIGNAL(currentDesktopChanged(int,KWin::Client*)), m_compositor, SLOT(addRepaintFull())); connect(m_compositor, SIGNAL(compositingToggled(bool)), decorationPlugin(), SLOT(resetCompositing())); @@ -497,10 +488,6 @@ void Workspace::addClient(Client* c) if (c->isUtility() || c->isMenu() || c->isToolbar()) updateToolWindows(true); checkNonExistentClients(); -#ifdef KWIN_BUILD_TABBOX - if (TabBox::TabBox::self()->isDisplayed()) - TabBox::TabBox::self()->reset(true); -#endif } void Workspace::addUnmanaged(Unmanaged* c) @@ -531,12 +518,6 @@ void Workspace::removeClient(Client* c) clientShortcutUpdated(c); // Needed, since this is otherwise delayed by setShortcut() and wouldn't run } -#ifdef KWIN_BUILD_TABBOX - TabBox::TabBox *tabBox = TabBox::TabBox::self(); - if (tabBox->isDisplayed() && tabBox->currentClient() == c) - tabBox->nextPrev(true); -#endif - Q_ASSERT(clients.contains(c) || desktops.contains(c)); // TODO: if marked client is removed, notify the marked list clients.removeAll(c); @@ -561,11 +542,6 @@ void Workspace::removeClient(Client* c) updateStackingOrder(true); -#ifdef KWIN_BUILD_TABBOX - if (tabBox->isDisplayed()) - tabBox->reset(true); -#endif - updateClientArea(); } diff --git a/libs/ksysguard/processui/CMakeLists.txt b/libs/ksysguard/processui/CMakeLists.txt index 176d7d5c..3a312c3b 100644 --- a/libs/ksysguard/processui/CMakeLists.txt +++ b/libs/ksysguard/processui/CMakeLists.txt @@ -20,7 +20,6 @@ if(X11_XRes_FOUND) include_directories(${X11_XRes_INCLUDE_PATH}) endif() -target_link_libraries(processui PRIVATE ${QT_QTSCRIPT_LIBRARY}) target_link_libraries(processui PUBLIC KDE4::kdeui processcore) set_target_properties(processui diff --git a/libs/plasmagenericshell/CMakeLists.txt b/libs/plasmagenericshell/CMakeLists.txt index c4373bd5..35e8f999 100644 --- a/libs/plasmagenericshell/CMakeLists.txt +++ b/libs/plasmagenericshell/CMakeLists.txt @@ -12,14 +12,6 @@ set(plasmagenericshell_LIB_SRCS panelshadows.cpp toolbutton.cpp wallpaperpreview.cpp - scripting/appinterface.cpp - scripting/applet.cpp - scripting/containment.cpp - scripting/configgroup.cpp - scripting/i18n.cpp - scripting/rect.cpp - scripting/scriptengine.cpp - scripting/widget.cpp widgetsexplorer/widgetexplorer.cpp BackgroundDialog.ui MousePlugins.ui @@ -32,9 +24,6 @@ target_link_libraries(plasmagenericshell PUBLIC KDE4::kdeui KDE4::kfile KDE4::solid - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTUITOOLS_LIBRARY} kworkspace ) target_link_libraries(plasmagenericshell PRIVATE ${X11_LIBRARIES}) diff --git a/libs/plasmagenericshell/Messages.sh b/libs/plasmagenericshell/Messages.sh index faba9d0b..63f91d57 100755 --- a/libs/plasmagenericshell/Messages.sh +++ b/libs/plasmagenericshell/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC *.ui >> rc.cpp -$XGETTEXT `find . -name \*.cpp -o -name \*.h -o -name \*.qml | grep -v '/tests/'` -o $podir/plasmagenericshell.pot +$XGETTEXT `find . -name \*.cpp -o -name \*.h` -o $podir/plasmagenericshell.pot rm -f rc.cpp diff --git a/libs/plasmagenericshell/backgrounddialog.cpp b/libs/plasmagenericshell/backgrounddialog.cpp index 1fd75f3d..f749af77 100644 --- a/libs/plasmagenericshell/backgrounddialog.cpp +++ b/libs/plasmagenericshell/backgrounddialog.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -79,30 +78,6 @@ public: KPageWidgetItem *appearanceItem; KPageWidgetItem *mouseItem; bool modified; - - void createConfigurationInterfaceForPackage() - { - const QString uiFile = containment.data()->package()->filePath("mainconfigui"); - if (uiFile.isEmpty()) { - kWarning() << "No ui file found for containment"; - return; - } - Plasma::ConfigLoader *configScheme = containment.data()->configScheme(); - if (!configScheme) { - kWarning() << "No configuration scheme found for containment"; - return; - } - - QFile f(uiFile); - QUiLoader loader; - QWidget *widget = loader.load(&f); - if (widget) { - q->addPage(widget, configScheme, - i18n("Settings"), containment.data()->icon(), i18n("%1 Settings", containment.data()->name())); - } else { - kWarning() << "Failed to load widget from" << uiFile; - } - } }; BackgroundDialog::BackgroundDialog(const QSize& res, Plasma::Containment *c, Plasma::View* view, @@ -148,11 +123,7 @@ BackgroundDialog::BackgroundDialog(const QSize& res, Plasma::Containment *c, Pla d->mouseItem = addPage(m, i18n("Mouse Actions"), "input-mouse"); if (d->containment && d->containment.data()->hasConfigurationInterface()) { - if (d->containment.data()->package()) { - d->createConfigurationInterfaceForPackage(); - } else { - d->containment.data()->createConfigurationInterface(this); - } + d->containment.data()->createConfigurationInterface(this); connect(this, SIGNAL(applyClicked()), d->containment.data(), SLOT(configDialogFinished())); connect(this, SIGNAL(okClicked()), d->containment.data(), SLOT(configDialogFinished())); } @@ -460,11 +431,7 @@ void BackgroundDialog::saveConfig() //add the new containment's config if (d->containment.data()->hasConfigurationInterface()) { - if (d->containment.data()->package()) { - d->createConfigurationInterfaceForPackage(); - } else { - d->containment.data()->createConfigurationInterface(this); - } + d->containment.data()->createConfigurationInterface(this); connect(this, SIGNAL(applyClicked()), d->containment.data(), SLOT(configDialogFinished())); connect(this, SIGNAL(okClicked()), d->containment.data(), SLOT(configDialogFinished())); } diff --git a/libs/plasmagenericshell/scripting/appinterface.cpp b/libs/plasmagenericshell/scripting/appinterface.cpp deleted file mode 100644 index ec63161d..00000000 --- a/libs/plasmagenericshell/scripting/appinterface.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "appinterface.h" - -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef Q_WS_X11 -#include -#include -#endif - -#include "scriptengine.h" - -namespace WorkspaceScripting -{ - -AppInterface::AppInterface(ScriptEngine *env) - : QObject(env), - m_env(env) -{ -} - -int AppInterface::screenCount() const -{ - return m_env->corona()->numScreens(); -} - -QRectF AppInterface::screenGeometry(int screen) const -{ - return m_env->corona()->screenGeometry(screen); -} - -QList AppInterface::activityIds() const -{ - //FIXME: the ints could overflow since Applet::id() returns a uint, - // however QScript deals with QList very, very poory - QList containments; - - foreach (Plasma::Containment *c, m_env->corona()->containments()) { - if (!ScriptEngine::isPanel(c)) { - containments.append(c->id()); - } - } - - return containments; -} - -QList AppInterface::panelIds() const -{ - //FIXME: the ints could overflow since Applet::id() returns a uint, - // however QScript deals with QList very, very poory - QList panels; - - foreach (Plasma::Containment *c, m_env->corona()->containments()) { - //kDebug() << "checking" << (QObject*)c << isPanel(c); - if (ScriptEngine::isPanel(c)) { - panels.append(c->id()); - } - } - - return panels; -} - -QString AppInterface::applicationVersion() const -{ - return KGlobal::mainComponent().aboutData()->version(); -} - -QString AppInterface::platformVersion() const -{ - return KDE::versionString(); -} - -int AppInterface::scriptingVersion() const -{ - return PLASMA_DESKTOP_SCRIPTING_VERSION; -} - -QString AppInterface::theme() const -{ - return Plasma::Theme::defaultTheme()->themeName(); -} - -void AppInterface::setTheme(const QString &name) -{ - Plasma::Theme::defaultTheme()->setThemeName(name); -} - -void AppInterface::lockCorona(bool locked) -{ - m_env->corona()->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable); -} - -bool AppInterface::coronaLocked() const -{ - return m_env->corona()->immutability() != Plasma::Mutable; -} - -void AppInterface::sleep(int ms) -{ - QEventLoop loop; - QTimer::singleShot(ms, &loop, SLOT(quit())); - loop.exec(QEventLoop::ExcludeUserInputEvents); -} - -bool AppInterface::hasBattery() const -{ - const QList batteries = Solid::Device::listFromType(Solid::DeviceInterface::Battery); - return !batteries.isEmpty(); -} - -QStringList AppInterface::knownWidgetTypes() const -{ - if (m_knownWidgets.isEmpty()) { - QStringList widgets; - KPluginInfo::List infoLs = Plasma::Applet::listAppletInfo(); - - foreach (const KPluginInfo &info, infoLs) { - widgets.append(info.pluginName()); - } - - const_cast(this)->m_knownWidgets = widgets; - } - - return m_knownWidgets; -} - -QStringList AppInterface::knownActivityTypes() const -{ - return knownContainmentTypes("desktop"); -} - -QStringList AppInterface::knownPanelTypes() const -{ - return knownContainmentTypes("panel"); -} - -QStringList AppInterface::knownContainmentTypes(const QString &type) const -{ - QStringList containments; - KPluginInfo::List infoLs = Plasma::Containment::listContainmentsOfType(type); - - foreach (const KPluginInfo &info, infoLs) { - containments.append(info.pluginName()); - } - - return containments; -} - -} - -#include "moc_appinterface.cpp" diff --git a/libs/plasmagenericshell/scripting/appinterface.h b/libs/plasmagenericshell/scripting/appinterface.h deleted file mode 100644 index 92af9e1f..00000000 --- a/libs/plasmagenericshell/scripting/appinterface.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 APPINTERFACE -#define APPINTERFACE - -#include -#include -#include - -#include "plasmagenericshell_export.h" - -namespace Plasma -{ - class Applet; - class Containment; - class Corona; -} // namespace Plasma - -namespace WorkspaceScripting -{ - -class ScriptEngine; - -class PLASMAGENERICSHELL_EXPORT AppInterface : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool locked READ coronaLocked WRITE lockCorona) - Q_PROPERTY(bool hasBattery READ hasBattery) - Q_PROPERTY(int screenCount READ screenCount) - Q_PROPERTY(QList activityIds READ activityIds) - Q_PROPERTY(QList panelIds READ panelIds) - Q_PROPERTY(QStringList knownPanelTypes READ knownPanelTypes) - Q_PROPERTY(QStringList knownActivityTypes READ knownActivityTypes) - Q_PROPERTY(QStringList knownWidgetTypes READ knownWidgetTypes) - Q_PROPERTY(QString theme READ theme WRITE setTheme) - Q_PROPERTY(QString applicationVersion READ applicationVersion) - Q_PROPERTY(QString platformVersion READ platformVersion) - Q_PROPERTY(int scriptingVersion READ scriptingVersion) - -public: - AppInterface(ScriptEngine *env); - - bool hasBattery() const; - int screenCount() const; - QList activityIds() const; - QList panelIds() const; - - QStringList knownWidgetTypes() const; - QStringList knownActivityTypes() const; - QStringList knownPanelTypes() const; - QStringList knownContainmentTypes(const QString &type) const; - - QString applicationVersion() const; - QString platformVersion() const; - int scriptingVersion() const; - - QString theme() const; - void setTheme(const QString &name); - - bool coronaLocked() const; - -public Q_SLOTS: - QRectF screenGeometry(int screen) const; - void lockCorona(bool locked); - void sleep(int ms); - -Q_SIGNALS: - void print(const QString &string); - -private: - ScriptEngine *m_env; - QStringList m_knownWidgets; -}; - -} - -#endif - diff --git a/libs/plasmagenericshell/scripting/applet.cpp b/libs/plasmagenericshell/scripting/applet.cpp deleted file mode 100644 index fb4aeaed..00000000 --- a/libs/plasmagenericshell/scripting/applet.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "applet.h" - -#include -#include - -#include -#include - -#include -#include -#include - -namespace WorkspaceScripting -{ - -class Applet::Private -{ -public: - Private() - : configDirty(false), - inWallpaperConfig(false), - wallpaperConfigDirty(false) - { - } - - KConfigGroup configGroup; - QStringList configGroupPath; - KConfigGroup globalConfigGroup; - QStringList globalConfigGroupPath; - bool configDirty : 1; - bool inWallpaperConfig : 1; - bool wallpaperConfigDirty : 1; -}; - -Applet::Applet(QObject *parent) - : QObject(parent), - d(new Applet::Private) -{ -} - -Applet::~Applet() -{ - delete d; -} - -void Applet::setCurrentConfigGroup(const QStringList &groupNames) -{ - Plasma::Applet *app = applet(); - if (!app) { - d->configGroup = KConfigGroup(); - d->configGroupPath.clear(); - return; - } - - d->configGroup = app->config(); - d->configGroupPath = groupNames; - - foreach (const QString &groupName, groupNames) { - d->configGroup = KConfigGroup(&d->configGroup, groupName); - } - - d->inWallpaperConfig = !groupNames.isEmpty() && groupNames.first() == "Wallpaper"; -} - -QStringList Applet::currentConfigGroup() const -{ - return d->configGroupPath; -} - -QStringList Applet::configKeys() const -{ - if (d->configGroup.isValid()) { - return d->configGroup.keyList(); - } - - return QStringList(); -} - -QStringList Applet::configGroups() const -{ - if (d->configGroup.isValid()) { - return d->configGroup.groupList(); - } - - return QStringList(); -} - -QVariant Applet::readConfig(const QString &key, const QVariant &def) const -{ - if (d->configGroup.isValid()) { - return d->configGroup.readEntry(key, def); - } else { - return QVariant(); - } -} - -void Applet::writeConfig(const QString &key, const QVariant &value) -{ - if (d->configGroup.isValid()) { - if (d->inWallpaperConfig) { - d->wallpaperConfigDirty = true; - } - - d->configGroup.writeEntry(key, value); - d->configDirty = true; - } -} - -void Applet::setCurrentGlobalConfigGroup(const QStringList &groupNames) -{ - Plasma::Applet *app = applet(); - if (!app) { - d->globalConfigGroup = KConfigGroup(); - d->globalConfigGroupPath.clear(); - return; - } - - d->globalConfigGroup = app->globalConfig(); - d->globalConfigGroupPath = groupNames; - - foreach (const QString &groupName, groupNames) { - d->globalConfigGroup = KConfigGroup(&d->globalConfigGroup, groupName); - } -} - -QStringList Applet::currentGlobalConfigGroup() const -{ - return d->globalConfigGroupPath; -} - -QStringList Applet::globalConfigKeys() const -{ - if (d->globalConfigGroup.isValid()) { - return d->globalConfigGroup.keyList(); - } - - return QStringList(); -} - -QStringList Applet::globalConfigGroups() const -{ - if (d->globalConfigGroup.isValid()) { - return d->globalConfigGroup.groupList(); - } - - return QStringList(); -} - -QVariant Applet::readGlobalConfig(const QString &key, const QVariant &def) const -{ - if (d->globalConfigGroup.isValid()) { - return d->globalConfigGroup.readEntry(key, def); - } else { - return QVariant(); - } -} - -void Applet::writeGlobalConfig(const QString &key, const QVariant &value) -{ - if (d->globalConfigGroup.isValid()) { - d->globalConfigGroup.writeEntry(key, value); - d->configDirty = true; - } -} - -void Applet::reloadConfigIfNeeded() -{ - if (d->configDirty) { - reloadConfig(); - } -} - -void Applet::reloadConfig() -{ - Plasma::Applet *app = applet(); - if (app) { - KConfigGroup cg = app->config(); - - if (!app->isContainment()) { - app->restore(cg); - } - - app->configChanged(); - - if (app->containment() && app->containment()->corona()) { - app->containment()->corona()->requestConfigSync(); - } - - d->configDirty = false; - } -} - -QString Applet::version() const -{ - Plasma::Applet *app = applet(); - if (!app) { - return QString(); - } - - QString type = app->pluginName(); - KService::List services = KServiceTypeTrader::self()->query("Plasma/Applet", "[X-KDE-PluginInfo-Name] == '" + type + "'"); - if (services.isEmpty()) { - return QString(); - } - - KPluginInfo info(services.first()); - return info.version(); -} - -void Applet::setLocked(bool locked) -{ - Plasma::Applet *app = applet(); - if (!app) { - return; - } - - app->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable); - KConfigGroup cg = app->config(); - if (!app->isContainment()) { - cg = cg.parent(); - } - - if (cg.isValid()) { - cg.writeEntry("immutability", (int)app->immutability()); - } -} - -bool Applet::locked() const -{ - Plasma::Applet *app = applet(); - if (!app) { - return Plasma::Mutable; - } - - return app->immutability() != Plasma::Mutable; -} - -bool Applet::wallpaperConfigDirty() const -{ - return d->wallpaperConfigDirty; -} - -Plasma::Applet *Applet::applet() const -{ - return 0; -} - -} - -#include "moc_applet.cpp" - diff --git a/libs/plasmagenericshell/scripting/applet.h b/libs/plasmagenericshell/scripting/applet.h deleted file mode 100644 index 99e900ed..00000000 --- a/libs/plasmagenericshell/scripting/applet.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2010 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 APPLET -#define APPLET - -#include -#include - -#include - -#include "plasmagenericshell_export.h" - -namespace Plasma -{ - class Applet; -} // namespace Plasma - -namespace WorkspaceScripting -{ - -class PLASMAGENERICSHELL_EXPORT Applet : public QObject -{ - Q_OBJECT - -public: - Applet(QObject *parent = 0); - ~Applet(); - - QStringList configKeys() const; - QStringList configGroups() const; - - void setCurrentConfigGroup(const QStringList &groupNames); - QStringList currentConfigGroup() const; - - QStringList globalConfigKeys() const; - QStringList globalConfigGroups() const; - - void setCurrentGlobalConfigGroup(const QStringList &groupNames); - QStringList currentGlobalConfigGroup() const; - - QString version() const; - - void setLocked(bool locked); - bool locked() const; - - bool wallpaperConfigDirty() const; - - virtual Plasma::Applet *applet() const; - -protected: - void reloadConfigIfNeeded(); - -public Q_SLOTS: - virtual QVariant readConfig(const QString &key, const QVariant &def = QString()) const; - virtual void writeConfig(const QString &key, const QVariant &value); - virtual QVariant readGlobalConfig(const QString &key, const QVariant &def = QString()) const; - virtual void writeGlobalConfig(const QString &key, const QVariant &value); - virtual void reloadConfig(); - -private: - class Private; - Private * const d; -}; - -} - -#endif - diff --git a/libs/plasmagenericshell/scripting/backportglobal.h b/libs/plasmagenericshell/scripting/backportglobal.h deleted file mode 100644 index 319a9fae..00000000 --- a/libs/plasmagenericshell/scripting/backportglobal.h +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** This file is part of the Qt Script Generator. -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation info@qt.nokia.com -** -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation -** and appearing in the file LICENSE.LGPL included in the packaging of -** this file. Please review the following information to ensure the GNU -** Lesser General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** Copyright (C) 2011 Nokia. All rights reserved -****************************************************************************/ - -#ifndef QTSCRIPTEXTENSIONS_GLOBAL_H -#define QTSCRIPTEXTENSIONS_GLOBAL_H - -#include -#include -#include - -#define DECLARE_SELF(Class, __fn__) \ - Class* self = qscriptvalue_cast(ctx->thisObject()); \ - if (!self) { \ - return ctx->throwError(QScriptContext::TypeError, \ - QString::fromLatin1("%0.prototype.%1: this object is not a %0") \ - .arg(#Class).arg(#__fn__)); \ - } - -#define ADD_ENUM_VALUE(__c__, __ns__, __v__) \ - __c__.setProperty(#__v__, QScriptValue(__c__.engine(), __ns__::__v__)) - -#endif // QTSCRIPTEXTENSIONS_GLOBAL_H diff --git a/libs/plasmagenericshell/scripting/configgroup.cpp b/libs/plasmagenericshell/scripting/configgroup.cpp deleted file mode 100644 index c61bb044..00000000 --- a/libs/plasmagenericshell/scripting/configgroup.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2011-2012 by Sebastian Kügler - * Copyright 2013 by Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "configgroup.h" -#include -#include -#include -#include - -class ConfigGroupPrivate { - -public: - ConfigGroupPrivate(ConfigGroup *q) - : q(q), - config(0), - configGroup(0) - {} - - ~ConfigGroupPrivate() - { - delete configGroup; - } - - ConfigGroup* q; - KSharedConfigPtr config; - KConfigGroup *configGroup; - QString file; - QTimer *synchTimer; - QString group; -}; - - -ConfigGroup::ConfigGroup(QObject *parent) - : QObject(parent), - d(new ConfigGroupPrivate(this)) -{ - // Delay and compress everything within 5 seconds into one sync - d->synchTimer = new QTimer(this); - d->synchTimer->setSingleShot(true); - d->synchTimer->setInterval(1500); - connect(d->synchTimer, SIGNAL(timeout()), SLOT(sync())); -} - -ConfigGroup::~ConfigGroup() -{ - if (d->synchTimer->isActive()) { - //kDebug() << "SYNC......"; - d->synchTimer->stop(); - d->configGroup->sync(); - } - - delete d; -} - -KConfigGroup* ConfigGroup::configGroup() -{ - return d->configGroup; -} - -QString ConfigGroup::file() const -{ - return d->file; -} - -void ConfigGroup::setFile(const QString& filename) -{ - if (d->file == filename) { - return; - } - d->file = filename; - readConfigFile(); - emit fileChanged(); -} - -QString ConfigGroup::group() const -{ - return d->group; -} - -void ConfigGroup::setGroup(const QString& groupname) -{ - if (d->group == groupname) { - return; - } - d->group = groupname; - readConfigFile(); - emit groupChanged(); - emit keyListChanged(); -} - -QStringList ConfigGroup::keyList() const -{ - if (!d->configGroup) { - return QStringList(); - } - return d->configGroup->keyList(); -} - -QStringList ConfigGroup::groupList() const -{ - return d->configGroup->groupList(); -} - -bool ConfigGroup::readConfigFile() -{ - // Find parent ConfigGroup - ConfigGroup* parentGroup = 0; - QObject* current = parent(); - while (current) { - parentGroup = qobject_cast(current); - if (parentGroup) { - break; - } - current = current->parent(); - } - - delete d->configGroup; - d->configGroup = 0; - - if (parentGroup) { - d->configGroup = new KConfigGroup(parentGroup->configGroup(), d->group); - return true; - } else { - if (d->file.isEmpty()) { - kWarning() << "Could not find KConfig Parent: specify a file or parent to another ConfigGroup"; - return false; - } - d->config = KSharedConfig::openConfig(d->file); - d->configGroup = new KConfigGroup(d->config, d->group); - return true; - } -} - -// Bound methods and slots - -bool ConfigGroup::writeEntry(const QString& key, const QVariant& value) -{ - if (!d->configGroup) { - return false; - } - - d->configGroup->writeEntry(key, value); - d->synchTimer->start(); - return true; -} - -QVariant ConfigGroup::readEntry(const QString& key) -{ - if (!d->configGroup) { - return QVariant(); - } - const QVariant value = d->configGroup->readEntry(key, QVariant("")); - //kDebug() << " reading setting: " << key << value; - return value; -} - -void ConfigGroup::deleteEntry(const QString& key) -{ - d->configGroup->deleteEntry(key); -} - -void ConfigGroup::sync() -{ - if (d->configGroup) { - //kDebug() << "synching config..."; - d->configGroup->sync(); - } -} - -#include "moc_configgroup.cpp" diff --git a/libs/plasmagenericshell/scripting/configgroup.h b/libs/plasmagenericshell/scripting/configgroup.h deleted file mode 100644 index 0b910ddc..00000000 --- a/libs/plasmagenericshell/scripting/configgroup.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2011-2012 by Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 CONFIGGROUP_H -#define CONFIGGROUP_H - -#include -#include - -class KConfigGroup; -class ConfigGroupPrivate; - -class ConfigGroup : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString file READ file WRITE setFile NOTIFY fileChanged) - Q_PROPERTY(QString group READ group WRITE setGroup NOTIFY groupChanged) - Q_PROPERTY(QStringList keyList READ keyList NOTIFY keyListChanged) - Q_PROPERTY(QStringList groupList READ groupList NOTIFY groupListChanged) - -public: - ConfigGroup(QObject* parent=0); - ~ConfigGroup(); - - KConfigGroup* configGroup(); - - QString file() const; - void setFile(const QString &filename); - QString group() const; - void setGroup(const QString &groupname); - QStringList keyList() const; - QStringList groupList() const; - - Q_INVOKABLE QVariant readEntry(const QString &key); - Q_INVOKABLE bool writeEntry(const QString &key, const QVariant &value); - Q_INVOKABLE void deleteEntry(const QString& key); - -Q_SIGNALS: - void fileChanged(); - void groupChanged(); - void keyListChanged(); - void groupListChanged(); - -private: - ConfigGroupPrivate* d; - - bool readConfigFile(); - -private Q_SLOTS: - void sync(); -}; - -#endif diff --git a/libs/plasmagenericshell/scripting/containment.cpp b/libs/plasmagenericshell/scripting/containment.cpp deleted file mode 100644 index bc39901e..00000000 --- a/libs/plasmagenericshell/scripting/containment.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "containment.h" - -#include - -#include -#include -#include - -#include "scriptengine.h" -#include "widget.h" - -namespace WorkspaceScripting -{ - -class Containment::Private -{ -public: - QWeakPointer containment; - QString oldWallpaperPlugin; - QString wallpaperPlugin; - QString oldWallpaperMode; - QString wallpaperMode; -}; - -Containment::Containment(Plasma::Containment *containment, QObject *parent) - : Applet(parent), - d(new Containment::Private) -{ - d->containment = containment; - setCurrentConfigGroup(QStringList()); - setCurrentGlobalConfigGroup(QStringList()); - if (containment && containment->wallpaper()) { - d->oldWallpaperPlugin = d->wallpaperPlugin = containment->wallpaper()->pluginName(); - d->oldWallpaperMode = d->wallpaperMode = containment->wallpaper()->renderingMode().name(); - } -} - -Containment::~Containment() -{ - if (d->containment) { - Plasma::Containment *containment = d->containment.data(); - if (d->oldWallpaperPlugin != d->wallpaperPlugin || - d->oldWallpaperMode != d->wallpaperMode) { - containment->setWallpaper(d->wallpaperPlugin, d->wallpaperMode); - } else if (wallpaperConfigDirty() && containment->wallpaper()) { - KConfigGroup cg(containment->config()); - cg = KConfigGroup(&cg, "Wallpaper"); - cg = KConfigGroup(&cg, containment->wallpaper()->pluginName()); - containment->wallpaper()->restore(cg); - } - - // we need to make this connection ourselves in case it hasn't been received - // by the containment yet; currently in libplasma it only connects to this signal - // when the wallpaper has not yet been iniialized - // since this code alters the expected order of initialization, we do a bit of - // bookkeeping here - connect(containment->wallpaper(), SIGNAL(update(QRectF)), containment, SLOT(updateRect(QRectF)), - Qt::UniqueConnection); - } - - reloadConfigIfNeeded(); - delete d; -} - -int Containment::screen() const -{ - if (!d->containment) { - return -1; - } - - return d->containment.data()->screen(); -} - -void Containment::setScreen(int screen) -{ - if (d->containment) { - d->containment.data()->setScreen(screen); - } -} - -QString Containment::wallpaperPlugin() const -{ - return d->wallpaperPlugin; -} - -void Containment::setWallpaperPlugin(const QString &wallpaperPlugin) -{ - d->wallpaperPlugin = wallpaperPlugin; -} - - -QString Containment::wallpaperMode() const -{ - return d->wallpaperMode; -} - -void Containment::setWallpaperMode(const QString &wallpaperMode) -{ - d->wallpaperMode = wallpaperMode; -} - -int Containment::desktop() const -{ - if (!d->containment) { - return -1; - } - - return d->containment.data()->desktop(); -} - -void Containment::setDesktop(int desktop) -{ - if (d->containment) { - d->containment.data()->setScreen(d->containment.data()->screen(), desktop); - } -} - -QString Containment::formFactor() const -{ - if (!d->containment) { - return "Planar"; - } - - switch (d->containment.data()->formFactor()) { - case Plasma::Planar: - return "planar"; - break; - case Plasma::MediaCenter: - return "mediacenter"; - break; - case Plasma::Horizontal: - return "horizontal"; - break; - case Plasma::Vertical: - return "vertical"; - break; - case Plasma::Application: - return "application"; - break; - } - - return "Planar"; -} - -QList Containment::widgetIds() const -{ - //FIXME: the ints could overflow since Applet::id() returns a uint, - // however QScript deals with QList very, very poory - QList w; - - if (d->containment) { - foreach (const Plasma::Applet *applet, d->containment.data()->applets()) { - w.append(applet->id()); - } - } - - return w; -} - -QScriptValue Containment::widgetById(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return context->throwError(i18n("widgetById requires an id")); - } - - const uint id = context->argument(0).toInt32(); - Containment *c = qobject_cast(context->thisObject().toQObject()); - - if (!c) { - return engine->undefinedValue(); - } - - if (c->d->containment) { - foreach (Plasma::Applet *w, c->d->containment.data()->applets()) { - if (w->id() == id) { - ScriptEngine *env = ScriptEngine::envFor(engine); - return env->wrap(w); - } - } - } - - return engine->undefinedValue(); -} - -QScriptValue Containment::addWidget(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return context->throwError(i18n("widgetById requires a name of a widget or a widget object")); - } - - Containment *c = qobject_cast(context->thisObject().toQObject()); - - if (!c || !c->d->containment) { - return engine->undefinedValue(); - } - - QScriptValue v = context->argument(0); - Plasma::Applet *applet = 0; - if (v.isString()) { - applet = c->d->containment.data()->addApplet(v.toString()); - if (applet) { - ScriptEngine *env = ScriptEngine::envFor(engine); - return env->wrap(applet); - } - } else if (Widget *widget = qobject_cast(v.toQObject())) { - applet = widget->applet(); - c->d->containment.data()->addApplet(applet); - return v; - } - - return engine->undefinedValue(); -} - -QScriptValue Containment::widgets(QScriptContext *context, QScriptEngine *engine) -{ - Containment *c = qobject_cast(context->thisObject().toQObject()); - - if (!c || !c->d->containment) { - return engine->undefinedValue(); - } - - const QString widgetType = context->argumentCount() > 0 ? context->argument(0).toString() : QString(); - QScriptValue widgets = engine->newArray(); - ScriptEngine *env = ScriptEngine::envFor(engine); - int count = 0; - - foreach (Plasma::Applet *widget, c->d->containment.data()->applets()) { - if (widgetType.isEmpty() || widget->pluginName() == widgetType) { - widgets.setProperty(count, env->wrap(widget)); - ++count; - } - } - - widgets.setProperty("length", count); - return widgets; -} - -uint Containment::id() const -{ - if (!d->containment) { - return 0; - } - - return d->containment.data()->id(); -} - -QString Containment::type() const -{ - if (!d->containment) { - return QString(); - } - - return d->containment.data()->pluginName(); -} - -void Containment::remove() -{ - if (d->containment) { - d->containment.data()->destroy(false); - } -} - -void Containment::showConfigurationInterface() -{ - if (d->containment) { - QAction *configAction = d->containment.data()->action("configure"); - if (configAction && configAction->isEnabled()) { - configAction->trigger(); - } - } -} - -Plasma::Applet *Containment::applet() const -{ - return d->containment.data(); -} - -Plasma::Containment *Containment::containment() const -{ - return d->containment.data(); -} - -} - -#include "moc_containment.cpp" - diff --git a/libs/plasmagenericshell/scripting/containment.h b/libs/plasmagenericshell/scripting/containment.h deleted file mode 100644 index 595c63f0..00000000 --- a/libs/plasmagenericshell/scripting/containment.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 CONTAINMENT -#define CONTAINMENT - -#include -#include -#include - -#include "applet.h" - -#include "plasmagenericshell_export.h" - -namespace Plasma -{ - class Containment; -} // namespace Plasma - -namespace WorkspaceScripting -{ - -class PLASMAGENERICSHELL_EXPORT Containment : public Applet -{ - Q_OBJECT - Q_PROPERTY(QString version READ version) - Q_PROPERTY(QStringList configKeys READ configKeys) - Q_PROPERTY(QStringList configGroups READ configGroups) - Q_PROPERTY(QStringList globalConfigKeys READ globalConfigKeys) - Q_PROPERTY(QStringList globalConfigGroups READ globalConfigGroups) - Q_PROPERTY(QStringList currentConfigGroup WRITE setCurrentConfigGroup READ currentConfigGroup) - Q_PROPERTY(QString wallpaperPlugin READ wallpaperPlugin WRITE setWallpaperPlugin) - Q_PROPERTY(QString wallpaperMode READ wallpaperMode WRITE setWallpaperMode) - Q_PROPERTY(bool locked READ locked WRITE setLocked) - Q_PROPERTY(QString type READ type) - Q_PROPERTY(QString formFactor READ formFactor) - Q_PROPERTY(QList widgetIds READ widgetIds) - Q_PROPERTY(int screen READ screen WRITE setScreen) - Q_PROPERTY(int desktop READ desktop WRITE setDesktop) - Q_PROPERTY(int id READ id) - -public: - Containment(Plasma::Containment *containment, QObject *parent = 0); - ~Containment(); - - uint id() const; - QString type() const; - QString formFactor() const; - QList widgetIds() const; - - int desktop() const; - void setDesktop(int desktop); - - int screen() const; - void setScreen(int screen); - - Plasma::Applet *applet() const; - Plasma::Containment *containment() const; - - QString wallpaperPlugin() const; - void setWallpaperPlugin(const QString &wallpaperPlugin); - QString wallpaperMode() const; - void setWallpaperMode(const QString &wallpaperMode); - - static QScriptValue widgetById(QScriptContext *context, QScriptEngine *engine); - static QScriptValue addWidget(QScriptContext *context, QScriptEngine *engine); - static QScriptValue widgets(QScriptContext *context, QScriptEngine *engine); - -public Q_SLOTS: - void remove(); - void showConfigurationInterface(); - - // from the applet interface - QVariant readConfig(const QString &key, const QVariant &def = QString()) const { return Applet::readConfig(key, def); } - void writeConfig(const QString &key, const QVariant &value) { Applet::writeConfig(key, value); } - - QVariant readGlobalConfig(const QString &key, const QVariant &def = QString()) const { return Applet::readGlobalConfig(key, def); } - void writeGlobalConfig(const QString &key, const QVariant &value) { Applet::writeGlobalConfig(key, value); } - - void reloadConfig() { Applet::reloadConfig(); } - -private: - class Private; - Private * const d; -}; - -} - -#endif - diff --git a/libs/plasmagenericshell/scripting/i18n.cpp b/libs/plasmagenericshell/scripting/i18n.cpp deleted file mode 100644 index 2210a193..00000000 --- a/libs/plasmagenericshell/scripting/i18n.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "i18n.h" - -#include -#include - -#include -#include - -QScriptValue jsi18n(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - - if (context->argumentCount() < 1) { - kDebug() << i18n("i18n() takes at least one argument"); - return engine->undefinedValue(); - } - - KLocalizedString message = ki18n(context->argument(0).toString().toUtf8()); - - const int numArgs = context->argumentCount(); - for (int i = 1; i < numArgs; ++i) { - message = message.subs(context->argument(i).toString()); - } - - return message.toString(); -} - -QScriptValue jsi18nc(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - - if (context->argumentCount() < 2) { - kDebug() << i18n("i18nc() takes at least two arguments"); - return engine->undefinedValue(); - } - - KLocalizedString message = ki18nc(context->argument(0).toString().toUtf8(), - context->argument(1).toString().toUtf8()); - - const int numArgs = context->argumentCount(); - for (int i = 2; i < numArgs; ++i) { - message = message.subs(context->argument(i).toString()); - } - - return message.toString(); -} - -QScriptValue jsi18np(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - - if (context->argumentCount() < 2) { - kDebug() << i18n("i18np() takes at least two arguments"); - return engine->undefinedValue(); - } - - KLocalizedString message = ki18np(context->argument(0).toString().toUtf8(), - context->argument(1).toString().toUtf8()); - - const int numArgs = context->argumentCount(); - for (int i = 2; i < numArgs; ++i) { - QScriptValue v = context->argument(i); - if (v.isNumber()) { - message = message.subs(v.toInt32()); - } else { - message = message.subs(v.toString()); - } - } - - return message.toString(); -} - -QScriptValue jsi18ncp(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - - if (context->argumentCount() < 3) { - kDebug() << i18n("i18ncp() takes at least three arguments"); - return engine->undefinedValue(); - } - - KLocalizedString message = ki18ncp(context->argument(0).toString().toUtf8(), - context->argument(1).toString().toUtf8(), - context->argument(2).toString().toUtf8()); - - const int numArgs = context->argumentCount(); - for (int i = 3; i < numArgs; ++i) { - message = message.subs(context->argument(i).toString()); - } - - return message.toString(); -} - -void bindI18N(QScriptEngine *engine) -{ - QScriptValue global = engine->globalObject(); - global.setProperty("i18n", engine->newFunction(jsi18n)); - global.setProperty("i18nc", engine->newFunction(jsi18nc)); - global.setProperty("i18np", engine->newFunction(jsi18np)); - global.setProperty("i18ncp", engine->newFunction(jsi18ncp)); -} - diff --git a/libs/plasmagenericshell/scripting/i18n.h b/libs/plasmagenericshell/scripting/i18n.h deleted file mode 100644 index 7d8836d4..00000000 --- a/libs/plasmagenericshell/scripting/i18n.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 JAVASCRIPTBINDI18N_H -#define JAVASCRIPTBINDI18N_H - -#include - -#include -#include - -QScriptValue jsi18n(QScriptContext *context, QScriptEngine *engine); -QScriptValue jsi18nc(QScriptContext *context, QScriptEngine *engine); -QScriptValue jsi18np(QScriptContext *context, QScriptEngine *engine); -QScriptValue jsi18ncp(QScriptContext *context, QScriptEngine *engine); -void bindI18N(QScriptEngine *engine); - -#endif - diff --git a/libs/plasmagenericshell/scripting/rect.cpp b/libs/plasmagenericshell/scripting/rect.cpp deleted file mode 100644 index 1b894bb8..00000000 --- a/libs/plasmagenericshell/scripting/rect.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright 2007 Richard J. Moore - * - * This program 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 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 Library 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 -#include -#include -#include -#include "backportglobal.h" - -Q_DECLARE_METATYPE(QRectF*) -Q_DECLARE_METATYPE(QRectF) - -static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng) -{ - if (ctx->argumentCount() == 4) - { - qreal x = ctx->argument(0).toNumber(); - qreal y = ctx->argument(1).toNumber(); - qreal width = ctx->argument(2).toNumber(); - qreal height = ctx->argument(3).toNumber(); - return qScriptValueFromValue(eng, QRectF(x, y, width, height)); - } - - return qScriptValueFromValue(eng, QRectF()); -} - -static QScriptValue adjust(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, adjust); - qreal dx1 = ctx->argument(0).toNumber(); - qreal dy1 = ctx->argument(1).toNumber(); - qreal dx2 = ctx->argument(2).toNumber(); - qreal dy2 = ctx->argument(3).toNumber(); - - self->adjust(dx1, dy1, dx2, dy2); - return QScriptValue(); -} - -static QScriptValue adjusted(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, adjusted); - qreal dx1 = ctx->argument(0).toNumber(); - qreal dy1 = ctx->argument(1).toNumber(); - qreal dx2 = ctx->argument(2).toNumber(); - qreal dy2 = ctx->argument(3).toNumber(); - - QRectF tmp = self->adjusted(dx1, dy1, dx2, dy2); - return qScriptValueFromValue(eng, tmp); -} - -static QScriptValue bottom(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, bottom); - - if (ctx->argumentCount() > 0) { - int bottom = ctx->argument(0).toInt32(); - self->setBottom(bottom); - } - - return QScriptValue(eng, self->bottom()); -} - -static QScriptValue top(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, top); - - if (ctx->argumentCount() > 0) { - int top = ctx->argument(0).toInt32(); - self->setTop(top); - } - - return QScriptValue(eng, self->top()); -} - -static QScriptValue contains(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, contains); - qreal x = ctx->argument(0).toNumber(); - qreal y = ctx->argument(1).toNumber(); - return QScriptValue(eng, self->contains(x, y)); -} - -static QScriptValue height(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, height); - - if (ctx->argumentCount() > 0) { - int height = ctx->argument(0).toInt32(); - self->setHeight(height); - } - - return QScriptValue(eng, self->height()); -} - -static QScriptValue empty(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, empty); - return QScriptValue(eng, self->isEmpty()); -} - -static QScriptValue null(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, null); - return QScriptValue(eng, self->isNull()); -} - -static QScriptValue valid(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, valid); - return QScriptValue(eng, self->isValid()); -} - -static QScriptValue left(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, left); - - if (ctx->argumentCount() > 0) { - int left = ctx->argument(0).toInt32(); - self->setLeft(left); - } - - return QScriptValue(eng, self->left()); -} - -static QScriptValue moveBottom(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, moveBottom); - qreal bottom = ctx->argument(0).toNumber(); - self->moveBottom(bottom); - return QScriptValue(); -} - -static QScriptValue moveLeft(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, moveLeft); - qreal left = ctx->argument(0).toNumber(); - self->moveBottom(left); - return QScriptValue(); -} - -static QScriptValue moveRight(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, moveRight); - qreal right = ctx->argument(0).toNumber(); - self->moveBottom(right); - return QScriptValue(); -} - - -static QScriptValue moveTo(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, moveTo); - qreal x = ctx->argument(0).toNumber(); - qreal y = ctx->argument(1).toNumber(); - self->moveTo(x, y); - return QScriptValue(); -} - -static QScriptValue moveTop(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, moveTop); - qreal top = ctx->argument(0).toNumber(); - self->moveTop(top); - return QScriptValue(); -} - -static QScriptValue right(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, right); - - if (ctx->argumentCount() > 0) { - int right = ctx->argument(0).toInt32(); - self->setRight(right); - } - - return QScriptValue(eng, self->right()); -} - -static QScriptValue setCoords(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, setCoords); - qreal x1 = ctx->argument(0).toNumber(); - qreal y1 = ctx->argument(1).toNumber(); - qreal x2 = ctx->argument(2).toNumber(); - qreal y2 = ctx->argument(3).toNumber(); - self->setCoords(x1, y1, x2, y2); - return QScriptValue(); -} - -static QScriptValue setRect(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, setRect); - qreal x = ctx->argument(0).toNumber(); - qreal y = ctx->argument(1).toNumber(); - qreal width = ctx->argument(2).toNumber(); - qreal height = ctx->argument(3).toNumber(); - self->setRect(x, y, width, height); - return QScriptValue(); -} - -static QScriptValue translate(QScriptContext *ctx, QScriptEngine *) -{ - DECLARE_SELF(QRectF, translate); - qreal dx = ctx->argument(0).toNumber(); - qreal dy = ctx->argument(1).toNumber(); - self->translate(dx, dy); - return QScriptValue(); -} - -static QScriptValue width(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, width); - - if (ctx->argumentCount() > 0) { - int width = ctx->argument(0).toInt32(); - self->setWidth(width); - } - - return QScriptValue(eng, self->width()); -} - -static QScriptValue x(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, x); - - if (ctx->argumentCount() > 0) { - int x = ctx->argument(0).toInt32(); - self->setX(x); - } - - return QScriptValue(eng, self->x()); -} - -static QScriptValue y(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QRectF, y); - - if (ctx->argumentCount() > 0) { - int y = ctx->argument(0).toInt32(); - self->setY(y); - } - - return QScriptValue(eng, self->y()); -} - -/* Not Implemented Yet */ -// QPointF bottomLeft () const -// QPointF bottomRight () const -// QPointF center () const -// bool contains ( const QPointF & point ) const -// bool contains ( const QRectF & rectangle ) const -// void getCoords ( qreal * x1, qreal * y1, qreal * x2, qreal * y2 ) const -// void getRect ( qreal * x, qreal * y, qreal * width, qreal * height ) const -// QRectF intersected ( const QRectF & rectangle ) const -// bool intersects ( const QRectF & rectangle ) const -// void moveBottomLeft ( const QPointF & position ) -// void moveBottomRight ( const QPointF & position ) -// void moveCenter ( const QPointF & position ) -// void moveTo ( const QPointF & position ) -// void moveTopLeft ( const QPointF & position ) -// void moveTopRight ( const QPointF & position ) -// QRectF normalized () const -// void setBottomLeft ( const QPointF & position ) -// void setBottomRight ( const QPointF & position ) -// void setSize ( const QSizeF & size ) -// void setTopLeft ( const QPointF & position ) -// void setTopRight ( const QPointF & position ) -// QSizeF size () const -// QRect toAlignedRect () const -// QRect toRect () const -// QPointF topLeft () const -// QPointF topRight () const -// void translate ( const QPointF & offset ) -// QRectF translated ( qreal dx, qreal dy ) const -// QRectF translated ( const QPointF & offset ) const -// QRectF united ( const QRectF & rectangle ) const - -QScriptValue constructQRectFClass(QScriptEngine *eng) -{ - QScriptValue proto = qScriptValueFromValue(eng, QRectF()); - QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter; - QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter; - - proto.setProperty("adjust", eng->newFunction(adjust)); - proto.setProperty("adjusted", eng->newFunction(adjusted), getter); - proto.setProperty("translate", eng->newFunction(translate)); - proto.setProperty("setCoords", eng->newFunction(setCoords)); - proto.setProperty("setRect", eng->newFunction(setRect)); - - proto.setProperty("contains", eng->newFunction(contains)); - - proto.setProperty("moveBottom", eng->newFunction(moveBottom)); - proto.setProperty("moveLeft", eng->newFunction(moveLeft)); - proto.setProperty("moveRight", eng->newFunction(moveRight)); - proto.setProperty("moveTo", eng->newFunction(moveTo)); - proto.setProperty("moveTop", eng->newFunction(moveTop)); - - proto.setProperty("empty", eng->newFunction(empty), getter); - proto.setProperty("null", eng->newFunction(null), getter); - proto.setProperty("valid", eng->newFunction(valid), getter); - - proto.setProperty("left", eng->newFunction(left), getter | setter); - proto.setProperty("top", eng->newFunction(top), getter | setter); - proto.setProperty("bottom", eng->newFunction(bottom), getter | setter); - proto.setProperty("right", eng->newFunction(right), getter | setter); - proto.setProperty("height", eng->newFunction(height), getter | setter); - proto.setProperty("width", eng->newFunction(width), getter | setter); - proto.setProperty("x", eng->newFunction(x), getter | setter); - proto.setProperty("y", eng->newFunction(y), getter | setter); - - eng->setDefaultPrototype(qMetaTypeId(), proto); - eng->setDefaultPrototype(qMetaTypeId(), proto); - - return eng->newFunction(ctor, proto); -} diff --git a/libs/plasmagenericshell/scripting/scriptengine.cpp b/libs/plasmagenericshell/scripting/scriptengine.cpp deleted file mode 100644 index 71a4a6de..00000000 --- a/libs/plasmagenericshell/scripting/scriptengine.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "scriptengine.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "appinterface.h" -#include "containment.h" -#include "configgroup.h" -#include "i18n.h" -#include "widget.h" - -QScriptValue constructQRectFClass(QScriptEngine *engine); - -namespace WorkspaceScripting -{ - -ScriptEngine::ScriptEngine(Plasma::Corona *corona, QObject *parent) - : QScriptEngine(parent), - m_corona(corona) -{ - Q_ASSERT(m_corona); - AppInterface *interface = new AppInterface(this); - connect(interface, SIGNAL(print(QString)), this, SIGNAL(print(QString))); - m_scriptSelf = newQObject(interface, QScriptEngine::QtOwnership, - QScriptEngine::ExcludeSuperClassProperties | - QScriptEngine::ExcludeSuperClassMethods); - setupEngine(); - connect(this, SIGNAL(signalHandlerException(QScriptValue)), this, SLOT(exception(QScriptValue))); - bindI18N(this); -} - -ScriptEngine::~ScriptEngine() -{ -} - -QScriptValue ScriptEngine::newActivity(QScriptContext *context, QScriptEngine *engine) -{ - return createContainment("desktop", "desktop", context, engine); -} - -QScriptValue ScriptEngine::newPanel(QScriptContext *context, QScriptEngine *engine) -{ - return createContainment("panel", "panel", context, engine); -} - -QScriptValue ScriptEngine::createContainment(const QString &type, const QString &defaultPlugin, - QScriptContext *context, QScriptEngine *engine) -{ - QString plugin = context->argumentCount() > 0 ? context->argument(0).toString() : - defaultPlugin; - - bool exists = false; - const KPluginInfo::List list = Plasma::Containment::listContainmentsOfType(type); - foreach (const KPluginInfo &info, list) { - if (info.pluginName() == plugin) { - exists = true; - break; - } - } - - if (!exists) { - return context->throwError(i18n("Could not find a plugin for %1 named %2.", type, plugin)); - } - - - ScriptEngine *env = envFor(engine); - Plasma::Containment *c = env->m_corona->addContainment(plugin); - if (c) { - if (type == "panel") { - // some defaults - c->setScreen(env->defaultPanelScreen()); - c->setLocation(Plasma::TopEdge); - } - c->updateConstraints(Plasma::AllConstraints | Plasma::StartupCompletedConstraint); - c->flushPendingConstraintsEvents(); - emit env->createPendingPanelViews(); - } - - return env->wrap(c); -} - -QScriptValue ScriptEngine::wrap(Plasma::Applet *w) -{ - Widget *wrapper = new Widget(w); - QScriptValue v = newQObject(wrapper, QScriptEngine::ScriptOwnership, - QScriptEngine::ExcludeSuperClassProperties | - QScriptEngine::ExcludeSuperClassMethods); - return v; -} - -QScriptValue ScriptEngine::wrap(Plasma::Containment *c) -{ - Containment *wrapper = new Containment(c); - return wrap(wrapper); -} - -QScriptValue ScriptEngine::wrap(Containment *c) -{ - QScriptValue v = newQObject(c, QScriptEngine::ScriptOwnership, - QScriptEngine::ExcludeSuperClassProperties | - QScriptEngine::ExcludeSuperClassMethods); - v.setProperty("widgetById", newFunction(Containment::widgetById)); - v.setProperty("addWidget", newFunction(Containment::addWidget)); - v.setProperty("widgets", newFunction(Containment::widgets)); - - return v; -} - -int ScriptEngine::defaultPanelScreen() const -{ - return qApp ? qApp->desktop()->primaryScreen() : 0; -} - -ScriptEngine *ScriptEngine::envFor(QScriptEngine *engine) -{ - QObject *object = engine->globalObject().toQObject(); - Q_ASSERT(object); - - AppInterface *interface = qobject_cast(object); - Q_ASSERT(interface); - - ScriptEngine *env = qobject_cast(interface->parent()); - Q_ASSERT(env); - - return env; -} - -QScriptValue ScriptEngine::panelById(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return context->throwError(i18n("panelById requires an id")); - } - - const uint id = context->argument(0).toInt32(); - ScriptEngine *env = envFor(engine); - foreach (Plasma::Containment *c, env->m_corona->containments()) { - if (c->id() == id && isPanel(c)) { - return env->wrap(c); - } - } - - return engine->undefinedValue(); -} - -QScriptValue ScriptEngine::panels(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(context) - - QScriptValue panels = engine->newArray(); - ScriptEngine *env = envFor(engine); - int count = 0; - - foreach (Plasma::Containment *c, env->m_corona->containments()) { - if (isPanel(c)) { - panels.setProperty(count, env->wrap(c)); - ++count; - } - } - - panels.setProperty("length", count); - return panels; -} - -QScriptValue ScriptEngine::fileExists(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - const QString path = context->argument(0).toString(); - if (path.isEmpty()) { - return false; - } - - QFile f(KShell::tildeExpand(path)); - return f.exists(); -} - -QScriptValue ScriptEngine::applicationExists(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - const QString application = context->argument(0).toString(); - if (application.isEmpty()) { - return false; - } - - // first, check for it in $PATH - if (!KStandardDirs::findExe(application).isEmpty()) { - return true; - } - - if (KService::serviceByStorageId(application)) { - return true; - } - - if (application.contains("'")) { - // apostrophes just screw up the trader lookups below, so check for it - return false; - } - - // next, consult ksycoca for an app by that name - if (!KServiceTypeTrader::self()->query("Application", QString("Name =~ '%1'").arg(application)).isEmpty()) { - return true; - } - - // next, consult ksycoca for an app by that generic name - if (!KServiceTypeTrader::self()->query("Application", QString("GenericName =~ '%1'").arg(application)).isEmpty()) { - return true; - } - - return false; -} - -QString ScriptEngine::onlyExec(const QString &commandLine) -{ - if (commandLine.isEmpty()) { - return commandLine; - } - - return KShell::splitArgs(commandLine, KShell::TildeExpand).first(); -} - -QScriptValue ScriptEngine::applicationPath(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - const QString application = context->argument(0).toString(); - if (application.isEmpty()) { - return false; - } - - // first, check for it in $PATH - const QString path = KStandardDirs::findExe(application); - if (!path.isEmpty()) { - return path; - } - - if (KService::Ptr service = KService::serviceByStorageId(application)) { - return KStandardDirs::locate("apps", service->entryPath()); - } - - if (application.contains("'")) { - // apostrophes just screw up the trader lookups below, so check for it - return QString(); - } - - // next, consult ksycoca for an app by that name - KService::List offers = KServiceTypeTrader::self()->query("Application", QString("Name =~ '%1'").arg(application)); - if (offers.isEmpty()) { - // next, consult ksycoca for an app by that generic name - offers = KServiceTypeTrader::self()->query("Application", QString("GenericName =~ '%1'").arg(application)); - } - - if (!offers.isEmpty()) { - KService::Ptr offer = offers.first(); - return KStandardDirs::locate("apps", offer->entryPath()); - } - - return QString(); -} - -QScriptValue ScriptEngine::userDataPath(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return QDir::homePath(); - } - - const QString type = context->argument(0).toString(); - if (type.isEmpty()) { - return QDir::homePath(); - } - - if (context->argumentCount() > 1) { - const QString filename = context->argument(1).toString(); - return KStandardDirs::locateLocal(type.toLatin1(), filename); - } - - if (type.compare("desktop", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::desktopPath(); - } else if (type.compare("documents", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::documentPath(); - } else if (type.compare("music", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::musicPath(); - } else if (type.compare("video", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::videosPath(); - } else if (type.compare("downloads", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::downloadPath(); - } else if (type.compare("pictures", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::picturesPath(); - } - - return QString(); -} - -QScriptValue ScriptEngine::knownWallpaperPlugins(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - - QString formFactor; - if (context->argumentCount() > 0) { - formFactor = context->argument(0).toString(); - } - - QString constraint; - if (!formFactor.isEmpty()) { - constraint.append("[X-Plasma-FormFactors] ~~ '").append(formFactor).append("'"); - } - - KService::List services = KServiceTypeTrader::self()->query("Plasma/Wallpaper", constraint); - QScriptValue rv = engine->newArray(services.size()); - foreach (const KService::Ptr service, services) { - QList modeActions = service->actions(); - QScriptValue modes = engine->newArray(modeActions.size()); - int i = 0; - foreach (const KServiceAction &action, modeActions) { - modes.setProperty(i++, action.name()); - } - - rv.setProperty(service->name(), modes); - } - - return rv; -} - -QScriptValue ScriptEngine::configFile(QScriptContext *context, QScriptEngine *engine) -{ - ConfigGroup *file = 0; - - if (context->argumentCount() > 0) { - if (context->argument(0).isString()) { - file = new ConfigGroup; - file->setFile(context->argument(0).toString()); - if (context->argumentCount() > 1) { - file->setGroup(context->argument(1).toString()); - } - } else if (ConfigGroup *parent= qobject_cast(context->argument(0).toQObject())) { - file = new ConfigGroup(parent); - } - } else { - file = new ConfigGroup; - } - - QScriptValue v = engine->newQObject(file, - QScriptEngine::ScriptOwnership, - QScriptEngine::ExcludeSuperClassProperties | - QScriptEngine::ExcludeSuperClassMethods); - return v; - -} - -void ScriptEngine::setupEngine() -{ - QScriptValue v = globalObject(); - QScriptValueIterator it(v); - while (it.hasNext()) { - it.next(); - // we provide our own print implementation, but we want the rest - if (it.name() != "print") { - m_scriptSelf.setProperty(it.name(), it.value()); - } - } - - m_scriptSelf.setProperty("QRectF", constructQRectFClass(this)); - m_scriptSelf.setProperty("Activity", newFunction(ScriptEngine::newActivity)); - m_scriptSelf.setProperty("Panel", newFunction(ScriptEngine::newPanel)); - m_scriptSelf.setProperty("panelById", newFunction(ScriptEngine::panelById)); - m_scriptSelf.setProperty("panels", newFunction(ScriptEngine::panels)); - m_scriptSelf.setProperty("fileExists", newFunction(ScriptEngine::fileExists)); - m_scriptSelf.setProperty("applicationExists", newFunction(ScriptEngine::applicationExists)); - m_scriptSelf.setProperty("userDataPath", newFunction(ScriptEngine::userDataPath)); - m_scriptSelf.setProperty("applicationPath", newFunction(ScriptEngine::applicationPath)); - m_scriptSelf.setProperty("knownWallpaperPlugins", newFunction(ScriptEngine::knownWallpaperPlugins)); - m_scriptSelf.setProperty("ConfigFile", newFunction(ScriptEngine::configFile)); - - setGlobalObject(m_scriptSelf); -} - -bool ScriptEngine::isPanel(const Plasma::Containment *c) -{ - if (!c) { - return false; - } - - return c->containmentType() == Plasma::Containment::PanelContainment || - c->containmentType() == Plasma::Containment::CustomPanelContainment; -} - -Plasma::Corona *ScriptEngine::corona() const -{ - return m_corona; -} - -bool ScriptEngine::evaluateScript(const QString &script, const QString &path) -{ - //kDebug() << "evaluating" << m_editor->toPlainText(); - evaluate(script, path); - if (hasUncaughtException()) { - //kDebug() << "catch the exception!"; - QString error = i18n("Error: %1 at line %2\n\nBacktrace:\n%3", - uncaughtException().toString(), - QString::number(uncaughtExceptionLineNumber()), - uncaughtExceptionBacktrace().join("\n ")); - emit printError(error); - return false; - } - - return true; -} - -void ScriptEngine::exception(const QScriptValue &value) -{ - //kDebug() << "exception caught!" << value.toVariant(); - emit printError(value.toVariant().toString()); -} - -} - -#include "moc_scriptengine.cpp" - diff --git a/libs/plasmagenericshell/scripting/scriptengine.h b/libs/plasmagenericshell/scripting/scriptengine.h deleted file mode 100644 index 5c1ae2fb..00000000 --- a/libs/plasmagenericshell/scripting/scriptengine.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 SCRIPTENGINE -#define SCRIPTENGINE - -#include -#include - -#include "plasmagenericshell_export.h" - -namespace Plasma -{ - class Applet; - class Containment; - class Corona; -} // namespace Plasma - -namespace WorkspaceScripting -{ - -class Containment; - -class PLASMAGENERICSHELL_EXPORT ScriptEngine : public QScriptEngine -{ - Q_OBJECT - -public: - ScriptEngine(Plasma::Corona *corona, QObject *parent = 0); - ~ScriptEngine(); - - Plasma::Corona *corona() const; - bool evaluateScript(const QString &script, const QString &path = QString()); - QScriptValue wrap(Plasma::Applet *w); - virtual QScriptValue wrap(Plasma::Containment *c); - QScriptValue wrap(Containment *c); - virtual int defaultPanelScreen() const; - - static bool isPanel(const Plasma::Containment *c); - static ScriptEngine *envFor(QScriptEngine *engine); - -Q_SIGNALS: - void print(const QString &string); - void printError(const QString &string); - void createPendingPanelViews(); - -private: - void setupEngine(); - static QString onlyExec(const QString &commandLine); - - // containment accessors - static QStringList availableContainments(const QString &type); - static QScriptValue newActivity(QScriptContext *context, QScriptEngine *engine); - static QScriptValue newPanel(QScriptContext *context, QScriptEngine *engine); - static QScriptValue panelById(QScriptContext *context, QScriptEngine *engine); - static QScriptValue panels(QScriptContext *context, QScriptEngine *engine); - static QScriptValue fileExists(QScriptContext *context, QScriptEngine *engine); - static QScriptValue loadTemplate(QScriptContext *context, QScriptEngine *engine); - static QScriptValue applicationExists(QScriptContext *context, QScriptEngine *engine); - static QScriptValue applicationPath(QScriptContext *context, QScriptEngine *engine); - static QScriptValue userDataPath(QScriptContext *context, QScriptEngine *engine); - static QScriptValue knownWallpaperPlugins(QScriptContext *context, QScriptEngine *engine); - static QScriptValue configFile(QScriptContext *context, QScriptEngine *engine); - - // helpers - static QScriptValue createContainment(const QString &type, const QString &defautPlugin, - QScriptContext *context, QScriptEngine *engine); - -private Q_SLOTS: - void exception(const QScriptValue &value); - -private: - Plasma::Corona *m_corona; - QScriptValue m_scriptSelf; -}; - -static const int PLASMA_DESKTOP_SCRIPTING_VERSION = 7; -} - -#endif - diff --git a/libs/plasmagenericshell/scripting/widget.cpp b/libs/plasmagenericshell/scripting/widget.cpp deleted file mode 100644 index 8c3b0daf..00000000 --- a/libs/plasmagenericshell/scripting/widget.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "widget.h" - -#include -#include - -#include -#include -#include - -namespace WorkspaceScripting -{ - -class Widget::Private -{ -public: - Private() - { - } - - QWeakPointer applet; -}; - -Widget::Widget(Plasma::Applet *applet, QObject *parent) - : Applet(parent), - d(new Widget::Private) -{ - d->applet = applet; - setCurrentConfigGroup(QStringList()); - setCurrentGlobalConfigGroup(QStringList()); -} - -Widget::~Widget() -{ - reloadConfigIfNeeded(); - delete d; -} - -uint Widget::id() const -{ - if (d->applet) { - return d->applet.data()->id(); - } - - return 0; -} - -QString Widget::type() const -{ - if (d->applet) { - return d->applet.data()->pluginName(); - } - - return QString(); -} - -void Widget::remove() -{ - if (d->applet) { - d->applet.data()->destroy(); - d->applet.clear(); - } -} - -void Widget::setGlobalShortcut(const QString &shortcut) -{ - if (d->applet) { - d->applet.data()->setGlobalShortcut(KShortcut(shortcut)); - } -} - -QString Widget::globalShorcut() const -{ - if (d->applet) { - return d->applet.data()->globalShortcut().toString(); - } - - return QString(); -} - -Plasma::Applet *Widget::applet() const -{ - return d->applet.data(); -} - -int Widget::index() const -{ - if (!d->applet) { - return -1; - } - - Plasma::Applet *applet = d->applet.data(); - Plasma::Containment *c = applet->containment(); - if (!c) { - return -1; - } - - QGraphicsLayout *layout = c->layout(); - if (!layout) { - return - 1; - } - - for (int i = 0; i < layout->count(); ++i) { - if (layout->itemAt(i) == applet) { - return i; - } - } - - return -1; -} - -void Widget::setIndex(int index) -{ - if (!d->applet) { - return; - } - - Plasma::Applet *applet = d->applet.data(); - Plasma::Containment *c = applet->containment(); - if (!c) { - return; - } - - //FIXME: this is hackish. would be nice to define this for gridlayouts too - QGraphicsLinearLayout *layout = dynamic_cast(c->layout()); - if (!layout) { - return; - } - - layout->insertItem(index, applet); -} - -QRectF Widget::geometry() const -{ - if (d->applet) { - return d->applet.data()->geometry(); - } - - return QRectF(); -} - -void Widget::setGeometry(const QRectF &geometry) -{ - if (d->applet) { - d->applet.data()->setGeometry(geometry); - KConfigGroup cg = d->applet.data()->config().parent(); - if (cg.isValid()) { - cg.writeEntry("geometry", geometry); - } - } -} - -void Widget::showConfigurationInterface() -{ - if (d->applet) { - d->applet.data()->showConfigurationInterface(); - } -} - -} - -#include "moc_widget.cpp" - diff --git a/libs/plasmagenericshell/scripting/widget.h b/libs/plasmagenericshell/scripting/widget.h deleted file mode 100644 index 87f73876..00000000 --- a/libs/plasmagenericshell/scripting/widget.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 WIDGET -#define WIDGET - -#include - -#include "applet.h" - -#include "plasmagenericshell_export.h" - -namespace Plasma -{ - class Applet; -} // namespace Plasma - -namespace WorkspaceScripting -{ - -class PLASMAGENERICSHELL_EXPORT Widget : public Applet -{ - Q_OBJECT - Q_PROPERTY(QString type READ type) - Q_PROPERTY(QString version READ version) - Q_PROPERTY(int id READ id) - Q_PROPERTY(QStringList configKeys READ configKeys) - Q_PROPERTY(QStringList configGroups READ configGroups) - Q_PROPERTY(QStringList globalConfigKeys READ globalConfigKeys) - Q_PROPERTY(QStringList globalConfigGroups READ globalConfigGroups) - Q_PROPERTY(int index WRITE setIndex READ index) - Q_PROPERTY(QRectF geometry WRITE setGeometry READ geometry) - Q_PROPERTY(QStringList currentConfigGroup WRITE setCurrentConfigGroup READ currentConfigGroup) - Q_PROPERTY(QString globalShortcut WRITE setGlobalShortcut READ globalShorcut) - Q_PROPERTY(bool locked READ locked WRITE setLocked) - -public: - Widget(Plasma::Applet *applet, QObject *parent = 0); - ~Widget(); - - uint id() const; - QString type() const; - - int index() const; - void setIndex(int index); - - QRectF geometry() const; - void setGeometry(const QRectF &geometry); - - void setGlobalShortcut(const QString &shortcut); - QString globalShorcut() const; - - Plasma::Applet *applet() const; - -public Q_SLOTS: - void remove(); - void showConfigurationInterface(); - - // from the applet interface - QVariant readConfig(const QString &key, const QVariant &def = QString()) const { return Applet::readConfig(key, def); } - void writeConfig(const QString &key, const QVariant &value) { Applet::writeConfig(key, value); } - - QVariant readGlobalConfig(const QString &key, const QVariant &def = QString()) const { return Applet::readGlobalConfig(key, def); } - void writeGlobalConfig(const QString &key, const QVariant &value) { Applet::writeGlobalConfig(key, value); } - - void reloadConfig() { Applet::reloadConfig(); } - -private: - class Private; - Private * const d; -}; - -} - -#endif - diff --git a/plasma/CMakeLists.txt b/plasma/CMakeLists.txt index 59043e22..6d511488 100644 --- a/plasma/CMakeLists.txt +++ b/plasma/CMakeLists.txt @@ -5,23 +5,12 @@ include_directories( add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1204) -MACRO(installPackage dir component) - SET(root ${ARGN}) - IF(NOT root) - SET(root plasma/plasmoids) - ENDIF(NOT root) - install(DIRECTORY ${dir}/ DESTINATION ${KDE4_DATA_INSTALL_DIR}/${root}/${component} PATTERN Messages.sh EXCLUDE PATTERN CMakeLists.txt EXCLUDE) - install(FILES ${dir}/metadata.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR} RENAME plasma-applet-${component}.desktop) -ENDMACRO(installPackage) - add_subdirectory(applets) add_subdirectory(containmentactions) add_subdirectory(containments) add_subdirectory(dataengines) -add_subdirectory(declarativeimports) add_subdirectory(desktoptheme) add_subdirectory(runners) -add_subdirectory(scriptengine) add_subdirectory(shells) add_subdirectory(wallpapers) add_subdirectory(toolboxes) diff --git a/plasma/README b/plasma/README deleted file mode 100644 index 3db74840..00000000 --- a/plasma/README +++ /dev/null @@ -1,61 +0,0 @@ -PLASMA -====== - -The applications and plugins that provide the panels/desktop/dashboard parts of -the primary user interface for the KDE Plasma workspaces (Plasma Desktop, Netbook, etc). -Much of the functionality is provided by libplasma, which is found in kdelibs/plasma/. - -Directory Structure -=================== - -Each top level directory denotes which workspace (desktop, netbook, screensaver, etc.) -the components within it apply to. There is a directory named "generic" for components -that do not apply to a specific workspace. - -Within each of these top level directories, the following hierarchy exists: - - applets: Applets (aka "plasmoids" or "widgets") that are considered central - to the workspace in question - - containments: Standard containment objects that provide management for the - Plasma contents shown on panels, desktops, screensavers, etc. - - dataengines: DataEngines considered generally useful; more specific/niche - DataEngines can be found in kdeplasma-addons or extragear/plasma/ - - runners: Provides matches to queries; used by KRunner, Kickoff, others - - shell(s): The application(s) that provide the Plasma viewing environment - for a given workspace / formfactor. They also provide - implementations of dialog placement, screen geometry, remote - widget notifications, access request UI, containment - management UI, etc. Essentially all the framework pieces needed - to provide appropriate rendering of an environment for a given - form factor or target device. - - containmentactions: Plugins that provide actions for context menus and other input - triggered action sets - - -In addition to the above, the generic directory also contains: - - wallpapers: Background rendering plugins for containments - scriptengines: Glue between libplasma and APIs provided via dynamic languages or - 3rd party systems; note that the Javascript scriptengines - tools: useful applications for working with Plasma apps, including: - * engineexplorer: a graphical utility to examine engines - * wallpaperviewer: a tool to view Plasma wallpaper plugins - * plasmoidviewer: a viewer for individual Plasma applets, - particularly useful for edevel and debugging - -KDE Base Runtime -================ -A number of important components live in the kdebase-runtime package in the plasma/ -directory, including: - -* The javascript ScriptEngines for Plasmoids, DataEngines and Runners -* plasmapkg: Installs, removes and lists plasma packages -* remotewidgetshelper: a small help tool for Plasma applets that are remoted over - the network - -The default SVG themes also exist in kdebase-runtime under desktopthemes/ diff --git a/plasma/applets/batterymonitor/Messages.sh b/plasma/applets/batterymonitor/Messages.sh index 102377c1..53f2177e 100755 --- a/plasma/applets/batterymonitor/Messages.sh +++ b/plasma/applets/batterymonitor/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_battery.pot +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_battery.pot rm -f rc.cpp diff --git a/plasma/applets/calculator/Messages.sh b/plasma/applets/calculator/Messages.sh index 303190d9..505d5474 100755 --- a/plasma/applets/calculator/Messages.sh +++ b/plasma/applets/calculator/Messages.sh @@ -1,2 +1,4 @@ -#! /usr/bin/env bash -$XGETTEXT `find . -name \*.qml` -o $podir/plasma_applet_calculator.pot +#!/bin/bash +$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_calculator.pot +rm -f rc.cpp diff --git a/plasma/applets/devicenotifier/Messages.sh b/plasma/applets/devicenotifier/Messages.sh index c784aaa9..c7548def 100644 --- a/plasma/applets/devicenotifier/Messages.sh +++ b/plasma/applets/devicenotifier/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_notifier.pot +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_notifier.pot rm -f rc.cpp diff --git a/plasma/applets/keyboard/keyboard.cpp b/plasma/applets/keyboard/keyboard.cpp index d884bfdd..26f2d4b3 100644 --- a/plasma/applets/keyboard/keyboard.cpp +++ b/plasma/applets/keyboard/keyboard.cpp @@ -158,7 +158,7 @@ void KeyboardApplet::constraintsEvent(Plasma::Constraints constraints) case Plasma::FormFactor::Horizontal: case Plasma::FormFactor::Vertical: { // panel - iconsize = KIconLoader::global()->currentSize(KIconLoader::Panel); + iconsize = 0; break; } default: { @@ -169,6 +169,15 @@ void KeyboardApplet::constraintsEvent(Plasma::Constraints constraints) } setMinimumSize(iconsize, iconsize); } + // TODO: hint + if (constraints & Plasma::SizeConstraint) { + const QSizeF appletsize = size(); + int iconsize = qMin(appletsize.width(), appletsize.height()); + if (iconsize <= 0) { + iconsize = KIconLoader::global()->currentSize(KIconLoader::Panel); + } + setPreferredSize(iconsize, iconsize); + } } void KeyboardApplet::slotLayoutChanged() diff --git a/plasma/applets/lockout/Messages.sh b/plasma/applets/lockout/Messages.sh index 6b5ce37f..71ad5ca0 100755 --- a/plasma/applets/lockout/Messages.sh +++ b/plasma/applets/lockout/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_lockout.pot +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_lockout.pot rm -f rc.cpp diff --git a/plasma/applets/lockout/lockout.cpp b/plasma/applets/lockout/lockout.cpp index 0fffcfe0..f66abd61 100644 --- a/plasma/applets/lockout/lockout.cpp +++ b/plasma/applets/lockout/lockout.cpp @@ -455,8 +455,6 @@ void LockoutApplet::createConfigurationInterface(KConfigDialog *parent) connect(parent, SIGNAL(okClicked()), this, SLOT(slotConfigAccepted())); } -// NOTE: keep in sync with: -// plasma/applets/pager/pager.cpp void LockoutApplet::updateSizes() { switch (m_layout->orientation()) { diff --git a/plasma/applets/notifications/Messages.sh b/plasma/applets/notifications/Messages.sh index 1694a509..1e343803 100644 --- a/plasma/applets/notifications/Messages.sh +++ b/plasma/applets/notifications/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_notifications.pot +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_notifications.pot rm -f rc.cpp diff --git a/plasma/applets/systemtray/CMakeLists.txt b/plasma/applets/systemtray/CMakeLists.txt index 78ce00b0..e82e812c 100644 --- a/plasma/applets/systemtray/CMakeLists.txt +++ b/plasma/applets/systemtray/CMakeLists.txt @@ -1,52 +1,21 @@ -project(plasma-systemtray) - -set(data_install_dir "plasma/packages/org.kde.systemtray") - -add_definitions(-DSYSTEMTRAY_DATA_INSTALL_DIR="${data_install_dir}") +project(plasma-applet-systemtray) set(systemtray_SRCS - core/manager.cpp - core/protocol.cpp - core/task.cpp - - protocols/fdo/fdoprotocol.cpp - protocols/fdo/fdotask.cpp - protocols/fdo/fdographicswidget.cpp - protocols/fdo/fdoselectionmanager.cpp - protocols/fdo/x11embedcontainer.cpp - protocols/fdo/x11embeddelegate.cpp - protocols/fdo/x11embedpainter.cpp - - protocols/plasmoid/plasmoidtaskprotocol.cpp - protocols/plasmoid/plasmoidtask.cpp - - protocols/dbussystemtray/dbussystemtraytask.cpp - protocols/dbussystemtray/dbussystemtrayprotocol.cpp - - ui/applet.cpp - ui/widgetitem.cpp - ui/mouseredirectarea.cpp + systemtray.cpp ) kde4_add_plugin(plasma_applet_systemtray ${systemtray_SRCS}) -include_directories(${CMAKE_SOURCE_DIR}) target_link_libraries(plasma_applet_systemtray - ${QT_QTDECLARATIVE_LIBRARIES} - KDE4::kdeui KDE4::plasma - KDE4::solid - ${X11_LIBRARIES} - ${X11_Xrender_LIB} - ${X11_Xfixes_LIB} ) -if(X11_Xdamage_FOUND) - target_link_libraries(plasma_applet_systemtray ${X11_Xdamage_LIB}) -endif() -if(X11_Xcomposite_FOUND) - target_link_libraries(plasma_applet_systemtray ${X11_Xcomposite_LIB}) -endif() +install( + TARGETS plasma_applet_systemtray + DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} +) -install(TARGETS plasma_applet_systemtray DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) -install(DIRECTORY "package/" DESTINATION "${KDE4_DATA_INSTALL_DIR}/${data_install_dir}") -install(FILES plasma-applet-systemtray.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) +install( + FILES plasma-applet-systemtray.desktop + DESTINATION ${KDE4_SERVICES_INSTALL_DIR} + RENAME plasma-applet-systemtray.desktop +) diff --git a/plasma/applets/systemtray/Messages.sh b/plasma/applets/systemtray/Messages.sh index 3eaf7d2e..60eafc79 100755 --- a/plasma/applets/systemtray/Messages.sh +++ b/plasma/applets/systemtray/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_systemtray.pot -rm rc.cpp +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_systemtray.pot +rm -f rc.cpp diff --git a/plasma/applets/systemtray/core/manager.cpp b/plasma/applets/systemtray/core/manager.cpp deleted file mode 100644 index 18976560..00000000 --- a/plasma/applets/systemtray/core/manager.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** - * manager.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2010 Marco Martin * - * * - * 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 "manager.h" - -#include -#include - -#include - -#include "protocol.h" -#include "task.h" - -#include "../protocols/fdo/fdoprotocol.h" -#include "../protocols/plasmoid/plasmoidtaskprotocol.h" -#include "../protocols/dbussystemtray/dbussystemtrayprotocol.h" - -#include - -namespace SystemTray -{ - -class Manager::Private -{ -public: - Private(Manager *manager) - : q(manager), - plasmoidProtocol(0) - { - } - - void setupProtocol(Protocol *protocol); - - Manager *q; - QList tasks; - PlasmoidProtocol *plasmoidProtocol; -}; - - -Manager::Manager() - : d(new Private(this)) -{ - d->plasmoidProtocol = new PlasmoidProtocol(this); - d->setupProtocol(d->plasmoidProtocol); - d->setupProtocol(new SystemTray::FdoProtocol(this)); - d->setupProtocol(new SystemTray::DBusSystemTrayProtocol(this)); -} - -Manager::~Manager() -{ - delete d; -} - - -QList Manager::tasks() const -{ - return d->tasks; -} - -void Manager::addTask(Task *task) -{ - connect(task, SIGNAL(destroyed(SystemTray::Task*)), this, SLOT(removeTask(SystemTray::Task*))); - connect(task, SIGNAL(changedStatus()), this, SIGNAL(taskStatusChanged())); - - kDebug() << task->name() << "(" << task->taskId() << ")"; - - d->tasks.append(task); - emit taskAdded(task); -} - -void Manager::removeTask(Task *task) -{ - d->tasks.removeAll(task); - disconnect(task, 0, this, 0); - emit taskRemoved(task); -} - -void Manager::forwardConstraintsEvent(Plasma::Constraints constraints, Plasma::Applet *host) -{ - d->plasmoidProtocol->forwardConstraintsEvent(constraints, host); -} - -void Manager::loadApplets(Plasma::Applet *parent) -{ - d->plasmoidProtocol->loadFromConfig(parent); -} - -void Manager::addApplet(const QString appletName, Plasma::Applet *parent) -{ - d->plasmoidProtocol->addApplet(appletName, 0, parent); -} - -void Manager::removeApplet(const QString appletName, Plasma::Applet *parent) -{ - d->plasmoidProtocol->removeApplet(appletName, parent); -} - -QStringList Manager::applets(Plasma::Applet *parent) const -{ - return d->plasmoidProtocol->applets(parent); -} - - -void Manager::Private::setupProtocol(Protocol *protocol) -{ - connect(protocol, SIGNAL(taskCreated(SystemTray::Task*)), q, SLOT(addTask(SystemTray::Task*))); - protocol->init(); -} - -} - - -#include "moc_manager.cpp" diff --git a/plasma/applets/systemtray/core/manager.h b/plasma/applets/systemtray/core/manager.h deleted file mode 100644 index 599a3fd9..00000000 --- a/plasma/applets/systemtray/core/manager.h +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * manager.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2010 Marco Martin * - * * - * 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 SYSTEMTRAYMANAGER_H -#define SYSTEMTRAYMANAGER_H - -#include - -#include - -#include - -namespace Plasma -{ -class Applet; -} - -namespace SystemTray -{ - -class Applet; -class Notification; -class Task; -class Job; - -/** - * w - * @short Creator and amalgamator of the supported system tray specifications - **/ -class Manager : public QObject -{ - Q_OBJECT - -public: - Manager(); - ~Manager(); - - /** - * @return a list of all known Task instances - **/ - QList tasks() const; - - void forwardConstraintsEvent(Plasma::Constraints constraints, Plasma::Applet *host); - - void loadApplets(Plasma::Applet *parent); - - void addApplet(const QString appletName, Plasma::Applet *parent); - - void removeApplet(const QString appletName, Plasma::Applet *parent); - - QStringList applets(Plasma::Applet *parent) const; - -signals: - /** - * Emitted when a new task has been added - **/ - void taskAdded(SystemTray::Task *task); - - /** - * Emitted when status of task changes (such as it changing from - * Passive to NeedsAttention) - **/ - void taskStatusChanged(); - - /** - * Emitted when a task has been removed - **/ - void taskRemoved(SystemTray::Task *task); - -private slots: - void addTask(SystemTray::Task *task); - void removeTask(SystemTray::Task *task); - -private: - class Private; - Private* const d; - - friend class Applet; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/core/protocol.cpp b/plasma/applets/systemtray/core/protocol.cpp deleted file mode 100644 index 719e8b7d..00000000 --- a/plasma/applets/systemtray/core/protocol.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * taskprotocol.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "protocol.h" - - -namespace SystemTray -{ - -Protocol::Protocol(QObject *parent) - : QObject(parent) -{ -} - -} - -#include "moc_protocol.cpp" diff --git a/plasma/applets/systemtray/core/protocol.h b/plasma/applets/systemtray/core/protocol.h deleted file mode 100644 index a6a56b53..00000000 --- a/plasma/applets/systemtray/core/protocol.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * taskprotocol.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 SYSTEMTRAYPROTOCOL_H -#define SYSTEMTRAYPROTOCOL_H - -#include - -namespace SystemTray -{ - class Job; - class Notification; - class Task; -} - - -namespace SystemTray -{ - -/** - * @short System tray protocol base class - * - * To support a new system tray protocol, this class and Task should be - * subclassed and the subclass of this class registered with the global - * Manager. The Protocol subclass should emit taskCreated() for each new - * task created. - **/ -class Protocol : public QObject -{ - Q_OBJECT -public: - explicit Protocol(QObject *parent); - - virtual void init() = 0; - -signals: - /** - * Signals that a new task has been created - **/ - void taskCreated(SystemTray::Task *task); - - /** - * Signals that a new notification has been created - **/ - void jobCreated(SystemTray::Job *job); - - /** - * Signals that a new notification has been created - **/ - void notificationCreated(SystemTray::Notification *notification); -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/core/task.cpp b/plasma/applets/systemtray/core/task.cpp deleted file mode 100644 index 762145fa..00000000 --- a/plasma/applets/systemtray/core/task.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/*************************************************************************** - * task.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "task.h" - -#include -#include - -#include "../ui/applet.h" - -namespace SystemTray -{ - - -class Task::Private -{ -public: - Private() - : status(Task::UnknownStatus), - category(Task::UnknownCategory) - { - } - - QHash widgetsByHost; - Task::Status status; - Task::Category category; - QString name; -}; - - -Task::Task(QObject *parent) - : QObject(parent), - d(new Private) -{ -} - -Task::~Task() -{ - emit destroyed(this); - foreach (QGraphicsWidget * widget, d->widgetsByHost) { - disconnect(widget, 0, this, 0); - // sometimes it appears that the widget will get scheduled for a repaint - // then it gets deleted here and QGraphicsScene doesn't get that straight - // in its bookkeeping and crashes occur; work around this by giving it a - // chance to schedule after the next paintfun - widget->deleteLater(); - } - delete d; -} - -QGraphicsWidget *Task::widget(Plasma::Applet *host, bool createIfNecessary) -{ - Q_ASSERT(host); - - QGraphicsWidget *widget = d->widgetsByHost.value(host); - - if (!widget && createIfNecessary) { - widget = createWidget(host); - - if (widget) { - d->widgetsByHost.insert(host, widget); - connect(widget, SIGNAL(destroyed()), this, SLOT(widgetDeleted())); - } - } - - return widget; -} - -bool Task::isEmbeddable(SystemTray::Applet *host) -{ - if (!host) { - return false; - } - - return (d->widgetsByHost.value(host) || isEmbeddable()) && host->shownCategories().contains(category()); -} - -QHash Task::widgetsByHost() const -{ - return d->widgetsByHost; -} - -void Task::abandon(Plasma::Applet *host) -{ - QGraphicsWidget *widget = d->widgetsByHost.take(host); - if (widget) { - widget->deleteLater(); - } -} - -QGraphicsWidget *Task::forget(Plasma::Applet *host) -{ - return d->widgetsByHost.take(host); -} - -void Task::widgetDeleted() -{ - bool wasEmbeddable = isEmbeddable(); - - QGraphicsWidget *w = static_cast(sender()); - QMutableHashIterator it(d->widgetsByHost); - while (it.hasNext()) { - it.next(); - if (it.value() == w) { - it.remove(); - } - } - - if (!wasEmbeddable && isEmbeddable()) { - // we have to delay this call because some Task subclasses have a single widget that - // becomes embedabble at this point (e.g. FdoTaskWidget). if the signal is emitted - // immediately, another system tray will attempt to immediately embed it, and - // part of that process involves removing the item from any previous layouts. now, - // if that happens because a system tray is being deleted (removed, app exit, logout, etcS) - // then the previous parent layout will be a dangling pointer at this point and - // that will not get fixed up until everything is finished... so.. we delay the signal - QTimer::singleShot(0, this, SLOT(emitChanged())); - } -} - -void Task::emitChanged() -{ - emit changed(this); -} - -bool Task::isUsed() const -{ - return !d->widgetsByHost.isEmpty(); -} - -void Task::setCategory(Category category) -{ - if (d->category == category) { - return; - } - - d->category = category; - emit changedCategory(); - emit changed(this); -} - -Task::Category Task::category() const -{ - return d->category; -} - -void Task::setStatus(Status status) -{ - if (d->status == status) { - return; - } - - d->status = status; - emit changedStatus(); - emit changed(this); -} - -Task::Status Task::status() const -{ - return d->status; -} - -QString Task::name() const -{ - return d->name; -} - - -void Task::setName(QString name) -{ - if (d->name != name) { - d->name = name; - emit changedName(); - } -} - - -} - -#include "moc_task.cpp" diff --git a/plasma/applets/systemtray/core/task.h b/plasma/applets/systemtray/core/task.h deleted file mode 100644 index b4e22cc5..00000000 --- a/plasma/applets/systemtray/core/task.h +++ /dev/null @@ -1,237 +0,0 @@ -/*************************************************************************** - * task.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 SYSTEMTRAYTASK_H -#define SYSTEMTRAYTASK_H - -#include - -#include - -#include - -namespace Plasma -{ - class Applet; -} // namespace Plasma - -namespace SystemTray -{ - - class Applet; - -/** - * @short System tray task base class - * - * To support a new system tray protocol, Protocol and this class should - * be subclassed. - **/ -class Task : public QObject -{ - Q_OBJECT - - Q_PROPERTY(TaskType type READ type CONSTANT) - Q_PROPERTY(QString taskId READ taskId CONSTANT) - Q_PROPERTY(Status status READ status NOTIFY changedStatus) - Q_PROPERTY(QString name READ name NOTIFY changedName) - Q_PROPERTY(Category category READ category NOTIFY changedCategory) - -public: - enum Status { - UnknownStatus = 0, - Passive = 1, - Active = 2, - NeedsAttention = 3 - }; - Q_ENUMS(Status) - - enum Category { - UnknownCategory = 0, - ApplicationStatus = 1, - Communications = 2, - SystemServices = 3, - Hardware = 4 - }; - Q_ENUMS(Category) - - /** - * Derived classes should provide its type. We assume that number of different types of tasks is - * a limited value. So, it's easier to provide constants for each type of tasks than always - * try to cast classes. Moreover, these contants are used in QML code. - */ - enum TaskType { - TypePlasmoid, - TypeX11Task, - TypeStatusItem, - TypeUserDefined - }; - Q_ENUMS(TaskType) - - - virtual ~Task(); - - /** - * Creates a new graphics widget for this task - * - * isEmbeddable() should be checked before creating a new widget. - **/ - QGraphicsWidget* widget(Plasma::Applet *host, bool createIfNecessary = true); - - /** - * @return whether this task is embeddable; true if there is already a widget - * for this host. - */ - bool isEmbeddable(SystemTray::Applet *host); - - /** - * Returns whether this task can be embeddable - * - * Depending on the protocol, there may be circumstances under which - * a new widget can not be created. isEmbeddable() will return false - * under these circumstances. - **/ - virtual bool isEmbeddable() const = 0; - - /** - * Returns whether this task is represented as widget or it provides only information (icon, name, state, etc) - * @return true if task is represented as widget. - */ - virtual bool isWidget() const = 0; - - /** - * Returns the name of this task that should be presented to the user - **/ - QString name() const; - - void setName(QString name); - - /** - * Returns a unique identifier for this task - * - * The identifier is valid between restarts and so is safe to save - **/ - virtual QString taskId() const = 0; - - /** - * Returns an icon that can be associated with this task - * - * The icon returned is not necessarily the same icon that appears - * in the tray icon itself. - **/ - virtual QIcon icon() const = 0; - - /** - * @return true if this task is current being used, e.g. it has created - * widgets for one or more hosts - */ - bool isUsed() const; - - /** - * Sets the category of the task, UnknownCategory by default - * @arg category the category for this task - */ - void setCategory(Category category); - - /** - * @return the category of this task - */ - Category category() const; - - /** - * Sets the status of the task, UnknownStatus by default. - * @arg status the status for this task - */ - void setStatus(Status status); - - /** - * @return the status for this task - */ - Status status() const; - - /** - * This function must always return type of task (an integer value). This value must always be - * the same for each call of function. - * @return a type of task. - */ - virtual TaskType type() const = 0; - - - /** - * Can be used by the hostwhen they no longer wish to use the widget associated - * with the host. - */ - virtual void abandon(Plasma::Applet *host); - -Q_SIGNALS: - /** - * Emitted when something about the task has changed - **/ - //TODO: this should also state _what_ was changed so we can react more - // precisely (and therefore with greater efficiency) - void changed(SystemTray::Task *task); - - /** - * Special signal for changed status - */ - void changedStatus(); - - // if a category of task has been changed - void changedCategory(); - - // If a name of task has been changed - void changedName(); - - /// if visibility preference of task is changed - void changedVisibilityPreference(); - - /** - * Emitted when the task is about to be destroyed - **/ - void destroyed(SystemTray::Task *task); - -protected: - Task(QObject *parent = 0); - QHash widgetsByHost() const; - QGraphicsWidget *forget(Plasma::Applet *host); - - /** - * Called when a new widget is required - * - * Subclasses should implement this to return a graphics widget that - * handles all user interaction with the task. Ownership of the - * created widget is handled automatically so subclasses should not - * delete the created widget. - **/ - virtual QGraphicsWidget* createWidget(Plasma::Applet *host) = 0; - -private slots: - void widgetDeleted(); - void emitChanged(); - -private: - class Private; - Private* const d; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/package/contents/code/IconsList.js b/plasma/applets/systemtray/package/contents/code/IconsList.js deleted file mode 100644 index db77b46b..00000000 --- a/plasma/applets/systemtray/package/contents/code/IconsList.js +++ /dev/null @@ -1,34 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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. - **********************************************************************************************************************/ -// This JS file is intended for IconsList.qml only as a stuff - -var tasks = {} - -function findMax() { - var max = 0 - for (var i in tasks) { - if (max < tasks[i]) - max = tasks[i] - } - return max -} diff --git a/plasma/applets/systemtray/package/contents/code/TasksSet.js b/plasma/applets/systemtray/package/contents/code/TasksSet.js deleted file mode 100644 index 12fd6513..00000000 --- a/plasma/applets/systemtray/package/contents/code/TasksSet.js +++ /dev/null @@ -1,130 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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. - **********************************************************************************************************************/ - -// This is stateless library, it may be shared between several qml files -.pragma library - - -// Represents task -var Task = function(id, index, category, data) -{ - this.id = id - this.index = index - this.category = category - this.data = data -} - - -/** - * Creates new set of tasks - * @param categories_list a list of categories, this list gives order of categories - */ -var TasksSet = function(categories_list) -{ - var _categories = categories_list - var _tasks = {} // internal set of tasks - var _tasks_as_array = [] // array of tasks - - // number of tasks in each location with the same category - var _cat_sizes = {} - for (var i = 0, s = _categories.length; i < s; ++i) { - _cat_sizes[_categories[i]] = 0 - } - - // Finds correct model index for new task - function _findIndex(category) - { - var index = 0 // index is a sum of numbers of tasks groupped by category - for (var c = 0, l = _categories.length; c < l && _categories[c] !== category; ++c) - index += _cat_sizes[_categories[c]] - return index - } - - // Increments model indexes for tasks - function _incIndexes(index) - { - for (var i = 0, len = _tasks_as_array.length; i < len; ++i) { - var t = _tasks_as_array[i] - if (t.index >= index) - t.index++ - } - } - - // Decrement indexes of tasks - function _decIndexes(index) - { - for (var i = 0, len = _tasks_as_array.length; i < len; ++i) { - var t = _tasks_as_array[i] - if (t.index >= index) - t.index-- - } - } - - // Returns object representing properties of task - function _get(id) { - return _tasks[id] - } - this.get = _get - - /** - * Adds new task to set - * @param id unique id of task - * @param category a category of task - * @param data an additional data to accociate with task - * @return a new task object - */ - function _add(id, category, data) - { - var index = _findIndex(category) // first of all, find correct model index to insert task - _incIndexes(index) - var t = new Task(id, index, category, data) - _tasks[id] = t - _cat_sizes[category]++ - _tasks_as_array.push(t) - return t - } - this.add = _add - - /** - * Removes tasks from set - * @param id an unique ID of task - * @return an object containing properties of old task - */ - function _remove(id) - { - var t = _tasks[id] //find task using ID - // remove task from array, we remove last item and move it to new place - var arr_index = 0 - var len = _tasks_as_array.length - for (; _tasks_as_array[arr_index] !== t; ++arr_index); - if (arr_index < len-1) - _tasks_as_array[arr_index] = _tasks_as_array[len-1] // move item - _tasks_as_array.pop() - // remove task from internal set & decrement indexes - _cat_sizes[t.category]-- - delete _tasks[id] - _decIndexes(t.index) - return t - } - this.remove = _remove -} diff --git a/plasma/applets/systemtray/package/contents/code/main.js b/plasma/applets/systemtray/package/contents/code/main.js deleted file mode 100644 index 22ce8b82..00000000 --- a/plasma/applets/systemtray/package/contents/code/main.js +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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. - **********************************************************************************************************************/ - -// This isn't a stateless library, it is intended only as a stuff for main.qml - -// Constants -var ICONS_SIZE = 24 // Size of icons, icons are square i.e. width == height -var MINIMUM_SIZE = 8 // minimum size of widget -var ARROW_MARGINS = 5 // margins for an arrow -var BLINK_INTERVAL = 750 // time interval of blinking -var TASK_NOTIFICATIONS_TYPEID = "notifications" -var USE_GRID_IN_POPUP = false // true if in popup icons should be placed like a grid without names - - -// [const] Location of item (model for icon) -var LOCATION_TRAY = 0 -var LOCATION_POPUP = LOCATION_TRAY + 1 -var LOCATION_NOTIFICATION = LOCATION_POPUP + 1 - - -// [const] List of possible locations -var LOCATIONS = [ - LOCATION_TRAY, - LOCATION_POPUP, - LOCATION_NOTIFICATION -] - -// [const] Number of locations -var LOCATIONS_NUMBER = LOCATIONS.length - -// This list determines order of categories of tasks -var CATEGORIES = [ - UnknownCategory, - ApplicationStatus, - Communications, - SystemServices, - Hardware -] - -// all available tasks by their id -var allTasks = {} - -// Set of tasks sets, each set for one location (area) -var tasks = new Array(LOCATIONS_NUMBER) - - -// Returns location of task by ID of task -function findLocation(id) -{ - for (var i = 0; i < LOCATIONS_NUMBER; ++i) { - if (tasks[i].get(id)) - return LOCATIONS[i] - } -} diff --git a/plasma/applets/systemtray/package/contents/ui/ArrowArea.qml b/plasma/applets/systemtray/package/contents/ui/ArrowArea.qml deleted file mode 100644 index ce8a41e1..00000000 --- a/plasma/applets/systemtray/package/contents/ui/ArrowArea.qml +++ /dev/null @@ -1,147 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - id: arrow_area - - property variant content; ///< content of popup dialog - property int arrow_size: 12 // size of an icon - - MouseArea { - anchors.fill: parent - onClicked: togglePopup() - } - - PlasmaCore.SvgItem { - - id: arrow_widget - - anchors.centerIn: parent - width: arrow_size - height: width - - svg: PlasmaCore.Svg { imagePath: "widgets/arrows" } - elementId: "left-arrow" - } - - // Tooltip for arrow ----------------------------------------------------------------------------------------------- - PlasmaCore.ToolTip { - id: arrow_tooltip - target: arrow_widget - subText: dialog.visible ? i18n("Hide icons") : i18n("Show hidden icons") - } - - // Popup dialog (window) ------------------------------------------------------------------------------------------- - PlasmaCore.Dialog { - id: dialog - visible: false - mainItem: content - location: plasmoid.location - windowFlags: Qt.WindowStaysOnTopHint - - onActiveWindowChanged: dialog.visible = activeWindow // hide window if it deactivates - - - // We have to move dialog if its size is changed - onHeightChanged: updatePosition() - onWidthChanged: updatePosition() - - onVisibleChanged: { - if (visible) { - if (dialog.windowId) - plasmoid.hideFromTaskbar(dialog.windowId) - updatePosition() - } - } - - function updatePosition() { - var pos = dialog.popupPosition(arrow_area, Qt.AlignCenter) - x = pos.x - y = pos.y - } - } - - - function togglePopup() { - if (dialog.visible) { - dialog.visible = false - return - } - dialog.visible = true - dialog.activateWindow() - } - - - states: [ - State { - name: "LEFT_EDGE" - PropertyChanges { - target: arrow_widget - elementId: dialog.visible ? "left-arrow" : "right-arrow" - } - }, - - State { - name: "RIGHT_EDGE" - PropertyChanges { - target: arrow_widget - elementId: dialog.visible ? "right-arrow" : "left-arrow" - } - }, - - State { - name: "TOP_EDGE" - PropertyChanges { - target: arrow_widget - elementId: dialog.visible ? "up-arrow" : "down-arrow" - } - }, - - State { - name: "BOTTOM_EDGE" - PropertyChanges { - target: arrow_widget - elementId: dialog.visible ? "down-arrow" : "up-arrow" - } - }, - - State { - name: "NORMAL" - PropertyChanges { target: arrow_widget; scale: 1.0 } - }, - - State { - name: "PRESSED" - PropertyChanges { target: arrow_widget; scale: 0.9 } - } - ] - - transitions: [ - Transition { - NumberAnimation { properties: "scale"; duration: 50 } - } - ] -} diff --git a/plasma/applets/systemtray/package/contents/ui/IconsGrid.qml b/plasma/applets/systemtray/package/contents/ui/IconsGrid.qml deleted file mode 100644 index 8448f304..00000000 --- a/plasma/applets/systemtray/package/contents/ui/IconsGrid.qml +++ /dev/null @@ -1,128 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 1.1 - -Item { - id: root_item - - property int icons_size: 24 ///< Size of icons, icons are square i.e. width == height - property int icons_margins: 2 ///< Margins for icons - property alias icons_number: grid.count ///< [readonly] Number of icons - property alias model: grid.model; ///< Model for grid - property int cols_num: 0 ///< [readonly] Number of columns - property int rows_num: 0 ///< [readonly] Number of rows - property int min_width: cols_num*cell_size ///< [readonly] minimum width of component required to show whole grid - property int min_height: rows_num*cell_size ///< [readonly] minimum height of compontn required to show whole grid - property int cell_size: icons_size + 2*icons_margins ///< [readonly] size of grid cell - - property int _sqrt: 0 - property int _sqrt2: _sqrt*_sqrt - - GridView { - id: grid - anchors.centerIn: parent - width: min_width - height: min_height - - cellWidth: cell_size - cellHeight: cellWidth - interactive: false - delegate: TrayIcon { width: grid.cellWidth; height: grid.cellHeight } - } - - states: [ - /// Base state for square states (for internal use only) - State { - name: "__SQR" - - PropertyChanges { - target: root_item - _sqrt: Math.floor(Math.sqrt(grid.count)) - } - }, - - /// Vertical layout of grid - State { - name: "VERT" - - PropertyChanges { - target: root_item - _sqrt: 0 - cols_num: grid.count*cell_size <= width ? grid.count : Math.max(1, Math.floor(width / cell_size)) - rows_num: cols_num > 0 ? (Math.max(1, Math.floor(grid.count / cols_num)) + (grid.count % cols_num ? 1 : 0)) : 0 - } - PropertyChanges { - target: grid - flow: GridView.LeftToRight - } - }, - - /// Horizontal layout of grid - State { - name: "HORZ" - - PropertyChanges { - target: root_item - _sqrt: 0 - rows_num: grid.count*cell_size <= height ? grid.count : Math.max(1, Math.floor(height / cell_size)) - cols_num: rows_num > 0 ? (Math.max(1, Math.floor(grid.count / rows_num)) + (grid.count % rows_num ? 1 : 0)) : 0 - } - PropertyChanges { - target: grid - flow: GridView.TopToBottom - } - }, - - /// Square layout of grid with horizontal flow - State { - name: "SQR_H" - extend: "__SQR" - - PropertyChanges { - target: root_item - cols_num: ( grid.count > _sqrt2 ? _sqrt + 1 : _sqrt ) - rows_num: ( grid.count > _sqrt2 + _sqrt ? _sqrt + 1 : _sqrt ) - } - PropertyChanges { - target: grid - flow: GridView.LeftToRight - } - }, - - /// Square layout of grid with vertical flow - State { - name: "SQR_V" - extend: "__SQR" - PropertyChanges { - target: root_item - rows_num: ( grid.count > _sqrt2 ? _sqrt + 1 : _sqrt ) - cols_num: ( grid.count > _sqrt2 + _sqrt ? _sqrt + 1 : _sqrt ) - } - PropertyChanges { - target: grid - flow: GridView.TopToBottom - } - } - ] -} diff --git a/plasma/applets/systemtray/package/contents/ui/IconsList.qml b/plasma/applets/systemtray/package/contents/ui/IconsList.qml deleted file mode 100644 index 42a8cd7d..00000000 --- a/plasma/applets/systemtray/package/contents/ui/IconsList.qml +++ /dev/null @@ -1,147 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import Private 0.1 - -import "../code/IconsList.js" as IconsListJS - -MouseArea { - id: root_item - - property int icons_size: 24 ///< Size of icons, icons are square i.e. width == height - property int icons_margins: icons_size/6 ///< Margins for icons - property alias icons_number: repeater.count ///< [readonly] Number of icons - property alias model: repeater.model; ///< Model for grid - property int cell_size: icons_size + 2*icons_margins ///< [readonly] size of grid cell - - //Those properties are used by PlasmaCore.Dialog for size hints - property int extraHorizMargins: delegate_highlight.marginHints.right - property int minimumWidth: extraHorizMargins + layoutColumn.childrenRect.width ///< [readonly] minimum width of component required to show whole grid - property int minimumHeight:layoutColumn.childrenRect.height ///< [readonly] minimum height of compontn required to show whole grid - property int maximumWidth: minimumWidth - property int maximumHeight: minimumHeight - - hoverEnabled: true - - Component { - id: delegate_task - - MouseRedirectArea { - id: delegate_root_item - width: Math.max(minimumWidth - extraHorizMargins, childrenRect.width) - height: childrenRect.height - - // we redirect some events to IconWidget or applet - target: task.type == TypeStatusItem ? ui_item.getMouseArea() : task - applet: plasmoid - - // Next events we process manually - onClickMiddle: ui_item.click(Qt.MiddleButton) - onClickRight: ui_item.click(Qt.RightButton) - onScrollVert: ui_item.scrollVert(delta) - onScrollHorz: ui_item.scrollHorz(delta) - onEntered: { - delegate_highlight.y = delegate_root_item.y - } - - Row { - Item { - id: tray_icon - - width: cell_size - height: width - - TrayIcon { - anchors.centerIn: parent - width: icons_size - height: width - } - } - - PlasmaComponents.Label { - id: name_item - anchors.verticalCenter: tray_icon.verticalCenter - wordWrap: false - text: task.name - } - } - - - Component.onCompleted: { - var text_width = name_item.width - IconsListJS.tasks[delegate_root_item] = text_width - } - - Component.onDestruction: { - delete IconsListJS.tasks[delegate_root_item] - } - - Connections { - target: task - onChangedName: { - // if name is changed => we should recalculate width of popup - IconsListJS.tasks[delegate_root_item] = name_item.width - } - } - - } - - } - - PlasmaComponents.Highlight { - id: delegate_highlight - height: cell_size - width: minimumWidth - opacity: root_item.containsMouse - - Behavior on opacity { - NumberAnimation { - duration: 150 - easing.type: Easing.InOutQuad - } - } - Behavior on y { - NumberAnimation { - duration: 250 - easing.type: Easing.InOutQuad - } - } - } - - - Column { - id: layoutColumn - spacing: 0 - Repeater { - id: repeater - delegate: delegate_task - } - - } - - Component.onCompleted: { - console.log("========================> " + " " + minimumWidth + " " + layoutColumn.childrenRect.width); - } -} diff --git a/plasma/applets/systemtray/package/contents/ui/StatusNotifierItem.qml b/plasma/applets/systemtray/package/contents/ui/StatusNotifierItem.qml deleted file mode 100644 index 5772431c..00000000 --- a/plasma/applets/systemtray/package/contents/ui/StatusNotifierItem.qml +++ /dev/null @@ -1,231 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 1.1 -import Private 0.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 as QtExtraComponents - - -Item { - id: root_item - - property int blink_interval: 1000 // interval of blinking (if status of task is NeedsAttention) - property variant task: null // task that provides information for item - - property bool __has_task: task ? true : false - property string __icon_name: __has_task ? task.iconName : "" - property string __att_icon_name: __has_task ? task.attIconName : "" - property variant __icon: __has_task ? task.icon : QIcon("default") - property variant __att_icon: __has_task ? task.attIcon : __getDefaultIcon() - property string __overlay_icon_name: __has_task ? task.overlayIconName : "" - property int __status: __has_task ? task.status : UnknownStatus - //Hack for activating only items that has been clicked by ourselves - property variant __clickTime: 0; - - // Public functions ================================================================================================ - function click(buttons) { - __processClick(buttons, mouse_area) - } - - function scrollHorz(delta) { - task.activateHorzScroll(delta) - } - - function scrollVert(delta) { - task.activateVertScroll(delta) - } - - function getMouseArea() { - return mouse_area - } - - Connections { - target: task - - onChangedShortcut: { - // update shortcut for icon widget - if (!icon_widget.action) - return - plasmoid.updateShortcutAction(icon_widget.action, task.shortcut) - icon_widget.action.triggered.disconnect(__onActivatedShortcut) // disconnect old signals - icon_widget.action.triggered.connect(__onActivatedShortcut) - } - - onShowContextMenu: { - //refuse events for elapsed times < 1 second - var time = new Date().getTime(); - if (time - __clickTime < 1000) { - plasmoid.showMenu(menu, x, y, root_item) - } - } - } - - function __onActivatedShortcut() { - __processClick(Qt.LeftButton, icon_widget) - } - - - // Timer for blink effect ========================================================================================== - Timer { - id: timer_blink - running: false - repeat: true - interval: blink_interval - - property bool is_att_icon: false - - onTriggered: { - icon_widget.source = is_att_icon ? __getAttentionIcon() : __getDefaultIcon() - is_att_icon = !is_att_icon - } - } - - - // TODO: remove wheel area in QtQuick 2.0 - QtExtraComponents.MouseEventListener { - id: wheel_area - anchors.fill: parent - enabled: __has_task - visible: __has_task - z: -2 - - // Mouse events handlers =========================================================================================== - MouseArea { - id: mouse_area - anchors.fill: parent - hoverEnabled: true - // if no task passed we don't accept any buttons, if icon_widget is visible we pass left button to it - acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - enabled: __has_task - visible: __has_task - - onClicked: __processClick(mouse.button, mouse_area) - - // Widget for icon if no animation is requested - PlasmaCore.IconItem { - id: icon_widget - - anchors.fill: parent - - property QtObject action: __has_task ? plasmoid.createShortcutAction(task.objectName + "-" + plasmoid.id) : null - - visible: false - active: mouse_area.containsMouse - - // Overlay icon - Image { - width: 10 // we fix size of an overlay icon - height: width - anchors { right: parent.right; bottom: parent.bottom } - - sourceSize.width: width - sourceSize.height: width - fillMode: Image.PreserveAspectFit - smooth: true - source: "image://icon/" + __overlay_icon_name - visible: __overlay_icon_name - } - - Component.onDestruction: { - var act = icon_widget.action - icon_widget.action = null - plasmoid.destroyShortcutAction(act) - } - } - } - onWheelMoved: { - if (wheel.orientation === Qt.Horizontal) - task.activateHorzScroll(wheel.delta) - else - task.activateVertScroll(wheel.delta) - } - // Tooltip ========================================================================================================= - PlasmaCore.ToolTip { - id: tooltip - target: wheel_area - mainText: __has_task ? task.tooltipTitle : "" - subText: __has_task ? task.tooltipText : "" - image: __has_task ? task.tooltipIcon : "" - } - } - - // Functions ======================================================================================================= - function __getDefaultIcon() { - return task.customIcon(__icon_name != "" ? __icon_name : __icon) - } - - function __getAttentionIcon() { - return task.customIcon(__att_icon_name != "" ? __att_icon_name : __att_icon) - } - - function __processClick(buttons, item) { - __clickTime = (new Date()).getTime(); - var pos = plasmoid.popupPosition(item) - switch (buttons) { - case Qt.LeftButton: task.activate1(pos.x, pos.y); break - case Qt.RightButton: task.activateContextMenu(pos.x, pos.y); break - case Qt.MiddleButton: task.activate2(pos.x, pos.y); break - } - } - - // States ========================================================================================================== - states: [ - // Static icon - State { - name: "__STATIC" - when: __status !== NeedsAttention - PropertyChanges { - target: timer_blink - running: false - } - PropertyChanges { - target: icon_widget - source: __getDefaultIcon() - visible: true - } - StateChangeScript { - script: tooltip.target = icon_widget // binding to property doesn't work - } - }, - // Attention icon - State { - name: "__BLINK" - when: __status === NeedsAttention - PropertyChanges { - target: icon_widget - source: __getAttentionIcon() - visible: true - } - PropertyChanges { - target: timer_blink - running: true - is_att_icon: false - } - StateChangeScript { - script: tooltip.target = icon_widget - } - } - ] - -} diff --git a/plasma/applets/systemtray/package/contents/ui/TrayIcon.qml b/plasma/applets/systemtray/package/contents/ui/TrayIcon.qml deleted file mode 100644 index 7b69ebea..00000000 --- a/plasma/applets/systemtray/package/contents/ui/TrayIcon.qml +++ /dev/null @@ -1,31 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 1.1 - -Item { - id: root_item - - Component.onCompleted: { - ui_item.parent = root_item - } -} diff --git a/plasma/applets/systemtray/package/contents/ui/main.qml b/plasma/applets/systemtray/package/contents/ui/main.qml deleted file mode 100644 index 209091b0..00000000 --- a/plasma/applets/systemtray/package/contents/ui/main.qml +++ /dev/null @@ -1,347 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: LGPLv2+ - * Authors: Dmitry Ashkadov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 1.1 -import Private 0.1 - -import "../code/TasksSet.js" as TasksSet -import "../code/main.js" as JS // stuff & JS additions - -Item { - id: root_item // represents available space on screen - - // This 2 properties must be defined because we use states to set their values - property int minimumWidth: JS.MINIMUM_SIZE - property int minimumHeight: JS.MINIMUM_SIZE - - property int iconSize: Math.min(root_item.width, Math.min(root_item.height, theme.defaultFont.mSize.height < 20 ? 24 : theme.largeIconSize)) //Math.min(root_item.width, Math.min(root_item.height, JS.ICONS_SIZE)) - - // Data Models - property list models: [ - ListModel {id: model_tray}, - ListModel {id: model_popup}, - ListModel {id: model_notifications} - ] - - Connections { - target: plasmoid - - onNewTask: { - // create declarative item - var component = (task.type === TypeStatusItem ? component_status_item : component_widget) - var props = {"task": task} - var item = component.createObject(null, props) - if (item) { - var loc = getLocationForTask(task) - var task_id = plasmoid.getUniqueId(task) - JS.allTasks[task_id] = task - var t = JS.tasks[loc].add(task_id, task.category, item) - models[loc].insert(t.index, {"task": task, "ui_item": item}) - } - } - - onDeletedTask: { - var task_id = plasmoid.getUniqueId(task) - var loc = JS.findLocation(task_id) - var t = JS.tasks[loc].remove(task_id) - models[loc].remove(t.index) - t.data.destroy() // destroy item / we have to destroy it manually because we don't provide parent at initialization - delete JS.allTasks[task_id] - } - - onVisibilityPreferenceChanged: { - // move all tasks to their new location - for (var task_id in JS.allTasks) { - var task = JS.allTasks[task_id] - moveTaskToLocation(task, getLocationForTask(task)) - } - } - - onActivate: arrow_area.togglePopup() - } - - - Component.onCompleted: { - // create sets for tasks - for (var i = 0; i < JS.LOCATIONS_NUMBER; ++i) - JS.tasks[JS.LOCATIONS[i]] = new TasksSet.TasksSet(JS.CATEGORIES) - } - - Item { - id: content_item // represents rectangle containing all visual elements on panel - anchors.centerIn: parent - - // Notifications area in panel part of tray - IconsGrid { - id: notifications_area - icons_size: root_item.iconSize - model: model_notifications - } - - // Tray area that is in panel - IconsGrid { - id: tray_area - icons_size: root_item.iconSize - model: model_tray - } - - // An area that contains arrow - ArrowArea { - id: arrow_area - visible: model_popup.count > 0 - - content: IconsList { - id: popup_area - icons_size: root_item.iconSize - model: model_popup - } - } - } - - // Delegates for views ============================================================================================= - Component { - id: component_status_item - - StatusNotifierItem { - id: status_item - - blink_interval: JS.BLINK_INTERVAL - visible: task !== null - width: root_item.iconSize - height: width - anchors.centerIn: parent - - Connections { - target: task - onChangedStatus: moveTaskToLocation(task, getLocationForTask(task)) - onChangedVisibilityPreference: moveTaskToLocation(task, getLocationForTask(task)) - } - } - } - - Component { - id: component_widget - - WidgetItem { - id: widget_item - - applet: plasmoid - visible: task !== null - width: root_item.iconSize - height: width - anchors.centerIn: parent - - Connections { - target: task - onChangedStatus: moveTaskToLocation(task, getLocationForTask(task)) - onChangedVisibilityPreference: moveTaskToLocation(task, getLocationForTask(task)) - } - } - } - - // Funtions ======================================================================================================== - function getLocationForTask(task) { - var loc = getDefaultLocationForTask(task); - if (loc === JS.LOCATION_TRAY && task.taskId == JS.TASK_NOTIFICATIONS_TYPEID) { - // redefine location for notifications applet - return JS.LOCATION_NOTIFICATION; - } - return loc; - } - - /// Returns location depending on status and hide state of task - function getDefaultLocationForTask(task) { - var vis_pref = plasmoid.getVisibilityPreference(task); - - if (task.status === NeedsAttention || vis_pref === AlwaysShown) { - return JS.LOCATION_TRAY; - } - - if (vis_pref === AlwaysHidden || (task.status !== Active && task.status !== UnknownStatus)) { - return JS.LOCATION_POPUP; - } - - return JS.LOCATION_TRAY; - } - - /// Moves task to specified location - function moveTaskToLocation(task, loc) { - var task_id = plasmoid.getUniqueId(task); - var old_loc = JS.findLocation(task_id); - - if (old_loc === loc) { - return - } - - // remove from old location - var t = JS.tasks[old_loc].remove(task_id); - models[old_loc].remove(t.index); - - // add to new model - t = JS.tasks[loc].add(task_id, t.category, t.data); - models[loc].insert(t.index, {"task": task, "ui_item": t.data}); - } - - - // States ========================================================================================================== - states: [ - State { - name: "_HORZ" // it is shared state for HORZ and FLOAT - AnchorChanges { - target: arrow_area - anchors { left: tray_area.right; top: content_item.top; bottom: content_item.bottom } - } - PropertyChanges { - target: arrow_area - // it's strange but if width of arrow area is set to 0 then this may cause crashing of plasma during resising of panel (somewhere in QtDeclarative) - width: arrow_area.visible ? arrow_area.arrow_size + 2*JS.ARROW_MARGINS : 1 - state: plasmoid.location === TopEdge ? "TOP_EDGE" : "BOTTOM_EDGE" - } - PropertyChanges { - target: popup_area - state: JS.USE_GRID_IN_POPUP ? "SQR_H" : "" - } - }, - - State { - name: "HORZ" - extend: "_HORZ" - when: (plasmoid.formFactor === Horizontal) - - AnchorChanges { - target: notifications_area - anchors { top: content_item.top; bottom: content_item.bottom; left: content_item.left } - } - PropertyChanges { - target: notifications_area - state: "HORZ" - width: notifications_area.min_width - } - AnchorChanges { - target: tray_area - anchors { left: notifications_area.right; top: content_item.top; bottom: content_item.bottom } - } - PropertyChanges { - target: tray_area - state: "HORZ" - width: tray_area.min_width - } - PropertyChanges { - target: content_item - width: notifications_area.width + tray_area.width + arrow_area.width - height: root_item.height - } - PropertyChanges { - target: root_item - minimumWidth: content_item.width - minimumHeight: JS.MINIMUM_SIZE - } - }, - - State { - name: "VERT" - when: (plasmoid.formFactor === Vertical) - - AnchorChanges { - target: notifications_area - anchors { left: content_item.left; right: content_item.right; top: content_item.top } - } - PropertyChanges { - target: notifications_area - state: "VERT" - height: notifications_area.min_height - } - AnchorChanges { - target: tray_area - anchors { left: content_item.left; right: content_item.right; top: notifications_area.bottom } - } - PropertyChanges { - target: tray_area - state: "VERT" - height: tray_area.min_height - } - AnchorChanges { - target: arrow_area - anchors { left: content_item.left; right: content_item.right; top: tray_area.bottom } - } - PropertyChanges { - target: arrow_area - height: arrow_area.visible ? arrow_area.arrow_size + 2*JS.ARROW_MARGINS : 1 - state: plasmoid.location === LeftEdge ? "LEFT_EDGE" : "RIGHT_EDGE" - } - PropertyChanges { - target: popup_area - state: JS.USE_GRID_IN_POPUP ? "SQR_V" : "" - } - PropertyChanges { - target: content_item - width: root_item.width - height: notifications_area.height + tray_area.height + arrow_area.height - } - PropertyChanges { - target: root_item - minimumWidth: JS.MINIMUM_SIZE - minimumHeight: content_item.height - } - }, - - State { - name: "FLOAT" - extend: "_HORZ" - when: (plasmoid.formFactor === Floating) - - PropertyChanges { - target: notifications_area - state: "SQR_H" - width: notifications_area.min_width - height: notifications_area.min_height - } - AnchorChanges { - target: notifications_area - anchors { left: content_item.left; verticalCenter: content_item.verticalCenter } - } - AnchorChanges { - target: tray_area - anchors { left: notifications_area.right; verticalCenter: content_item.verticalCenter } - } - PropertyChanges { - target: tray_area - state: "SQR_V" - width: tray_area.min_width - height: tray_area.min_height - } - PropertyChanges { - target: content_item - width: notifications_area.width + tray_area.width + arrow_area.width - height: Math.max(notifications_area.min_height, tray_area.min_height, arrow_area.arrow_size) - } - PropertyChanges { - target: root_item - minimumWidth: content_item.width - minimumHeight: content_item.height - } - } - ] - - -} diff --git a/plasma/applets/systemtray/plasma-applet-systemtray.desktop b/plasma/applets/systemtray/plasma-applet-systemtray.desktop index ed792ffc..af36247c 100644 --- a/plasma/applets/systemtray/plasma-applet-systemtray.desktop +++ b/plasma/applets/systemtray/plasma-applet-systemtray.desktop @@ -165,8 +165,8 @@ Type=Service X-KDE-ServiceTypes=Plasma/Applet X-KDE-Library=plasma_applet_systemtray -X-KDE-PluginInfo-Author=Alexander Rodin -X-KDE-PluginInfo-Email=rodin.alexander@gmail.com +X-KDE-PluginInfo-Author=Ivailo Monev +X-KDE-PluginInfo-Email=xakepa10@gmail.com X-KDE-PluginInfo-Name=systemtray X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-Website= diff --git a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtrayprotocol.cpp b/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtrayprotocol.cpp deleted file mode 100644 index f7833280..00000000 --- a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtrayprotocol.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/*************************************************************************** - * dbussystemtrayprotocol.cpp * - * * - * Copyright (C) 2009 Marco Martin * - * * - * 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 "dbussystemtraytask.h" -#include "dbussystemtrayprotocol.h" - -#include - - -namespace SystemTray -{ - -DBusSystemTrayProtocol::DBusSystemTrayProtocol(QObject *parent) - : Protocol(parent), - m_dataEngine(Plasma::DataEngineManager::self()->loadEngine("statusnotifieritem")), - m_tasks() -{ -} - -DBusSystemTrayProtocol::~DBusSystemTrayProtocol() -{ - Plasma::DataEngineManager::self()->unloadEngine("statusnotifieritem"); -} - -void DBusSystemTrayProtocol::init() -{ - if (m_dataEngine->isValid()) { - initRegisteredServices(); - connect(m_dataEngine, SIGNAL(sourceAdded(QString)), - this, SLOT(newTask(QString))); - connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), - this, SLOT(cleanupTask(QString))); - } -} - -void DBusSystemTrayProtocol::newTask(const QString &service) -{ - if (m_tasks.contains(service)) { - return; - } - - DBusSystemTrayTask *task = new DBusSystemTrayTask(service, m_dataEngine, this); - - m_tasks[service] = task; -} - -void DBusSystemTrayProtocol::cleanupTask(const QString &service) -{ - DBusSystemTrayTask *task = m_tasks.value(service); - - if (task) { - m_dataEngine->disconnectSource(service, task); - m_tasks.remove(service); - if (task->isValid()) { - emit task->destroyed(task); - } - task->deleteLater(); - } -} - -void DBusSystemTrayProtocol::initedTask(DBusSystemTrayTask *task) -{ - emit taskCreated(task); -} - -void DBusSystemTrayProtocol::initRegisteredServices() -{ - if (m_dataEngine->isValid()) { - foreach (const QString &service, m_dataEngine->sources()) { - newTask(service); - } - } -} - -} - -#include "moc_dbussystemtrayprotocol.cpp" diff --git a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtrayprotocol.h b/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtrayprotocol.h deleted file mode 100644 index 373f8716..00000000 --- a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtrayprotocol.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 Marco Martin * - * * - * 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 DBUSSYSTEMTRAYPROTOCOL_H -#define DBUSSYSTEMTRAYPROTOCOL_H - -#include "../../core/protocol.h" - -#include - -#include - -#include - - -namespace SystemTray -{ - -class DBusSystemTrayTask; - -class DBusSystemTrayProtocol : public Protocol -{ - Q_OBJECT - friend class DBusSystemTrayTask; -public: - DBusSystemTrayProtocol(QObject *parent); - ~DBusSystemTrayProtocol(); - void init(); - -protected: - void initRegisteredServices(); - -protected Q_SLOTS: - void newTask(const QString &service); - void cleanupTask(const QString &taskId); - -private: - void initedTask(DBusSystemTrayTask *task); - - Plasma::DataEngine *m_dataEngine; - QHash m_tasks; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtraytask.cpp b/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtraytask.cpp deleted file mode 100644 index db153ebd..00000000 --- a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtraytask.cpp +++ /dev/null @@ -1,398 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * * - * 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 "dbussystemtraytask.h" -#include "dbussystemtrayprotocol.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace SystemTray -{ - -DBusSystemTrayTask::DBusSystemTrayTask(const QString &serviceName, Plasma::DataEngine *dataEngine, QObject *parent) - : Task(parent), - m_serviceName(serviceName), - m_taskId(serviceName), - m_customIconLoader(0), - m_dataEngine(dataEngine), - m_service(dataEngine->serviceForSource(serviceName)), - m_isMenu(false), - m_valid(false) -{ - kDebug(); - m_service->setParent(this); - - m_dataEngine->connectSource(serviceName, this); -} - -DBusSystemTrayTask::~DBusSystemTrayTask() -{ -} - -QGraphicsWidget* DBusSystemTrayTask::createWidget(Plasma::Applet */*host*/) -{ - return 0; // d-bus tasks don't have widgets but provide info for GUI; -} - -bool DBusSystemTrayTask::isValid() const -{ - return m_valid; -} - -bool DBusSystemTrayTask::isEmbeddable() const -{ - return false; // this task cannot be embed because it only provides information to GUI part -} - -bool DBusSystemTrayTask::isWidget() const -{ - return false; // isn't a widget -} - -void DBusSystemTrayTask::setShortcut(QString text) { - if (m_shortcut != text) { - m_shortcut = text; - emit changedShortcut(); - } -} - - -QString DBusSystemTrayTask::taskId() const -{ - return m_taskId; -} - -QIcon DBusSystemTrayTask::icon() const -{ - return m_icon; -} - -void DBusSystemTrayTask::activate1(int x, int y) const -{ - QMap params; - KJob *job = nullptr; - if (m_isMenu) { - params = m_service->operationParameters("ContextMenu"); - params["x"] = x; - params["y"] = y; - job = m_service->startOperationCall("ContextMenu", params); - } else { - params = m_service->operationParameters("Activate"); - params["x"] = x; - params["y"] = y; - job = m_service->startOperationCall("Activate", params); - } - connect(job, SIGNAL(result(KJob*)), this, SLOT(_onContextMenu(KJob*))); -} - -void DBusSystemTrayTask::activate2(int x, int y) const -{ - QMap params = m_service->operationParameters("SecondaryActivate"); - params["x"] = x; - params["y"] = y; - m_service->startOperationCall("SecondaryActivate", params); -} - -void DBusSystemTrayTask::activateHorzScroll(int delta) const -{ - _activateScroll(delta, "Horizontal"); -} - -// Copied from kde-runtime/plasma/declarativeimports/core/iconitem.cpp -bool static hasm_svgIcon(QVariant source) -{ - // Set up compat envrionment, afterwards it is 100% copy'n'pastable. - const QString element = source.toString(); - const QString filename = element.split("-").first(); - Plasma::Svg svgIcon; - Plasma::Svg *m_svgIcon = &svgIcon; - - //try as a svg toolbar icon - m_svgIcon->setImagePath("toolbar-icons/" + filename); - - //try as a svg normal icon (like systray) - if (!m_svgIcon->isValid() || !m_svgIcon->hasElement(element)) { - m_svgIcon->setImagePath("icons/" + filename); - } - m_svgIcon->setContainsMultipleImages(true); - - //success? - if (m_svgIcon->isValid() && m_svgIcon->hasElement(element)) { - return true; - } - return false; -} - -QVariant DBusSystemTrayTask::customIcon(QVariant variant) const -{ - if (variant.canConvert()) { - // If we have no icon loader there is nothing to be done with strings. - if (!m_customIconLoader) - return variant; - - // If an SVG icon can be found (via Plasma theme) the name needs to be - // passed along for IconItem to be able to resolve to the theme name as - // well. - if (hasm_svgIcon(variant)) - return variant; - - // Otherwise return a QIcon from our custom icon loader. - return QVariant(KIcon(variant.toString(), m_customIconLoader)); - } else { - // Most importantly QIcons. Nothing to do for those. - return variant; - } -} - -void DBusSystemTrayTask::activateVertScroll(int delta) const -{ - _activateScroll(delta, "Vertical"); -} - -void DBusSystemTrayTask::_activateScroll(int delta, QString direction) const -{ - QMap params = m_service->operationParameters("Scroll"); - params["delta"] = delta; - params["direction"] = direction; - m_service->startOperationCall("Scroll", params); -} - -void DBusSystemTrayTask::activateContextMenu(int x, int y) const -{ - QMap params = m_service->operationParameters("ContextMenu"); - params["x"] = x; - params["y"] = y; - KJob *job = m_service->startOperationCall("ContextMenu", params); - connect(job, SIGNAL(result(KJob*)), this, SLOT(_onContextMenu(KJob*))); -} - -void DBusSystemTrayTask::_onContextMenu(KJob *job) -{ - if (QCoreApplication::closingDown()) { - // apparently an edge case can be triggered due to the async nature of all this - // see: https://bugs.kde.org/show_bug.cgi?id=251977 - return; - } - - Plasma::ServiceJob *sjob = qobject_cast(job); - if (!sjob) { - return; - } - - QMenu *menu = qobject_cast(sjob->result().value()); - if (menu) { - int x = sjob->parameters()["x"].toInt(); - int y = sjob->parameters()["y"].toInt(); - emit showContextMenu(x, y, QVariant::fromValue(menu)); - } -} - -void DBusSystemTrayTask::dataUpdated(const QString &taskName, const Plasma::DataEngine::Data &properties) -{ - Q_UNUSED(taskName); - - const QString id = properties["Id"].toString(); - bool becomeValid = false; - if (!id.isEmpty() && id != m_taskId) { - m_taskId = id; - m_valid = true; - becomeValid = true; - setObjectName(QString("SystemTray-%1").arg(m_taskId)); - } - - QString cat = properties["Category"].toString(); - if (!cat.isEmpty()) { - int index = metaObject()->indexOfEnumerator("Category"); - int key = metaObject()->enumerator(index).keyToValue(cat.toLatin1()); - - if (key != -1) { - setCategory((Task::Category)key); - } - } - - if (properties["TitleChanged"].toBool() || becomeValid) { - QString title = properties["Title"].toString(); - if (!title.isEmpty()) { - bool is_title_changed = (name() != title); - setName(title); - if (is_title_changed) { - emit changedTitle(); - emit changed(this); - } - } - } - - if (properties["IconsChanged"].toBool() || becomeValid) { - syncIcons(properties); - emit changedIcons(); - } - - if (properties["StatusChanged"].toBool() || becomeValid) { - syncStatus(properties["Status"].toString()); - } - - if (properties["ToolTipChanged"].toBool() || becomeValid) { - syncToolTip(properties["ToolTipTitle"].toString(), - properties["ToolTipSubTitle"].toString(), - properties["ToolTipIcon"].value()); - } - - bool is_menu = properties["ItemIsMenu"].toBool(); - if (is_menu != m_isMenu) { - m_isMenu = is_menu; - emit changedIsMenu(); - } - - if (becomeValid) { - DBusSystemTrayProtocol *protocol = qobject_cast(parent()); - if (protocol) { - protocol->initedTask(this); - } - } -} - -void DBusSystemTrayTask::syncIcons(const Plasma::DataEngine::Data &properties) -{ - m_icon = properties["Icon"].value(); - m_attentionIcon = properties["AttentionIcon"].value(); - - QString icon_name = properties["IconName"].toString(); - QString att_icon_name = properties["AttentionIconName"].toString(); - QString overlay_icon_name = properties["OverlayIconName"].value(); - QString icon_theme_path = properties["IconThemePath"].value(); - bool is_icon_name_changed = false; - bool is_att_icon_name_changed = false; - bool is_overlay_icon_name_changed = false; - - if (icon_name != m_iconName) { - m_iconName = icon_name; - is_icon_name_changed = true; - } - - if (att_icon_name != m_attentionIconName) { - m_attentionIconName = att_icon_name; - is_att_icon_name_changed = true; - } - - if (overlay_icon_name != m_overlayIconName) { - m_overlayIconName = overlay_icon_name; - is_overlay_icon_name_changed = true; - } - - if (icon_theme_path != m_iconThemePath) { - m_iconThemePath = icon_theme_path; - - if (m_customIconLoader) { - delete m_customIconLoader; - m_customIconLoader = 0; - } - const QString path = m_iconThemePath; - if (!path.isEmpty()) { - QStringList tokens = path.split('/', QString::SkipEmptyParts); - if (tokens.length() >= 3) { - QString appName = tokens.takeLast(); - QString prefix = QChar('/') + tokens.join("/"); - // FIXME: Fix KIconLoader and KIconTheme so that we can use - // our own instance of KStandardDirs - KGlobal::dirs()->addResourceDir("data", prefix); - // We use a separate instance of KIconLoader to avoid - // adding all application dirs to KIconLoader::global(), to - // avoid potential icon name clashes between application - // icons - m_customIconLoader = new KIconLoader(appName, 0 /* dirs */, this); - } else { - kWarning() << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'"; - } - } - - // Trigger updates - is_icon_name_changed = true; - is_att_icon_name_changed = true; - is_overlay_icon_name_changed = true; - emit changedIcons(); - } - - // emit signals - if (is_icon_name_changed) { - emit changedIconName(); - } - if (is_att_icon_name_changed) { - emit changedAttIconName(); - } - if (is_overlay_icon_name_changed) { - emit changedOverlayIconName(); - } -} - - -//toolTip - -void DBusSystemTrayTask::syncToolTip(const QString &title, const QString &subTitle, const QIcon &toolTipIcon) -{ - if (title != m_tooltipTitle) { - m_tooltipTitle = title; - emit changedTooltipTitle(); - } - - if (subTitle != m_tooltipText) { - m_tooltipText = subTitle; - emit changedTooltipText(); - } - - bool is_icon_name_changed = (m_tooltipIcon.name() != toolTipIcon.name()); - - m_tooltipIcon = toolTipIcon; - emit changedTooltip(); - - if (is_icon_name_changed) { - emit changedTooltipIconName(); - } -} - - -//Status - -void DBusSystemTrayTask::syncStatus(QString newStatus) -{ - Task::Status status = (Task::Status)metaObject()->enumerator(metaObject()->indexOfEnumerator("Status")).keyToValue(newStatus.toLatin1()); - - if (this->status() == status) { - return; - } - - setStatus(status); -} - -} - -#include "moc_dbussystemtraytask.cpp" diff --git a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtraytask.h b/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtraytask.h deleted file mode 100644 index 37b500a7..00000000 --- a/plasma/applets/systemtray/protocols/dbussystemtray/dbussystemtraytask.h +++ /dev/null @@ -1,145 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * * - * 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 DBUSSYSTEMTRAYTASK_H -#define DBUSSYSTEMTRAYTASK_H - -#include "../../core/task.h" - -#include - -class KIconLoader; -class KJob; - -namespace Plasma -{ - -class Service; - -} - -namespace SystemTray -{ - -class DBusSystemTrayTaskPrivate; - -class DBusSystemTrayTask : public Task -{ - Q_OBJECT - - Q_PROPERTY(QIcon icon READ icon NOTIFY changedIcons) - Q_PROPERTY(QIcon attIcon READ attIcon NOTIFY changedIcons) - Q_PROPERTY(QString overlayIconName READ overlayIconName NOTIFY changedOverlayIconName) - Q_PROPERTY(QString iconName READ iconName NOTIFY changedIconName) - Q_PROPERTY(QString attIconName READ attIconName NOTIFY changedAttIconName) - Q_PROPERTY(bool isMenu READ isMenu NOTIFY changedIsMenu) - Q_PROPERTY(QString title READ title NOTIFY changedTitle) - Q_PROPERTY(QString tooltipTitle READ tooltipTitle NOTIFY changedTooltipTitle) - Q_PROPERTY(QString tooltipText READ tooltipText NOTIFY changedTooltipText) - Q_PROPERTY(QIcon tooltipIcon READ tooltipIcon NOTIFY changedTooltip) - // property tooltipIconName was introduced to make available some icons in tooltip - // while PlasmaCore.ToolTip doesn't provide property for icon (not only name of an icon) - Q_PROPERTY(QString tooltipIconName READ tooltipIconName NOTIFY changedTooltipIconName) - Q_PROPERTY(QString shortcut READ shortcut NOTIFY changedShortcut) - - friend class DBusSystemTrayProtocol; - -public: - DBusSystemTrayTask(const QString &name, Plasma::DataEngine *service, QObject *parent); - ~DBusSystemTrayTask(); - - QGraphicsWidget* createWidget(Plasma::Applet *host); - bool isValid() const; - bool isEmbeddable() const; - virtual QString taskId() const; - virtual QIcon icon() const; - virtual bool isWidget() const; - virtual TaskType type() const { return TypeStatusItem; } - - QString iconName() const { return m_iconName; } - QIcon attIcon() const { return m_attentionIcon; } - QString attIconName() const { return m_attentionIconName; } - QString overlayIconName() const { return m_overlayIconName; } - QString title() const { return name(); } - bool isMenu() const { return m_isMenu; } - QString tooltipTitle() const { return m_tooltipTitle; } - QString tooltipText() const { return m_tooltipText; } - QIcon tooltipIcon() const { return m_tooltipIcon; } - QString tooltipIconName() const { return m_tooltipIcon.name(); } - QString shortcut() const { return m_shortcut; } - void setShortcut(QString text); - - Q_INVOKABLE void activateContextMenu(int x, int y) const; - Q_INVOKABLE void activate1(int x, int y) const; - Q_INVOKABLE void activate2(int x, int y) const; - Q_INVOKABLE void activateVertScroll(int delta) const; - Q_INVOKABLE void activateHorzScroll(int delta) const; - Q_INVOKABLE QVariant customIcon(QVariant variant) const; - -signals: - void changedIcons(); // if icons, icon names are changed - void changedIconName(); // if icon name changed - void changedAttIconName(); // if attention icon name is changed - void changedOverlayIconName(); - void changedIsMenu(); - void changedTitle(); - void changedTooltip(); - void changedTooltipTitle(); - void changedTooltipText(); - void changedTooltipIconName(); - void changedShortcut(); - void showContextMenu(int x, int y, QVariant menu); - -private: - void syncToolTip(const QString &title, const QString &subTitle, const QIcon &toolTipIcon); - void syncIcons(const Plasma::DataEngine::Data &properties); - void _activateScroll(int delta, QString direction) const; - -private Q_SLOTS: - void syncStatus(QString status); - void dataUpdated(const QString &taskName, const Plasma::DataEngine::Data &taskData); - void _onContextMenu(KJob*); - -private: - QString m_serviceName; - QString m_taskId; - QIcon m_icon; - QString m_iconName; - QIcon m_attentionIcon; - QString m_attentionIconName; - QString m_shortcut; - QString m_overlayIconName; - QString m_iconThemePath; - QString m_tooltipTitle; - QString m_tooltipText; - QIcon m_tooltipIcon; - - KIconLoader *m_customIconLoader; - - Plasma::DataEngine *m_dataEngine; - Plasma::Service *m_service; - bool m_isMenu; - bool m_valid; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/fdographicswidget.cpp b/plasma/applets/systemtray/protocols/fdo/fdographicswidget.cpp deleted file mode 100644 index 9d4b476a..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdographicswidget.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/*************************************************************************** - * fdographicswidget.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "fdographicswidget.h" -#include "x11embeddelegate.h" -#include "x11embedcontainer.h" - -#include -#include - -#include -#include - -#include - - -namespace SystemTray -{ - -class FdoGraphicsWidget::Private -{ -public: - Private() - : clientEmbedded(false) - { - } - - ~Private() - { - delete widget.data(); - } - - WId winId; - bool clientEmbedded; - QWeakPointer widget; -}; - -FdoGraphicsWidget::FdoGraphicsWidget(WId winId, QGraphicsWidget *parent) - : QGraphicsWidget(parent), - d(new Private()) -{ - d->winId = winId; - - setMinimumSize(22, 22); - setMaximumSize(48, 48); - resize(22, 22); - - setCacheMode(QGraphicsItem::NoCache); - - QGraphicsView *parentView = 0; - - foreach (QGraphicsView *view, scene()->views()) { - if (view->isVisible() && view->sceneRect().intersects(sceneBoundingRect())) { - parentView = view; - break; - } - } - - if (parentView) { - parentView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); - } - - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SLOT(updateWidgetBackground())); - QTimer::singleShot(0, this, SLOT(setupXEmbedDelegate())); -} - - -FdoGraphicsWidget::~FdoGraphicsWidget() -{ - delete d; -} - - -void FdoGraphicsWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *parentWidget) -{ - QGraphicsWidget::paint(painter, option, parentWidget); - - QGraphicsView *parentView = 0; - foreach (QGraphicsView *view, scene()->views()) { - if (view->isVisible() && view->sceneRect().intersects(sceneBoundingRect())) { - parentView = view; - } - } - - if (!parentView) { - return; - } - - if (!d->widget) { - QTimer::singleShot(0, this, SLOT(setupXEmbedDelegate())); - return; - } else if (!d->clientEmbedded) { - return; - } - - QWidget *widget = d->widget.data(); - if (widget->parentWidget() != parentView) { - //kDebug() << "embedding into" << parentView->metaObject()->className() << "(" << d->winId << ")"; - widget->setParent(parentView); - } - - QPoint pos = parentView->mapFromScene(scenePos()); - pos += parentView->viewport()->pos(); - if (widget->pos() != pos) { - widget->move(pos); - } - - if (!widget->isVisible()) { - widget->show(); - } -} - -void FdoGraphicsWidget::hideEvent(QHideEvent *event) -{ - Q_UNUSED(event); - if (d->widget) { - d->widget.data()->hide(); - } -} - -void FdoGraphicsWidget::showEvent(QShowEvent *event) -{ - Q_UNUSED(event); - if (d->widget) { - d->widget.data()->show(); - } -} - -void FdoGraphicsWidget::setupXEmbedDelegate() -{ - if (d->widget) { - return; - } - - static const Qt::ApplicationAttribute attr = Qt::AA_DontCreateNativeWidgetSiblings; - if (!QApplication::testAttribute(attr)) { - QApplication::setAttribute(attr); - } - - X11EmbedDelegate *widget = new X11EmbedDelegate(); - widget->setMinimumSize(22, 22); - widget->setMaximumSize(48, 48); - widget->resize(size().toSize()); - widget->move(QPoint(size().width()/2, size().height()/2) - QPoint(11, 11)); - - connect(widget->container(), SIGNAL(clientIsEmbedded()), - this, SLOT(handleClientEmbedded())); - connect(widget->container(), SIGNAL(clientClosed()), - this, SLOT(handleClientClosed())); - connect(widget->container(), SIGNAL(error(QX11EmbedContainer::Error)), - this, SLOT(handleClientError(QX11EmbedContainer::Error))); - - widget->container()->embedSystemTrayClient(d->winId); - d->widget = widget; -} - -void FdoGraphicsWidget::updateWidgetBackground() -{ - X11EmbedDelegate *widget = d->widget.data(); - if (!widget) { - return; - } - - QPalette palette = widget->palette(); - palette.setBrush(QPalette::Window, Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - widget->setPalette(palette); - widget->setBackgroundRole(QPalette::Window); -} - - -void FdoGraphicsWidget::handleClientEmbedded() -{ - //kDebug() << "client embedded (" << d->winId << ")"; - d->clientEmbedded = true; - update(); -} - - -void FdoGraphicsWidget::handleClientClosed() -{ - emit clientClosed(); - //kDebug() << "client closed (" << d->winId << ")"; -} - - -void FdoGraphicsWidget::handleClientError(QX11EmbedContainer::Error error) -{ - Q_UNUSED(error); - - //kDebug() << "client error (" << d->winId << ")"; - emit clientClosed(); -} - -void FdoGraphicsWidget::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - Q_UNUSED(event); - - if (d->widget) { - d->widget.data()->resize(size().toSize()); - } -} - -} - -#include "moc_fdographicswidget.cpp" diff --git a/plasma/applets/systemtray/protocols/fdo/fdographicswidget.h b/plasma/applets/systemtray/protocols/fdo/fdographicswidget.h deleted file mode 100644 index ed646185..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdographicswidget.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * fdographicswidget.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 FDOGRAPHICSWIDGET_H -#define FDOGRAPHICSWIDGET_H - -#include -#include - - -namespace SystemTray -{ - -class FdoGraphicsWidget : public QGraphicsWidget -{ - Q_OBJECT - -public: - FdoGraphicsWidget(WId winId, QGraphicsWidget *parent = 0); - ~FdoGraphicsWidget(); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - -signals: - void clientClosed(); - -protected: - void showEvent(QShowEvent *event); - void hideEvent(QHideEvent *event); - void resizeEvent(QGraphicsSceneResizeEvent *event); - -private slots: - void setupXEmbedDelegate(); - void handleClientEmbedded(); - void handleClientClosed(); - void handleClientError(QX11EmbedContainer::Error); - void updateWidgetBackground(); - -private: - class Private; - Private* const d; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/fdoprotocol.cpp b/plasma/applets/systemtray/protocols/fdo/fdoprotocol.cpp deleted file mode 100644 index d7e0cb96..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdoprotocol.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * fdoprotocol.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "fdoprotocol.h" - -#include "fdoselectionmanager.h" - - -namespace SystemTray -{ - -FdoProtocol::FdoProtocol(QObject *parent) - : Protocol(parent), - m_selectionManager(0) -{ -} - -FdoProtocol::~FdoProtocol() -{ - delete m_selectionManager; -} - -void FdoProtocol::init() -{ - m_selectionManager = new FdoSelectionManager; - connect(m_selectionManager, SIGNAL(taskCreated(SystemTray::Task*)), - this, SIGNAL(taskCreated(SystemTray::Task*))); -} - -} - -#include "moc_fdoprotocol.cpp" - diff --git a/plasma/applets/systemtray/protocols/fdo/fdoprotocol.h b/plasma/applets/systemtray/protocols/fdo/fdoprotocol.h deleted file mode 100644 index b006967d..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdoprotocol.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * fdoprotocol.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 FDOTASKPROTOCOL_H -#define FDOTASKPROTOCOL_H - -#include "../../core/protocol.h" - - -namespace SystemTray -{ - -class FdoSelectionManager; - -class FdoProtocol : public Protocol -{ - Q_OBJECT - -public: - FdoProtocol(QObject *parent); - ~FdoProtocol(); - void init(); - -private: - FdoSelectionManager *m_selectionManager; -}; - -} - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.cpp b/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.cpp deleted file mode 100644 index 8d68199f..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/*************************************************************************** - * fdoselectionmanager.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "fdoselectionmanager.h" -#include "fdotask.h" -#include "x11embedpainter.h" - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#ifdef HAVE_XFIXES -# include -#endif - -#ifdef HAVE_XDAMAGE -# include -#endif - -#ifdef HAVE_XCOMPOSITE -# include -#endif - -#define SYSTEM_TRAY_REQUEST_DOCK 0 -#define SYSTEM_TRAY_BEGIN_MESSAGE 1 -#define SYSTEM_TRAY_CANCEL_MESSAGE 2 - - -namespace SystemTray -{ - -static FdoSelectionManager *s_manager = 0; -static X11EmbedPainter *s_painter = 0; - -#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE) -struct DamageWatch -{ - QWidget *container; - Damage damage; -}; - -static int damageEventBase = 0; -static QMap damageWatches; -static QCoreApplication::EventFilter oldEventFilter; - -// Global event filter for intercepting damage events -static bool x11EventFilter(void *message, long int *result) -{ - XEvent *event = reinterpret_cast(message); - if (event->type == damageEventBase + XDamageNotify) { - XDamageNotifyEvent *e = reinterpret_cast(event); - if (DamageWatch *damageWatch = damageWatches.value(e->drawable)) { - // Create a new region and empty the damage region into it. - // The window is small enough that we don't really care about the region; - // we'll just throw it away and schedule a full repaint of the container. - XserverRegion region = XFixesCreateRegion(e->display, 0, 0); - XDamageSubtract(e->display, e->damage, None, region); - XFixesDestroyRegion(e->display, region); - damageWatch->container->update(); - } - } - - if (oldEventFilter && oldEventFilter != x11EventFilter) { - return oldEventFilter(message, result); - } else { - return false; - } -} -#endif - - -struct MessageRequest -{ - long messageId; - long timeout; - long bytesRemaining; - QByteArray message; -}; - - -class FdoSelectionManagerPrivate -{ -public: - FdoSelectionManagerPrivate(FdoSelectionManager *q) - : q(q), - notificationsEngine(0), - haveComposite(false) - { - display = QX11Info::display(); - QByteArray selectiondata = "_NET_SYSTEM_TRAY_S" + QByteArray::number(QX11Info::appScreen()); - selectionAtom = XInternAtom(display, selectiondata.data(), false); - opcodeAtom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", false); - messageAtom = XInternAtom(display, "_NET_SYSTEM_TRAY_MESSAGE_DATA", false); - visualAtom = XInternAtom(display, "_NET_SYSTEM_TRAY_VISUAL", false); - -#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE) - int eventBase, errorBase; - bool haveXfixes = XFixesQueryExtension(display, &eventBase, &errorBase); - bool haveXdamage = XDamageQueryExtension(display, &damageEventBase, &errorBase); - bool haveXComposite = XCompositeQueryExtension(display, &eventBase, &errorBase); - - if (haveXfixes && haveXdamage && haveXComposite) { - haveComposite = true; - oldEventFilter = QCoreApplication::instance()->setEventFilter(x11EventFilter); - } -#endif - } - - void createNotification(WId winId); - - void handleRequestDock(const XClientMessageEvent &event); - void handleBeginMessage(const XClientMessageEvent &event); - void handleMessageData(const XClientMessageEvent &event); - void handleCancelMessage(const XClientMessageEvent &event); - - Display *display; - Atom selectionAtom; - Atom opcodeAtom; - Atom messageAtom; - Atom visualAtom; - - QHash messageRequests; - QHash tasks; - - FdoSelectionManager *q; - Plasma::DataEngine *notificationsEngine; - - bool haveComposite; -}; - -FdoSelectionManager::FdoSelectionManager() - : d(new FdoSelectionManagerPrivate(this)) -{ - // Init the selection later just to ensure that no signals are sent - // until after construction is done and the creating object has a - // chance to connect. - QTimer::singleShot(0, this, SLOT(initSelection())); -} - - -FdoSelectionManager::~FdoSelectionManager() -{ -#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE) - if (d->haveComposite && QCoreApplication::instance()) { - QCoreApplication::instance()->setEventFilter(oldEventFilter); - } -#endif - - if (s_manager == this) { - s_manager = 0; - delete s_painter; - s_painter = 0; - } - - delete d; -} - -FdoSelectionManager *FdoSelectionManager::manager() -{ - return s_manager; -} - -X11EmbedPainter *FdoSelectionManager::painter() -{ - return s_painter; -} - -void FdoSelectionManager::addDamageWatch(QWidget *container, WId client) -{ -#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE) - DamageWatch *damage = new DamageWatch; - damage->container = container; - damage->damage = XDamageCreate(QX11Info::display(), client, XDamageReportNonEmpty); - damageWatches.insert(client, damage); -#endif -} - -void FdoSelectionManager::removeDamageWatch(QWidget *container) -{ -#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE) - for (QMap::Iterator it = damageWatches.begin(); it != damageWatches.end(); ++it) - { - DamageWatch *damage = *(it); - if (damage->container == container) { - XDamageDestroy(QX11Info::display(), damage->damage); - damageWatches.erase(it); - delete damage; - break; - } - } -#endif -} - - -bool FdoSelectionManager::haveComposite() const -{ - return d->haveComposite; -} - - -bool FdoSelectionManager::x11Event(XEvent *event) -{ - if (event->type == ClientMessage) { - if (event->xclient.message_type == d->opcodeAtom) { - switch (event->xclient.data.l[1]) { - case SYSTEM_TRAY_REQUEST_DOCK: - d->handleRequestDock(event->xclient); - return true; - case SYSTEM_TRAY_BEGIN_MESSAGE: - d->handleBeginMessage(event->xclient); - return true; - case SYSTEM_TRAY_CANCEL_MESSAGE: - d->handleCancelMessage(event->xclient); - return true; - } - } else if (event->xclient.message_type == d->messageAtom) { - d->handleMessageData(event->xclient); - return true; - } - } - - return QWidget::x11Event(event); -} - - -void FdoSelectionManager::initSelection() -{ - XSetSelectionOwner(d->display, d->selectionAtom, winId(), CurrentTime); - - WId selectionOwner = XGetSelectionOwner(d->display, d->selectionAtom); - if (selectionOwner != winId()) { - // FIXME: Hmmm... Reading the docs on XSetSelectionOwner, - // this should not be possible. - kDebug() << "Tried to set selection owner to" << winId() << "but it is set to" << selectionOwner; - return; - } - - // Prefer the ARGB32 visual if available - int nvi; - VisualID visual = XVisualIDFromVisual((Visual*)QX11Info::appVisual()); - XVisualInfo templ; - templ.visualid = visual; - XVisualInfo *xvi = XGetVisualInfo(d->display, VisualIDMask, &templ, &nvi); - if (xvi && xvi[0].depth > 16) { - templ.screen = xvi[0].screen; - templ.depth = 32; - templ.c_class = TrueColor; - XFree(xvi); - xvi = XGetVisualInfo(d->display, VisualScreenMask | VisualDepthMask | VisualClassMask, - &templ, &nvi); - for (int i = 0; i < nvi; i++) { - XRenderPictFormat *format = XRenderFindVisualFormat(d->display, xvi[i].visual); - if (format && format->type == PictTypeDirect && format->direct.alphaMask) { - visual = xvi[i].visualid; - break; - } - } - XFree(xvi); - } - XChangeProperty(d->display, winId(), d->visualAtom, XA_VISUALID, 32, - PropModeReplace, (const unsigned char*)&visual, 1); - - if (!s_painter) { - s_painter = new X11EmbedPainter; - } - s_manager = this; - - WId root = QX11Info::appRootWindow(); - XClientMessageEvent xev; - - xev.type = ClientMessage; - xev.window = root; - xev.message_type = XInternAtom(d->display, "MANAGER", false); - xev.format = 32; - xev.data.l[0] = CurrentTime; - xev.data.l[1] = d->selectionAtom; - xev.data.l[2] = winId(); - xev.data.l[3] = 0; - xev.data.l[4] = 0; - - XSendEvent(d->display, root, false, StructureNotifyMask, (XEvent*)&xev); -} - - -void FdoSelectionManagerPrivate::handleRequestDock(const XClientMessageEvent &event) -{ - const WId winId = (WId)event.data.l[2]; - - if (tasks.contains(winId)) { - kDebug() << "got a dock request from an already existing task"; - return; - } - - FdoTask *task = new FdoTask(winId, q); - - tasks[winId] = task; - q->connect(task, SIGNAL(taskDeleted(WId)), q, SLOT(cleanupTask(WId))); - - emit q->taskCreated(task); -} - - -void FdoSelectionManager::cleanupTask(WId winId) -{ - d->tasks.remove(winId); -} - - -void FdoSelectionManagerPrivate::handleBeginMessage(const XClientMessageEvent &event) -{ - const WId winId = event.window; - - MessageRequest request; - request.messageId = event.data.l[4]; - request.timeout = event.data.l[2]; - request.bytesRemaining = event.data.l[3]; - - if (request.bytesRemaining) { - messageRequests[winId] = request; - } -} - - -void FdoSelectionManagerPrivate::handleMessageData(const XClientMessageEvent &event) -{ - const WId winId = event.window; - const char *messageData = event.data.b; - - if (!messageRequests.contains(winId)) { - kDebug() << "Unexpected message data from" << winId; - return; - } - - MessageRequest &request = messageRequests[winId]; - const int messageSize = qMin(request.bytesRemaining, 20l); - request.bytesRemaining -= messageSize; - request.message += QByteArray(messageData, messageSize); - - if (request.bytesRemaining == 0) { - createNotification(winId); - messageRequests.remove(winId); - } -} - - -void FdoSelectionManagerPrivate::createNotification(WId winId) -{ - if (!tasks.contains(winId)) { - kDebug() << "message request from unknown task" << winId; - return; - } - - MessageRequest &request = messageRequests[winId]; - Task *task = tasks[winId]; - - QString message = QString::fromUtf8(request.message); - message = QTextDocument(message).toHtml(); - - if (!notificationsEngine) { - notificationsEngine = Plasma::DataEngineManager::self()->loadEngine("notifications"); - } - Plasma::Service *service = notificationsEngine->serviceForSource("notification"); - - if (!service) { - kDebug() << "invalid service for notification"; - } else if (service->isOperationEnabled("createNotification")) { - QMap params = service->operationParameters("createNotification"); - params["appName"] = task->name(); - //FIXME: find a way to pass icons trough here - params["appIcon"] = task->name(); - - //params["summary"] = task->name(); - params["body"] = message; - params["timeout"] = (int)request.timeout; - KJob *job = service->startOperationCall("createNotification", params); - QObject::connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater())); - } else { - delete service; - kDebug() << "invalid operation or disabled"; - } -} - - -void FdoSelectionManagerPrivate::handleCancelMessage(const XClientMessageEvent &event) -{ - const WId winId = event.window; - const long messageId = event.data.l[2]; - - if (messageRequests.contains(winId) && messageRequests[winId].messageId == messageId) { - messageRequests.remove(winId); - } -} - - -} diff --git a/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.h b/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.h deleted file mode 100644 index ea91d595..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdoselectionmanager.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * fdoselectionmanager.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 FDOSELECTIONMANAGER_H -#define FDOSELECTIONMANAGER_H - -#include - -namespace SystemTray -{ - -class Task; -class X11EmbedPainter; -class FdoSelectionManagerPrivate; - -class FdoSelectionManager : public QWidget -{ - Q_OBJECT - -public: - static FdoSelectionManager *manager(); - static X11EmbedPainter *painter(); - - FdoSelectionManager(); - ~FdoSelectionManager(); - - void addDamageWatch(QWidget *container, WId client); - void removeDamageWatch(QWidget *container); - bool haveComposite() const; - -signals: - void taskCreated(SystemTray::Task *task); - -protected: - bool x11Event(XEvent *event); - -private slots: - void initSelection(); - void cleanupTask(WId winId); - -private: - friend class FdoSelectionManagerPrivate; - FdoSelectionManagerPrivate* const d; -}; - -} - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/fdotask.cpp b/plasma/applets/systemtray/protocols/fdo/fdotask.cpp deleted file mode 100644 index fc1dc801..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdotask.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * fdotask.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "fdographicswidget.h" -#include "fdotask.h" - -#include -#include - -namespace SystemTray -{ - -class FdoTask::Private -{ -public: - Private(WId winId) - : winId(winId), - widget(0) - { - KWindowInfo info = KWindowSystem::windowInfo(winId, NET::WMName, NET::WM2WindowClass); - - // FIXME: This isn't unique - taskId = info.windowClassName(); - - name = info.name(); - if (name.isEmpty()) { - name = taskId; - } - - icon = KWindowSystem::icon(winId); - } - - WId winId; - QString name; - QString taskId; - QIcon icon; - FdoGraphicsWidget *widget; -}; - - -FdoTask::FdoTask(WId winId, QObject *parent) - : Task(parent), - d(new Private(winId)) -{ - setCategory(ApplicationStatus); - setName(d->name); -} - -FdoTask::~FdoTask() -{ - emit taskDeleted(d->winId); - delete d; -} - -bool FdoTask::isEmbeddable() const -{ - return !isUsed(); -} - -bool FdoTask::isWidget() const { - return true; -} - -QString FdoTask::taskId() const -{ - return d->taskId; -} - -QIcon FdoTask::icon() const -{ - return d->icon; -} - -void FdoTask::abandon(Plasma::Applet *host) -{ - forget(host); - if (d->widget) { - d->widget->hide(); - } -} - -QGraphicsWidget* FdoTask::createWidget(Plasma::Applet *applet) -{ - if (!d->widget) { - d->widget = new FdoGraphicsWidget(d->winId, applet); - connect(d->widget, SIGNAL(clientClosed()), this, SLOT(deleteLater())); - } - - return d->widget; -} - -} - -#include "moc_fdotask.cpp" diff --git a/plasma/applets/systemtray/protocols/fdo/fdotask.h b/plasma/applets/systemtray/protocols/fdo/fdotask.h deleted file mode 100644 index 0a0a0ab9..00000000 --- a/plasma/applets/systemtray/protocols/fdo/fdotask.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * fdotask.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 FDOTASK_H -#define FDOTASK_H - -#include "../../core/task.h" - - -namespace SystemTray -{ - -class FdoTask : public Task -{ - Q_OBJECT - -public: - FdoTask(WId winId, QObject *parent); - ~FdoTask(); - - bool isEmbeddable() const; - QString taskId() const; - QIcon icon() const; - void abandon(Plasma::Applet *host); - virtual bool isWidget() const; - virtual TaskType type() const { return TypeX11Task; } - -signals: - void taskDeleted(WId winId); - -protected: - virtual QGraphicsWidget* createWidget(Plasma::Applet *applet); - -private: - class Private; - Private* const d; -}; - -} - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.cpp b/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.cpp deleted file mode 100644 index 690006fd..00000000 --- a/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/*************************************************************************** - * x11embedcontainer.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "x11embedcontainer.h" -#include "x11embedpainter.h" -#include "fdoselectionmanager.h" - -// KDE -#include -#include - -// Qt -#include -#include -#include - -// Xlib -#include - -#include -#include - -#ifdef HAVE_XCOMPOSITE -# include -#endif - - -namespace SystemTray -{ - -class X11EmbedContainer::Private -{ -public: - Private(X11EmbedContainer *q) - : q(q), - picture(None), - updatesEnabled(true) - { - } - - ~Private() - { - if (picture) { - XRenderFreePicture(QX11Info::display(), picture); - } - if (!kpixmap.isNull()) { - kpixmap.release(); - } - } - - X11EmbedContainer *q; - - XWindowAttributes attr; - Picture picture; - KPixmap kpixmap; - bool updatesEnabled; - QImage oldBackgroundImage; -}; - - -X11EmbedContainer::X11EmbedContainer(QWidget *parent) - : QX11EmbedContainer(parent), - d(new Private(this)) -{ - connect(this, SIGNAL(clientIsEmbedded()), - this, SLOT(ensureValidSize())); -} - - -X11EmbedContainer::~X11EmbedContainer() -{ - FdoSelectionManager::manager()->removeDamageWatch(this); - delete d; -} - - -void X11EmbedContainer::embedSystemTrayClient(WId clientId) -{ - Display *display = QX11Info::display(); - - if (!XGetWindowAttributes(display, clientId, &d->attr)) { - emit error(QX11EmbedContainer::Unknown); - return; - } - - XSetWindowAttributes sAttr; - sAttr.background_pixel = BlackPixel(display, DefaultScreen(display)); - sAttr.border_pixel = BlackPixel(display, DefaultScreen(display)); - sAttr.colormap = d->attr.colormap; - - WId parentId = parentWidget() ? parentWidget()->winId() : DefaultRootWindow(display); - Window winId = XCreateWindow(display, parentId, 0, 0, d->attr.width, d->attr.height, - 0, d->attr.depth, InputOutput, d->attr.visual, - CWBackPixel | CWBorderPixel | CWColormap, &sAttr); - - XWindowAttributes attr; - if (!XGetWindowAttributes(display, winId, &attr)) { - emit error(QX11EmbedContainer::Unknown); - return; - } - - create(winId); - -#if defined(HAVE_XCOMPOSITE) && defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) - XRenderPictFormat *format = XRenderFindVisualFormat(display, d->attr.visual); - if (format && format->type == PictTypeDirect && format->direct.alphaMask && - FdoSelectionManager::manager()->haveComposite()) - { - // Redirect ARGB windows to offscreen storage so we can composite them ourselves - XRenderPictureAttributes attr; - attr.subwindow_mode = IncludeInferiors; - - d->picture = XRenderCreatePicture(display, clientId, format, CPSubwindowMode, &attr); - XCompositeRedirectSubwindows(display, winId, CompositeRedirectManual); - FdoSelectionManager::manager()->addDamageWatch(this, clientId); - - //kDebug() << "Embedded client uses an ARGB visual -> compositing."; - } else { - //kDebug() << "Embedded client is not using an ARGB visual."; - } -#endif - - // repeat everything from QX11EmbedContainer's ctor that might be relevant - setFocusPolicy(Qt::StrongFocus); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setAcceptDrops(true); - setEnabled(false); - - XSelectInput(display, winId, - KeyPressMask | KeyReleaseMask | - ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | - KeymapStateMask | - PointerMotionMask | - EnterWindowMask | LeaveWindowMask | - FocusChangeMask | - ExposureMask | - StructureNotifyMask | - SubstructureNotifyMask); - - XFlush(display); - - embedClient(clientId); - - // FIXME: This checks that the client is still valid. Qt won't pick it up - // if the client closes before embedding completes. However, what happens - // if the close happens after this point? Should checks happen on a timer - // until embedding completes perhaps? - if (!XGetWindowAttributes(QX11Info::display(), clientId, &d->attr)) { - emit error(QX11EmbedContainer::Unknown); - return; - } -} - - -void X11EmbedContainer::ensureValidSize() -{ - QSize s = QSize(qBound(minimumSize().width(), width(), maximumSize().width()), - qBound(minimumSize().height(), height(), maximumSize().height())); - resize(s); -} - - -void X11EmbedContainer::setUpdatesEnabled(bool enabled) -{ - d->updatesEnabled = enabled; -} - - -void X11EmbedContainer::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - - if (!d->updatesEnabled) { - return; - } - - if (!d->picture) { - FdoSelectionManager::painter()->updateContainer(this); - return; - } - - // Taking a detour via a KPixmap is unfortunately the only way we can get - // the window contents into Katie's backing store. - KPixmap kpixmap(size()); - Picture kpixmapicture = XRenderCreatePicture( - x11Info().display(), - kpixmap.handle(), - XRenderFindVisualFormat(x11Info().display(), (Visual *)x11Info().visual()), - 0, 0 - ); - if (!kpixmapicture) { - // if this happens it may result in incorrect rendering but it should not happen - kWarning() << "XRenderCreatePicture() failed"; - kpixmap.release(); - FdoSelectionManager::painter()->updateContainer(this); - return; - } - - XRenderComposite( - x11Info().display(), PictOpSrc, - d->picture, None, kpixmapicture, - 0, 0, 0, 0, 0, 0, width(), height() - ); - - QPainter p(this); - p.drawImage(0, 0, kpixmap.toImage()); - - XRenderFreePicture(x11Info().display(), kpixmapicture); - kpixmap.release(); -} - -void X11EmbedContainer::setBackgroundPixmap(const QPixmap &background) -{ - if (!clientWinId()) { - return; - } - - // Prevent updating the background-image if possible. Updating can cause a very annoying - // flicker due to the XClearArea, and thus has to be kept to a minimum - const QImage image = background.toImage(); - if (d->oldBackgroundImage == image) { - return; - } - d->oldBackgroundImage = image; - - Display* display = QX11Info::display(); - if (!d->kpixmap.isNull()) { - d->kpixmap.release(); - } - d->kpixmap = KPixmap(background); - XSetWindowBackgroundPixmap(display, clientWinId(), d->kpixmap.handle()); - XClearArea(display, clientWinId(), 0, 0, 0, 0, True); -} - -} - -#include "moc_x11embedcontainer.cpp" diff --git a/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.h b/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.h deleted file mode 100644 index 7e8a2190..00000000 --- a/plasma/applets/systemtray/protocols/fdo/x11embedcontainer.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * x11embedcontainer.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 X11EMBEDCONTAINER_H -#define X11EMBEDCONTAINER_H - -#include - - -namespace SystemTray -{ - -class X11EmbedContainer : public QX11EmbedContainer -{ - Q_OBJECT - -public: - X11EmbedContainer(QWidget *parent = 0); - ~X11EmbedContainer(); - - void embedSystemTrayClient(WId id); - void setUpdatesEnabled(bool enabled); - void setBackgroundPixmap(const QPixmap &background); - -protected: - void paintEvent(QPaintEvent *event); - -private slots: - void ensureValidSize(); - -private: - class Private; - Private* const d; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/x11embeddelegate.cpp b/plasma/applets/systemtray/protocols/fdo/x11embeddelegate.cpp deleted file mode 100644 index 288e9894..00000000 --- a/plasma/applets/systemtray/protocols/fdo/x11embeddelegate.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * x11embeddelegate.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "x11embedcontainer.h" -#include "x11embeddelegate.h" - -#include - -namespace SystemTray -{ - -class X11EmbedDelegate::Private -{ -public: - X11EmbedContainer *container; -}; - - -X11EmbedDelegate::X11EmbedDelegate(QWidget *parent) - : QWidget(parent), - d(new Private()) -{ - d->container = new X11EmbedContainer(this); - d->container->move(0, 0); - d->container->show(); -} - - -X11EmbedDelegate::~X11EmbedDelegate() -{ - delete d; -} - - -void X11EmbedDelegate::setParent(QWidget *newParent) -{ - if (parent()) { - parent()->removeEventFilter(this); - } - QWidget::setParent(newParent); - if (newParent) { - newParent->installEventFilter(this); - } -} - - -void X11EmbedDelegate::resizeEvent(QResizeEvent *event) -{ - Q_UNUSED(event); - d->container->resize(size()); -} - - -X11EmbedContainer* X11EmbedDelegate::container() -{ - return d->container; -} - - -bool X11EmbedDelegate::eventFilter(QObject *watched, QEvent *event) -{ - bool ret = QWidget::eventFilter(watched, event); - - if (event->type() == QEvent::Hide) { - setParent(0); - } - - return ret; -} - -} - -#include "moc_x11embeddelegate.cpp" diff --git a/plasma/applets/systemtray/protocols/fdo/x11embeddelegate.h b/plasma/applets/systemtray/protocols/fdo/x11embeddelegate.h deleted file mode 100644 index a4979899..00000000 --- a/plasma/applets/systemtray/protocols/fdo/x11embeddelegate.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * x11embeddelegate.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 X11EMBEDDELEGATE_H -#define X11EMBEDDELEGATE_H - -#include - -namespace SystemTray -{ - -class X11EmbedContainer; - -class X11EmbedDelegate : public QWidget -{ - Q_OBJECT - -public: - X11EmbedDelegate(QWidget *parent = 0); - ~X11EmbedDelegate(); - - void setParent(QWidget *parent); - X11EmbedContainer* container(); - - bool eventFilter(QObject *watched, QEvent *event); - -protected: - void resizeEvent(QResizeEvent *event); - -private: - class Private; - Private* const d; -}; - -} - -#endif diff --git a/plasma/applets/systemtray/protocols/fdo/x11embedpainter.cpp b/plasma/applets/systemtray/protocols/fdo/x11embedpainter.cpp deleted file mode 100644 index a6eaf613..00000000 --- a/plasma/applets/systemtray/protocols/fdo/x11embedpainter.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - * x11embedpainter.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 "x11embedpainter.h" - -#include -#include -#include - -#include - - -#define MAX_PAINTS_PER_SEC 20 -#define MIN_TIME_BETWEEN_PAINTS (1000 / MAX_PAINTS_PER_SEC) - - -namespace SystemTray -{ - -class X11EmbedPainter::Private -{ -public: - Private(X11EmbedPainter *parent) - : q(parent), - fastPaints(0) - { - delayedPaintTimer.setSingleShot(true); - connect(&delayedPaintTimer, SIGNAL(timeout()), q, SLOT(performUpdates())); - } - - X11EmbedPainter *q; - QSet containers; - QElapsedTimer lastPaintTime; - QTimer delayedPaintTimer; - int fastPaints; -}; - - -X11EmbedPainter::X11EmbedPainter() - : d(new Private(this)) -{ -} - - -X11EmbedPainter::~X11EmbedPainter() -{ - delete d; -} - - -void X11EmbedPainter::updateContainer(X11EmbedContainer *container) -{ - if (d->containers.contains(container)) { - return; - } - - d->containers.insert(container); - - connect(container, SIGNAL(destroyed(QObject*)), - this, SLOT(removeContainer(QObject*))); - - if (!d->delayedPaintTimer.isActive()) { - const qint64 msecsElapsed = d->lastPaintTime.elapsed(); - if (msecsElapsed > MIN_TIME_BETWEEN_PAINTS) { - ++d->fastPaints; - if (d->fastPaints > 2) { - //kDebug() << "Delaying paint by" << msecsToNextPaint << "msecs"; - d->delayedPaintTimer.start(msecsElapsed - MIN_TIME_BETWEEN_PAINTS); - } else { - d->delayedPaintTimer.start(0); - } - } else { - d->fastPaints = 0; - d->delayedPaintTimer.start(0); - } - } -} - - -void X11EmbedPainter::removeContainer(QObject *container) -{ - d->containers.remove(static_cast(container)); -} - - -void X11EmbedPainter::performUpdates() -{ - QMultiHash containersByParent; - - foreach (X11EmbedContainer *container, d->containers) { - QWidget *topWidget = container; - while (topWidget->parentWidget()) { - topWidget = topWidget->parentWidget(); - } - containersByParent.insert(topWidget, container); - container->setUpdatesEnabled(false); - } - - foreach (QWidget *parent, containersByParent.uniqueKeys()) { - QList containers = containersByParent.values(parent); - containersByParent.remove(parent); - - QRegion paintRegion; - QHash containerRects; - foreach (X11EmbedContainer *container, containers) { - QRect rect = QRect(container->mapTo(parent, QPoint(0, 0)), container->size()); - containerRects.insert(container, rect); - paintRegion = paintRegion.united(rect); - } - - QPixmap background = QPixmap(parent->size()); - parent->render(&background, paintRegion.boundingRect().topLeft(), paintRegion); - - foreach (X11EmbedContainer *container, containers) { - container->setBackgroundPixmap(background.copy(containerRects.value(container))); - } - } - - foreach (X11EmbedContainer *container, d->containers) { - container->setUpdatesEnabled(true); - disconnect(container, SIGNAL(destroyed(QObject*)), - this, SLOT(removeContainer(QObject*))); - } - - d->containers.clear(); - d->lastPaintTime.start(); -} - -} - -#include "moc_x11embedpainter.cpp" diff --git a/plasma/applets/systemtray/protocols/fdo/x11embedpainter.h b/plasma/applets/systemtray/protocols/fdo/x11embedpainter.h deleted file mode 100644 index d5cea64d..00000000 --- a/plasma/applets/systemtray/protocols/fdo/x11embedpainter.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * x11embedpainter.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * * - * 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 X11EMBEDPAINTER_H -#define X11EMBEDPAINTER_H - -#include "x11embedcontainer.h" - -#include - - -namespace SystemTray -{ - -class X11EmbedPainter : public QObject -{ - Q_OBJECT - -public: - X11EmbedPainter(); - ~X11EmbedPainter(); - - void updateContainer(X11EmbedContainer *container); - -private slots: - void performUpdates(); - void removeContainer(QObject *container); - -private: - class Private; - Private* const d; -}; - -} - -#endif diff --git a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtask.cpp b/plasma/applets/systemtray/protocols/plasmoid/plasmoidtask.cpp deleted file mode 100644 index 2d1d357c..00000000 --- a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtask.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** - * plasmoidtask.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2008 Sebastian Kügler * - * Copyright (C) 2009 Marco Martin * - * * - * 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 "plasmoidtask.h" -#include - -#include -#include -#include - -#include -#include -#include - - -namespace SystemTray -{ - -PlasmoidTask::PlasmoidTask(const QString &appletname, int id, QObject *parent, Plasma::Applet *host) - : Task(parent), - m_appletName(appletname), - m_taskId(appletname), - m_host(host), - m_takenByParent(false) -{ - setName(appletname); - setupApplet(appletname, id); -} - - -PlasmoidTask::~PlasmoidTask() -{ - emit taskDeleted(m_host, m_taskId); -} - - -bool PlasmoidTask::isEmbeddable() const -{ - return m_applet && !m_takenByParent; -} - -bool PlasmoidTask::isValid() const -{ - return !m_appletName.isEmpty() && m_applet; -} - - -QString PlasmoidTask::taskId() const -{ - return m_taskId; -} - - -QIcon PlasmoidTask::icon() const -{ - return m_icon; -} - -Plasma::Applet *PlasmoidTask::host() const -{ - return m_host; -} - -bool PlasmoidTask::isWidget() const { - return true; -} - -QGraphicsWidget* PlasmoidTask::createWidget(Plasma::Applet *host) -{ - if (host != m_host || !m_applet) { - return 0; - } - - Plasma::Applet *applet = m_applet.data(); - m_takenByParent = true; - applet->setParent(host); - applet->setParentItem(host); - KConfigGroup group = applet->config(); - group = group.parent(); - applet->restore(group); - applet->init(); - applet->updateConstraints(Plasma::StartupCompletedConstraint); - applet->flushPendingConstraintsEvents(); - applet->updateConstraints(Plasma::AllConstraints); - applet->flushPendingConstraintsEvents(); - - // make sure to record it in the configuration so that if we reload from the config, - // this applet is remembered - KConfigGroup dummy; - applet->save(dummy); - - connect(applet, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(newAppletStatus(Plasma::ItemStatus))); - - newAppletStatus(applet->status()); - - connect(applet, SIGNAL(configNeedsSaving()), host, SIGNAL(configNeedsSaving())); - connect(applet, SIGNAL(releaseVisualFocus()), host, SIGNAL(releaseVisualFocus())); - - return static_cast(applet); -} - -void PlasmoidTask::forwardConstraintsEvent(Plasma::Constraints constraints) -{ - Plasma::Applet *applet = m_applet.data(); - if (applet) { - applet->updateConstraints(constraints); - applet->flushPendingConstraintsEvents(); - } -} - -int PlasmoidTask::id() const -{ - if (m_applet) { - return m_applet.data()->id(); - } - - return 0; -} - -void PlasmoidTask::setupApplet(const QString &plugin, int id) -{ - Plasma::Applet *applet = Plasma::Applet::load(plugin, id); - m_applet = applet; - - if (!m_applet) { - kDebug() << "Could not load applet" << plugin; - return; - } - - //FIXME: System Information should be system services, but battery and devicenotifier are both there. we would need multiple categories - if (applet->category() == "System Information" || - applet->category() == "Network") { - setCategory(Hardware); - } else if (applet->category() == "Online Services") { - setCategory(Communications); - } - - setName(applet->name()); - - m_icon = KIcon(applet->icon()); - - applet->setFlag(QGraphicsItem::ItemIsMovable, false); - - connect(applet, SIGNAL(appletDestroyed(Plasma::Applet*)), this, SLOT(appletDestroyed(Plasma::Applet*))); - applet->setBackgroundHints(Plasma::Applet::NoBackground); -} - -void PlasmoidTask::appletDestroyed(Plasma::Applet *) -{ - emit destroyed(this); - forget(m_host); - deleteLater(); -} - -void PlasmoidTask::newAppletStatus(Plasma::ItemStatus status) -{ - Plasma::Applet *applet = m_applet.data(); - if (!applet) { - return; - } - - switch (status) { - case Plasma::PassiveStatus: - if (Plasma::PopupApplet *popupApplet = qobject_cast(applet)) { - popupApplet->hidePopup(); - } - setStatus(Task::Passive); - break; - - case Plasma::ActiveStatus: - setStatus(Task::Active); - break; - - case Plasma::NeedsAttentionStatus: - setStatus(Task::NeedsAttention); - break; - - default: - case Plasma::UnknownStatus: - setStatus(Task::UnknownStatus); - } -} - -} - -#include "moc_plasmoidtask.cpp" diff --git a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtask.h b/plasma/applets/systemtray/protocols/plasmoid/plasmoidtask.h deleted file mode 100644 index 1a1dec69..00000000 --- a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtask.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * plasmoidtask.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2008 Sebastian Kügler * - * Copyright (C) 2009 Marco Martin * - * * - * 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 PLASMOIDTASK_H -#define PLASMOIDTASK_H - -#include "../../core/task.h" - -#include - -namespace SystemTray -{ - - -class PlasmoidTask : public Task -{ - Q_OBJECT - -public: - PlasmoidTask(const QString &appletName, int id, QObject *parent, Plasma::Applet *host); - virtual ~PlasmoidTask(); - - bool isValid() const; - virtual bool isEmbeddable() const; - virtual QString taskId() const; - virtual QIcon icon() const; - void forwardConstraintsEvent(Plasma::Constraints constraints); - int id() const; - Plasma::Applet *host() const; - virtual bool isWidget() const; - virtual TaskType type() const { return TypePlasmoid; } - -protected Q_SLOTS: - void appletDestroyed(Plasma::Applet *object); - void newAppletStatus(Plasma::ItemStatus status); - -Q_SIGNALS: - void taskDeleted(Plasma::Applet *host, const QString &taskId); - -protected: - virtual QGraphicsWidget* createWidget(Plasma::Applet *applet); - -private: - void setupApplet(const QString &plugin, int id); - - QString m_appletName; - QString m_taskId; - QIcon m_icon; - QWeakPointer m_applet; - Plasma::Applet *m_host; - bool m_takenByParent; -}; - -} - -#endif diff --git a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.cpp b/plasma/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.cpp deleted file mode 100644 index ffccfad5..00000000 --- a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/*************************************************************************** - * plasmoidprotocol.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2008 Sebastian Kügler * - * Copyright (C) 2009 Marco Martin * - * * - * 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 "plasmoidtask.h" -#include "plasmoidtaskprotocol.h" - -#include - -#include - -namespace SystemTray -{ - -PlasmoidProtocol::PlasmoidProtocol(QObject *parent) - : Protocol(parent) -{ -} - - -PlasmoidProtocol::~PlasmoidProtocol() -{ -} - - -void PlasmoidProtocol::init() -{ -} - -void PlasmoidProtocol::forwardConstraintsEvent(Plasma::Constraints constraints, Plasma::Applet *host) -{ - if (m_tasks.contains(host)) { - QHash tasksForHost = m_tasks.value(host); - foreach (PlasmoidTask *task, tasksForHost) { - task->forwardConstraintsEvent(constraints); - } - } -} - -void PlasmoidProtocol::loadFromConfig(Plasma::Applet *parent) -{ - QHash existingTasks = m_tasks.value(parent); - QSet seenNames; - - KConfigGroup appletGroup = parent->config(); - appletGroup = KConfigGroup(&appletGroup, "Applets"); - - foreach (const QString &groupName, appletGroup.groupList()) { - const KConfigGroup childGroup(&appletGroup, groupName); - const QString appletName = childGroup.readEntry("plugin", QString()); - - existingTasks.remove(appletName); - addApplet(appletName, groupName.toInt(), parent); - } - - QHashIterator it(existingTasks); - while (it.hasNext()) { - it.next(); - Plasma::Applet *applet = qobject_cast(it.value()->widget(parent, true)); - if (applet) { - applet->destroy(); - } - } -} - -void PlasmoidProtocol::addApplet(const QString appletName, const int id, Plasma::Applet *parent) -{ - PlasmoidTask *task = m_tasks.value(parent).value(appletName); - if (task) { - // the host already has one of these applets ... but let's make sure that the id is the same - // if it isn't, we have a duplicate in the config file and it should be removed - if (task->id() != id) { - KConfigGroup appletGroup = parent->config(); - appletGroup = KConfigGroup(&appletGroup, "Applets"); - appletGroup = KConfigGroup(&appletGroup, QString::number(id)); - appletGroup.deleteGroup(); - } - - return; - } - - kDebug() << "Registering task with the manager" << appletName; - task = new PlasmoidTask(appletName, id, this, parent); - - if (!task->isValid()) { - // we failed to load our applet *sob* - delete task; - return; - } - - - m_tasks[parent].insert(appletName, task); - connect(task, SIGNAL(taskDeleted(Plasma::Applet*,QString)), this, SLOT(cleanupTask(Plasma::Applet*,QString))); - emit taskCreated(task); -} - -void PlasmoidProtocol::removeApplet(const QString appletName, Plasma::Applet *parent) -{ - if (!m_tasks.contains(parent) || !m_tasks.value(parent).contains(appletName)) { - return; - } - - Plasma::Applet *applet = qobject_cast(m_tasks.value(parent).value(appletName)->widget(parent, true)); - - if (applet) { - applet->destroy(); - } -} - -void PlasmoidProtocol::cleanupTask(Plasma::Applet *host, const QString &taskId) -{ - kDebug() << "task with taskId" << taskId << "removed"; - if (m_tasks.contains(host)) { - m_tasks[host].remove(taskId); - if (m_tasks.value(host).isEmpty()) { - m_tasks.remove(host); - } - } -} - -QStringList PlasmoidProtocol::applets(Plasma::Applet *host) const -{ - QStringList list; - if (!m_tasks.contains(host)) { - return list; - } - - QHashIterator i(m_tasks.value(host)); - - while (i.hasNext()) { - i.next(); - list << i.key(); - } - - return list; -} - -} - -#include "moc_plasmoidtaskprotocol.cpp" diff --git a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.h b/plasma/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.h deleted file mode 100644 index 31aaca1c..00000000 --- a/plasma/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * plasmoidprotocol.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2008 Sebastian Kügler * - * Copyright (C) 2009 Marco Martin * - * * - * 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 PLASMOIDTASKPROTOCOL_H -#define PLASMOIDTASKPROTOCOL_H - -#include "../../core/protocol.h" - -#include - -#include -#include - -namespace SystemTray -{ - -class PlasmoidTask; - -class PlasmoidProtocol : public Protocol -{ - Q_OBJECT - -public: - PlasmoidProtocol(QObject * parent); - ~PlasmoidProtocol(); - - void init(); - - void forwardConstraintsEvent(Plasma::Constraints constraints, Plasma::Applet *host); - void loadFromConfig(Plasma::Applet *parent); - void addApplet(const QString appletName, const int id, Plasma::Applet *parent); - void removeApplet(const QString appletName, Plasma::Applet *parent); - QStringList applets(Plasma::Applet *parent) const; - -private slots: - void cleanupTask(Plasma::Applet *host, const QString &taskId); - -private: - QHash > m_tasks; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/systemtray.cpp b/plasma/applets/systemtray/systemtray.cpp new file mode 100644 index 00000000..e9e1c2ff --- /dev/null +++ b/plasma/applets/systemtray/systemtray.cpp @@ -0,0 +1,243 @@ +/* This file is part of the KDE project + Copyright (C) 2023 Ivailo Monev + + 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. +*/ + +#include "systemtray.h" + +#include +#include + +// standard issue margin/spacing +static const int s_margin = 4; +static const int s_spacing = 2; + +static QString kElementForArrow(const Qt::Orientation orientation, const bool reverse) +{ + switch (orientation) { + case Qt::Horizontal: { + if (reverse) { + return QString::fromLatin1("right-arrow"); + } + return QString::fromLatin1("left-arrow"); + } + case Qt::Vertical: { + if (reverse) { + return QString::fromLatin1("down-arrow"); + } + return QString::fromLatin1("up-arrow"); + } + } + // just in case + if (reverse) { + return QString::fromLatin1("down-arrow"); + } + return QString::fromLatin1("up-arrow"); +} + +SystemTrayApplet::SystemTrayApplet(QObject *parent, const QVariantList &args) + : Plasma::Applet(parent, args), + m_layout(nullptr), + m_arrowicon(nullptr), + m_showinghidden(false) +{ + KGlobal::locale()->insertCatalog("plasma_applet_systemtray"); + setAspectRatioMode(Plasma::AspectRatioMode::IgnoreAspectRatio); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); +} + +SystemTrayApplet::~SystemTrayApplet() +{ + QMutexLocker locker(&m_mutex); + foreach (Plasma::Applet* plasmaapplet, m_applets) { + KConfigGroup dummy; + plasmaapplet->save(dummy); + } +} + +void SystemTrayApplet::init() +{ + m_layout = new QGraphicsLinearLayout(Qt::Horizontal, this); + m_layout->setContentsMargins(s_margin, s_margin, s_margin, s_margin); + m_layout->setSpacing(s_spacing); + setLayout(m_layout); + + // TODO: update layout on ksycoca services update + updateLayout(); +} + +void SystemTrayApplet::updateLayout() +{ + QMutexLocker locker(&m_mutex); + foreach (Plasma::Applet* plasmaapplet, m_applets) { + m_layout->removeItem(plasmaapplet); + } + qDeleteAll(m_applets); + m_applets.clear(); + + foreach (const KPluginInfo &appletinfo, Plasma::Applet::listAppletInfo()) { + KService::Ptr appletservice = appletinfo.service(); + const bool notificationarea = appletservice->property("X-Plasma-NotificationArea", QVariant::Bool).toBool(); + if (notificationarea) { + Plasma::Applet* plasmaapplet = Plasma::Applet::load(appletinfo.pluginName()); + if (!plasmaapplet) { + kWarning() << "Could not load applet" << appletinfo.pluginName(); + continue; + } + + plasmaapplet->setParent(this); + plasmaapplet->setParentItem(this); + plasmaapplet->setFlag(QGraphicsItem::ItemIsMovable, false); + plasmaapplet->setBackgroundHints(Plasma::Applet::NoBackground); + KConfigGroup plasmaappletconfig = plasmaapplet->config(); + plasmaappletconfig = plasmaappletconfig.parent(); + plasmaapplet->restore(plasmaappletconfig); + plasmaapplet->init(); + plasmaapplet->updateConstraints(Plasma::AllConstraints); + plasmaapplet->flushPendingConstraintsEvents(); + connect( + plasmaapplet, SIGNAL(appletDestroyed(Plasma::Applet*)), + this, SLOT(slotAppletDestroyed(Plasma::Applet*)) + ); + connect( + plasmaapplet, SIGNAL(newStatus(Plasma::ItemStatus)), + this, SLOT(slotUpdateVisibility()) + ); + m_applets.append(plasmaapplet); + m_layout->addItem(plasmaapplet); + } + } + locker.unlock(); + slotUpdateVisibility(); +} + +void SystemTrayApplet::updateApplets(const Plasma::Constraints constraints) +{ + switch (m_layout->orientation()) { + case Qt::Horizontal: { + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + break; + } + case Qt::Vertical: { + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + break; + } + } + QMutexLocker locker(&m_mutex); + foreach (Plasma::Applet* plasmaapplet, m_applets) { + plasmaapplet->updateConstraints(constraints); + plasmaapplet->flushPendingConstraintsEvents(); + } + emit sizeHintChanged(Qt::PreferredSize); +} + +void SystemTrayApplet::constraintsEvent(Plasma::Constraints constraints) +{ + // perfect size finder + // qDebug() << Q_FUNC_INFO << size(); + if (constraints & Plasma::SizeConstraint || constraints & Plasma::FormFactorConstraint) { + switch (formFactor()) { + case Plasma::FormFactor::Horizontal: { + m_layout->setOrientation(Qt::Horizontal); + updateApplets(constraints); + return; + } + case Plasma::FormFactor::Vertical: { + m_layout->setOrientation(Qt::Vertical); + updateApplets(constraints); + return; + } + default: { + break; + } + } + + const QSizeF appletsize = size(); + if (appletsize.width() >= appletsize.height()) { + m_layout->setOrientation(Qt::Horizontal); + } else { + m_layout->setOrientation(Qt::Vertical); + } + } + updateApplets(constraints); +} + +void SystemTrayApplet::slotAppletDestroyed(Plasma::Applet *plasmaapplet) +{ + Q_UNUSED(plasmaapplet); + updateLayout(); +} + +void SystemTrayApplet::slotUpdateVisibility() +{ + if (m_showinghidden) { + // status updated while hidden applets are shown + return; + } + m_showinghidden = false; + bool hashidden = false; + QMutexLocker locker(&m_mutex); + foreach (Plasma::Applet* plasmaapplet, m_applets) { + if (plasmaapplet->status() == Plasma::PassiveStatus) { + hashidden = true; + plasmaapplet->setVisible(false); + // move hidden items to the front + m_layout->removeItem(plasmaapplet); + m_layout->insertItem(1, plasmaapplet); + } else { + plasmaapplet->setVisible(true); + // visible to the back + m_layout->addItem(plasmaapplet); + } + } + if (!hashidden) { + if (m_arrowicon) { + m_arrowicon->setVisible(false); + } + } else { + if (!m_arrowicon) { + m_arrowicon = new Plasma::IconWidget(this); + connect( + m_arrowicon, SIGNAL(clicked()), + this, SLOT(slotShowHidden()) + ); + } + m_arrowicon->setSvg("widgets/arrows", kElementForArrow(m_layout->orientation(), m_showinghidden)); + m_layout->insertItem(0, m_arrowicon); + } +} + +void SystemTrayApplet::slotShowHidden() +{ + // TODO: animation, perhaps via layout item to animate all applets via single animation + QMutexLocker locker(&m_mutex); + foreach (Plasma::Applet* plasmaapplet, m_applets) { + if (plasmaapplet->status() == Plasma::PassiveStatus) { + plasmaapplet->setVisible(!m_showinghidden); + } + } + m_showinghidden = !m_showinghidden; + m_arrowicon->setSvg("widgets/arrows", kElementForArrow(m_layout->orientation(), m_showinghidden)); + Plasma::ToolTipContent plasmatooltip; + plasmatooltip.setMainText( + QString::fromLatin1("
%1
").arg(m_showinghidden ? i18n("Hide icons") : i18n("Show hidden icons")) + ); + Plasma::ToolTipManager::self()->setContent(m_arrowicon, plasmatooltip); +} + +K_EXPORT_PLASMA_APPLET(systemtray, SystemTrayApplet) + +#include "moc_systemtray.cpp" diff --git a/plasma/applets/systemtray/systemtray.h b/plasma/applets/systemtray/systemtray.h new file mode 100644 index 00000000..a9062345 --- /dev/null +++ b/plasma/applets/systemtray/systemtray.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2023 Ivailo Monev + + 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. +*/ + +#ifndef SYSTEMTRAY_H +#define SYSTEMTRAY_H + +#include +#include +#include +#include + +class SystemTrayApplet : public Plasma::Applet +{ + Q_OBJECT +public: + SystemTrayApplet(QObject *parent, const QVariantList &args); + ~SystemTrayApplet(); + + // Plasma::Applet reimplementations + void init() final; + +protected: + // Plasma::Applet reimplementation + void constraintsEvent(Plasma::Constraints constraints) final; + +private Q_SLOTS: + void slotAppletDestroyed(Plasma::Applet *plasmaapplet); + void slotUpdateVisibility(); + void slotShowHidden(); + +private: + void updateLayout(); + void updateApplets(const Plasma::Constraints constraints); + + QMutex m_mutex; + QGraphicsLinearLayout* m_layout; + QList m_applets; + Plasma::IconWidget* m_arrowicon; + bool m_showinghidden; +}; + +#endif // SYSTEMTRAY_H diff --git a/plasma/applets/systemtray/ui/applet.cpp b/plasma/applets/systemtray/ui/applet.cpp deleted file mode 100644 index b10ade1b..00000000 --- a/plasma/applets/systemtray/ui/applet.cpp +++ /dev/null @@ -1,792 +0,0 @@ -/*************************************************************************** - * applet.cpp * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2008 Sebastian Sauer * - * Copyright (C) 2010 Marco Martin * - * * - * 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 "applet.h" -#include "widgetitem.h" -#include "mouseredirectarea.h" - -#include "../protocols/dbussystemtray/dbussystemtraytask.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "../core/manager.h" - -static const bool DEFAULT_SHOW_APPS = true; -static const bool DEFAULT_SHOW_COMMUNICATION = true; -static const bool DEFAULT_SHOW_SERVICES = true; -static const bool DEFAULT_SHOW_HARDWARE = true; -static const bool DEFAULT_SHOW_UNKNOWN = true; - -namespace SystemTray -{ - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -namespace -{ - -static void _RegisterEnums(QDeclarativeContext *context, const QMetaObject &meta) -{ - for (int i = 0, s = meta.enumeratorCount(); i < s; ++i) { - QMetaEnum e = meta.enumerator(i); - for (int i = 0, s = e.keyCount(); i < s; ++i) { - context->setContextProperty(e.key(i), e.value(i)); - } - } -} - -} // namespace - - -K_EXPORT_PLASMA_APPLET(systemtray, Applet) - - -Manager *Applet::s_manager = 0; -int Applet::s_managerUsage = 0; - -Applet::Applet(QObject *parent, const QVariantList &arguments) - : Plasma::Applet(parent, arguments), - m_widget(0), - m_firstRun(true) -{ - if (!s_manager) { - s_manager = new SystemTray::Manager(); - } - - ++s_managerUsage; - - setAspectRatioMode(Plasma::IgnoreAspectRatio); - setHasConfigurationInterface(true); -} - -Applet::~Applet() -{ - // stop listening to the manager - disconnect(s_manager, 0, this, 0); - - foreach (Task *task, s_manager->tasks()) { - // we don't care about the task updates anymore - disconnect(task, 0, this, 0); - - // delete our widget (if any); some widgets (such as the extender info one) - // may rely on the applet being around, so we need to delete them here and now - // while we're still kicking - if (task->isWidget()) - delete task->widget(this, false); - } - - delete m_widget; - - --s_managerUsage; - if (s_managerUsage < 1) { - delete s_manager; - s_manager = 0; - s_managerUsage = 0; - } -} - -void Applet::init() -{ - // First of all, we have to register new QML types because they won't be registered later - qmlRegisterType("Private", 0, 1, "WidgetItem"); - qmlRegisterType("Private", 0, 1, "MouseRedirectArea"); - - // Find data directory - KStandardDirs std_dirs; - QStringList dirs = std_dirs.findDirs("data", SYSTEMTRAY_DATA_INSTALL_DIR); - QString data_path; - if (!dirs.isEmpty()) { - data_path = dirs.at(0); - } else { - setFailedToLaunch(true, "Data directory for applet isn't found"); - return; - } - - // Create declarative engine, etc - m_widget = new Plasma::DeclarativeWidget(this); - m_widget->setInitializationDelayed(true); - connect(m_widget, SIGNAL(finished()), this, SLOT(_onWidgetCreationFinished())); - m_widget->setQmlPath(data_path + QString::fromLatin1("contents/ui/main.qml")); - - if (!m_widget->engine() || !m_widget->engine()->rootContext() || !m_widget->engine()->rootContext()->isValid() - || m_widget->mainComponent()->isError()) { - QString reason; - foreach (QDeclarativeError error, m_widget->mainComponent()->errors()) { - reason += error.toString(); - } - setFailedToLaunch(true, reason); - return; - } - - // setup context add global object "plasmoid" - QDeclarativeContext *root_context = m_widget->engine()->rootContext(); - root_context->setContextProperty("plasmoid", this); - - // add enumerations manually to global context - _RegisterEnums(root_context, Task::staticMetaObject); - _RegisterEnums(root_context, SystemTray::Applet::staticMetaObject); - - // add declarative widget to our applet - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - layout->addItem(m_widget); -} - - -void Applet::_onAddedTask(Task *task) -{ - if (task->isWidget()) { - // If task is presented as a widget then we should check that widget - if (!task->isEmbeddable(this)) { - //was a widget created previously? kill it - QGraphicsWidget *widget = task->widget(this, false); - if (widget) { - task->abandon(this); - } - return; - } - - QGraphicsWidget *widget = task->widget(this); - if (!widget) { - return; - } - - //If the applet doesn't want to show FDO tasks, remove (not just hide) any of them - //if the dbus icon has a category that the applet doesn't want to show remove it - if (!m_shownCategories.contains(task->category()) && !qobject_cast(widget)) { - task->abandon(this); - return; - } - } else if (!m_shownCategories.contains(task->category())) { - return; - } - - // provide task to qml code - emit newTask(task); - - DBusSystemTrayTask *dbus_task = qobject_cast(task); - if (dbus_task && !dbus_task->objectName().isEmpty() && dbus_task->shortcut().isEmpty()) { - // try to set shortcut - QString action_name = _getActionName(task); - KConfigGroup cg = config(); - KConfigGroup shortcutsConfig = KConfigGroup(&cg, "Shortcuts"); - QString shortcut = shortcutsConfig.readEntryUntranslated(action_name); - dbus_task->setShortcut(shortcut); - } -} - - -void Applet::_onRemovedTask(Task *task) -{ - //remove task from QML code - emit deletedTask(task); -} - -void Applet::_onStatusChangedTask() -{ - foreach (Task *task, s_manager->tasks()) { - if (task->status() == Task::NeedsAttention) { - setStatus(Plasma::NeedsAttentionStatus); - return; - } - } - - setStatus(Plasma::PassiveStatus); -} - -void Applet::_onWidgetCreationFinished() -{ - // add already existing tasks - QList tasks = s_manager->tasks(); - foreach (Task *t, tasks) { - _onAddedTask(t); - } - - connect(s_manager, SIGNAL(taskAdded(SystemTray::Task*)), this, SLOT(_onAddedTask(SystemTray::Task*))); - connect(s_manager, SIGNAL(taskRemoved(SystemTray::Task*)), this, SLOT(_onRemovedTask(SystemTray::Task*))); - connect(s_manager, SIGNAL(taskStatusChanged()), this, SLOT(_onStatusChangedTask())); -} - - -bool Applet::isFirstRun() -{ - return m_firstRun; -} - - -void Applet::configChanged() -{ - KConfigGroup gcg = globalConfig(); - KConfigGroup cg = config(); - - m_hiddenTypes = QSet::fromList(cg.readEntry("hidden", QStringList())); - m_alwaysShownTypes = QSet::fromList(cg.readEntry("alwaysShown", QStringList())); - - m_shownCategories.clear(); - - if (cg.readEntry("ShowApplicationStatus", gcg.readEntry("ShowApplicationStatus", DEFAULT_SHOW_APPS))) { - m_shownCategories.insert(Task::ApplicationStatus); - } - - if (cg.readEntry("ShowCommunications", gcg.readEntry("ShowCommunications", DEFAULT_SHOW_COMMUNICATION))) { - m_shownCategories.insert(Task::Communications); - } - - if (cg.readEntry("ShowSystemServices", gcg.readEntry("ShowSystemServices", DEFAULT_SHOW_SERVICES))) { - m_shownCategories.insert(Task::SystemServices); - } - - if (cg.readEntry("ShowHardware", gcg.readEntry("ShowHardware", DEFAULT_SHOW_HARDWARE))) { - m_shownCategories.insert(Task::Hardware); - } - - if (cg.readEntry("ShowUnknown", gcg.readEntry("ShowUnknown", DEFAULT_SHOW_UNKNOWN))) { - m_shownCategories.insert(Task::UnknownCategory); - } - - s_manager->loadApplets(this); - - // notify QML code about new user's preferences - emit visibilityPreferenceChanged(); -} - - -QString Applet::_getActionName(Task *task) const { - if (task->objectName().isEmpty()) - return QString(""); - return task->objectName() + QString("-") + QString::number(this->id()); -} - -void Applet::constraintsEvent(Plasma::Constraints constraints) -{ - if (constraints & Plasma::FormFactorConstraint) { - emit formFactorChanged(); - } - - if (constraints & Plasma::LocationConstraint) { - emit locationChanged(); - } - - if (constraints & Plasma::ImmutableConstraint) { - if (m_visibleItemsInterface) { - bool visible = (immutability() == Plasma::UserImmutable); - m_visibleItemsUi.visibleItemsView->setEnabled(immutability() == Plasma::Mutable); - m_visibleItemsUi.unlockLabel->setVisible(visible); - m_visibleItemsUi.unlockButton->setVisible(visible); - } - } - - if (constraints & Plasma::StartupCompletedConstraint) { - QTimer::singleShot(0, this, SLOT(checkDefaultApplets())); - configChanged(); - } - - s_manager->forwardConstraintsEvent(constraints, this); -} - -SystemTray::Manager *Applet::manager() const -{ - return s_manager; -} - -QSet Applet::shownCategories() const -{ - return m_shownCategories; -} - - -void Applet::propogateSizeHintChange(Qt::SizeHint which) -{ - emit sizeHintChanged(which); -} - -void Applet::createConfigurationInterface(KConfigDialog *parent) -{ - if (!m_autoHideInterface) { - m_autoHideInterface = new QWidget(); - m_visibleItemsInterface = new QWidget(); - - m_autoHideUi.setupUi(m_autoHideInterface.data()); - m_autoHideUi.icons->header()->setResizeMode(QHeaderView::ResizeToContents); - - m_visibleItemsUi.setupUi(m_visibleItemsInterface.data()); - - QAction *unlockAction = 0; - if (containment() && containment()->corona()) { - unlockAction = containment()->corona()->action("lock widgets"); - } - - if (unlockAction) { - disconnect(m_visibleItemsUi.unlockButton, SIGNAL(clicked()), this, SLOT(unlockContainment())); - connect(m_visibleItemsUi.unlockButton, SIGNAL(clicked()), unlockAction, SLOT(trigger()), Qt::UniqueConnection); - } else { - disconnect(m_visibleItemsUi.unlockButton, SIGNAL(clicked()), unlockAction, SLOT(trigger())); - connect(m_visibleItemsUi.unlockButton, SIGNAL(clicked()), this, SLOT(unlockContainment()), Qt::UniqueConnection); - } - - - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - - parent->addPage(m_visibleItemsInterface.data(), i18n("Display"), - "preferences-desktop-notification", - i18n("Choose which information to show")); - parent->addPage(m_autoHideInterface.data(), i18n("Entries"), "configure-toolbars"); - - bool visible = (immutability() == Plasma::UserImmutable); - //FIXME: always showing the scrollbar is due to a bug somewhere in QAbstractScrollArea, - //QListView and/or KCategorizedView; without it, under certain circumstances it will - //go into an infinite loop. too many people are running into this problem, so we are - //working around the problem rather than waiting for an upstream fix, which is against - //our usual policy. - //to determine if this line is no longer needed in the future, comment it out, lock - //widgets, then call up the configuration dialog for a system tray applet and click - //on the "unlock widgets" button. - m_visibleItemsUi.unlockLabel->setVisible(visible); - m_visibleItemsUi.unlockButton->setVisible(visible); - - m_visibleItemsUi.visibleItemsView->setEnabled(immutability() == Plasma::Mutable); - m_visibleItemsUi.visibleItemsView->setCategoryDrawer(new KCategoryDrawer(m_visibleItemsUi.visibleItemsView)); - m_visibleItemsUi.visibleItemsView->setMouseTracking(true); - m_visibleItemsUi.visibleItemsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - m_visibleItemsUi.visibleItemsView->setVerticalScrollMode(QListView::ScrollPerPixel); - - KCategorizedSortFilterProxyModel *visibleItemsModel = new KCategorizedSortFilterProxyModel(m_visibleItemsUi.visibleItemsView); - visibleItemsModel->setCategorizedModel(true); - - m_visibleItemsSourceModel = new QStandardItemModel(m_visibleItemsUi.visibleItemsView); - visibleItemsModel->setSourceModel(m_visibleItemsSourceModel.data()); - m_visibleItemsUi.visibleItemsView->setModel(visibleItemsModel); - } - - QStandardItemModel *visibleItemsSourceModel = m_visibleItemsSourceModel.data(); - // the lifespan of m_visibleItemsSourceModel is tied to the config UI, so it - // should always exist at this point - Q_ASSERT(visibleItemsSourceModel); - visibleItemsSourceModel->clear(); - m_autoHideUi.icons->clear(); - - QMultiMap sortedTasks; - foreach (Task *task, s_manager->tasks()) { - if (!m_shownCategories.contains(task->category())) { - continue; - } - - if (task->isWidget() && !task->widget(this, false)) { - // it is not being used by this widget - continue; - } - - sortedTasks.insert(task->name(), task); - } - - KConfigGroup gcg = globalConfig(); - KConfigGroup cg = config(); - KConfigGroup shortcutsConfig = KConfigGroup(&cg, "Shortcuts"); - - foreach (Task *task, sortedTasks) { - QTreeWidgetItem *listItem = new QTreeWidgetItem(m_autoHideUi.icons); - KComboBox *itemCombo = new KComboBox(m_autoHideUi.icons); - listItem->setText(0, task->name()); - listItem->setIcon(0, task->icon()); - listItem->setFlags(Qt::ItemIsEnabled); - listItem->setData(0, Qt::UserRole, task->taskId()); - - itemCombo->addItem(i18nc("Item will be automatically shown or hidden from the systray", "Auto")); - itemCombo->addItem(i18nc("Item is never visible in the systray", "Hidden")); - itemCombo->addItem(i18nc("Item is always visible in the systray", "Always Visible")); - - if (m_hiddenTypes.contains(task->taskId())) { - itemCombo->setCurrentIndex(1); - } else if (m_alwaysShownTypes.contains(task->taskId())) { - itemCombo->setCurrentIndex(2); - } else { - itemCombo->setCurrentIndex(0); - } - m_autoHideUi.icons->setItemWidget(listItem, 1, itemCombo); - - KKeySequenceWidget *button = new KKeySequenceWidget(m_autoHideUi.icons); - - DBusSystemTrayTask *dbus_task = qobject_cast(task); - Plasma::Applet *applet = qobject_cast(task->widget(this)); - - if (task && dbus_task && !dbus_task->objectName().isEmpty()) { - QString action_name = _getActionName(task); - QString shortcutText = shortcutsConfig.readEntryUntranslated(action_name, QString()); - button->setKeySequence(shortcutText); - } else if (task && applet) { - button->setKeySequence(applet->globalShortcut().primary()); - //no way to have a shortcut for the fdo protocol - } else { - button->setEnabled(false); - } - m_autoHideUi.icons->setItemWidget(listItem, 2, button); - m_autoHideUi.icons->addTopLevelItem(listItem); - - // try to make sure we have enough width! - int totalWidth = 0; - for (int i = 0; i < m_autoHideUi.icons->header()->count(); ++i) { - totalWidth += m_autoHideUi.icons->columnWidth(i); - } - m_autoHideUi.icons->setMinimumWidth(totalWidth + style()->pixelMetric(QStyle::PM_ScrollBarExtent)); - - connect(itemCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified())); - connect(button, SIGNAL(keySequenceChanged(QKeySequence)), parent, SLOT(settingsModified())); - } - - const QString itemCategories = i18nc("Categories of items in the systemtray that will be shown or hidden", "Shown Item Categories"); - - QStandardItem *applicationStatusItem = new QStandardItem(); - applicationStatusItem->setText(i18nc("Systemtray items that describe the status of a generic application", "Application status")); - applicationStatusItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - bool checked = cg.readEntry("ShowApplicationStatus", - gcg.readEntry("ShowApplicationStatus", DEFAULT_SHOW_APPS)); - applicationStatusItem->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - applicationStatusItem->setData(itemCategories, KCategorizedSortFilterProxyModel::CategoryDisplayRole); - applicationStatusItem->setData("ShowApplicationStatus", Qt::UserRole+1); - visibleItemsSourceModel->appendRow(applicationStatusItem); - - QStandardItem *communicationsItem = new QStandardItem(); - communicationsItem->setText(i18nc("Items communication related, such as chat or email clients", "Communications")); - communicationsItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - checked = cg.readEntry("ShowCommunications", - gcg.readEntry("ShowCommunications", DEFAULT_SHOW_COMMUNICATION)); - communicationsItem->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - communicationsItem->setData(itemCategories, KCategorizedSortFilterProxyModel::CategoryDisplayRole); - communicationsItem->setData("ShowCommunications", Qt::UserRole+1); - visibleItemsSourceModel->appendRow(communicationsItem); - - QStandardItem *systemServicesItem = new QStandardItem(); - systemServicesItem->setText(i18nc("Items about the status of the system, such as a filesystem indexer", "System services")); - systemServicesItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - checked = cg.readEntry("ShowSystemServices", - gcg.readEntry("ShowSystemServices", DEFAULT_SHOW_SERVICES)); - systemServicesItem->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - systemServicesItem->setData(itemCategories, KCategorizedSortFilterProxyModel::CategoryDisplayRole); - systemServicesItem->setData("ShowSystemServices", Qt::UserRole+1); - visibleItemsSourceModel->appendRow(systemServicesItem); - - QStandardItem *hardwareControlItem = new QStandardItem(); - hardwareControlItem->setText(i18nc("Items about hardware, such as battery or volume control", "Hardware control")); - hardwareControlItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - checked = cg.readEntry("ShowHardware", - gcg.readEntry("ShowHardware", DEFAULT_SHOW_HARDWARE)); - hardwareControlItem->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - hardwareControlItem->setData(itemCategories, KCategorizedSortFilterProxyModel::CategoryDisplayRole); - hardwareControlItem->setData("ShowHardware", Qt::UserRole+1); - visibleItemsSourceModel->appendRow(hardwareControlItem); - - QStandardItem *unknownItem = new QStandardItem(); - unknownItem->setText(i18nc("Other uncategorized systemtray items", "Miscellaneous")); - unknownItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - checked = cg.readEntry("ShowUnknown", - gcg.readEntry("ShowUnknown", DEFAULT_SHOW_UNKNOWN)); - unknownItem->setCheckState(checked ? Qt::Checked : Qt::Unchecked); - unknownItem->setData(itemCategories, KCategorizedSortFilterProxyModel::CategoryDisplayRole); - unknownItem->setData("ShowUnknown", Qt::UserRole+1); - visibleItemsSourceModel->appendRow(unknownItem); - - QStringList ownApplets = s_manager->applets(this); - - QMap sortedApplets; - foreach (const KPluginInfo &info, Plasma::Applet::listAppletInfo()) { - KService::Ptr service = info.service(); - if (service->property("X-Plasma-NotificationArea", QVariant::Bool).toBool()) { - // if we already have a plugin with this exact name in it, then check if it is the - // same plugin and skip it if it is indeed already listed - if (sortedApplets.contains(info.name())) { - - bool dupe = false; - // it is possible (though poor form) to have multiple applets - // with the same visible name but different plugins, so we hve to check all values - foreach (const KPluginInfo &existingInfo, sortedApplets.values(info.name())) { - if (existingInfo.pluginName() == info.pluginName()) { - dupe = true; - break; - } - } - - if (dupe) { - continue; - } - } - - // insertMulti becase it is possible (though poor form) to have multiple applets - // with the same visible name but different plugins - sortedApplets.insertMulti(info.name(), info); - } - } - - foreach (const KPluginInfo &info, sortedApplets) { - QStandardItem *item = new QStandardItem(); - item->setText(info.name()); - item->setIcon(KIcon(info.icon())); - item->setCheckable(true); - item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - item->setCheckState(ownApplets.contains(info.pluginName()) ? Qt::Checked : Qt::Unchecked); - item->setData(i18nc("Extra items to be manually added in the systray, such as little Plasma widgets", "Extra Items"), KCategorizedSortFilterProxyModel::CategoryDisplayRole); - item->setData(info.pluginName(), Qt::UserRole+2); - visibleItemsSourceModel->appendRow(item); - } - - connect(visibleItemsSourceModel, SIGNAL(itemChanged(QStandardItem*)), parent, SLOT(settingsModified())); -} - -//not always the corona lock action is available: netbook locks per-containment -void Applet::unlockContainment() -{ - if (containment() && containment()->immutability() == Plasma::UserImmutable) { - containment()->setImmutability(Plasma::Mutable); - } -} - -void Applet::configAccepted() -{ - KConfigGroup cg = config(); - KConfigGroup shortcutsConfig = KConfigGroup(&cg, "Shortcuts"); - - QStringList hiddenTypes; - QStringList alwaysShownTypes; - QTreeWidget *hiddenList = m_autoHideUi.icons; - for (int i = 0; i < hiddenList->topLevelItemCount(); ++i) { - QTreeWidgetItem *item = hiddenList->topLevelItem(i); - KComboBox *itemCombo = static_cast(hiddenList->itemWidget(item, 1)); - //kDebug() << (item->checkState() == Qt::Checked) << item->data(Qt::UserRole).toString(); - const QString taskTypeId = item->data(0, Qt::UserRole).toString(); - if (itemCombo->currentIndex() == 1) { - //Always hidden - hiddenTypes << taskTypeId; - } else if (itemCombo->currentIndex() == 2) { - //Always visible - alwaysShownTypes << taskTypeId; - } - - KKeySequenceWidget *keySeq = static_cast(hiddenList->itemWidget(item, 2)); - QKeySequence seq = keySeq->keySequence(); - Task *task = 0; - //FIXME: terribly inefficient - foreach (Task *candidateTask, s_manager->tasks()) { - if (candidateTask->taskId() == taskTypeId) { - task = candidateTask; - break; - } - } - - if (task) { - if (!task->isWidget()) { - DBusSystemTrayTask *dbus_task = qobject_cast(task); - if (dbus_task) { - QString shortcut = seq.toString(); - dbus_task->setShortcut(shortcut); - QString action_name = _getActionName(task); - if (seq.isEmpty()) - shortcutsConfig.deleteEntry(action_name); - else - shortcutsConfig.writeEntry(action_name, shortcut); - dbus_task->setShortcut(shortcut); - } - } else { - Plasma::Applet *applet = qobject_cast( task->widget(this) ); - if (applet) { - applet->setGlobalShortcut(KShortcut(seq)); - } - } - } - } - - cg.writeEntry("hidden", hiddenTypes); - cg.writeEntry("alwaysShown", alwaysShownTypes); - - QStringList applets = s_manager->applets(this); - - for (int i = 0; i <= m_visibleItemsSourceModel.data()->rowCount() - 1; i++) { - QModelIndex index = m_visibleItemsSourceModel.data()->index(i, 0); - QString itemCategory = index.data(Qt::UserRole+1).toString(); - QString appletName = index.data(Qt::UserRole+2).toString(); - if (!itemCategory.isEmpty()) { - QStandardItem *item = m_visibleItemsSourceModel.data()->itemFromIndex(index); - cg.writeEntry(itemCategory, (item->checkState() == Qt::Checked)); - } else if (!appletName.isEmpty()){ - QStandardItem *item = m_visibleItemsSourceModel.data()->itemFromIndex(index); - - if (item->checkState() != Qt::Unchecked && !applets.contains(appletName)) { - s_manager->addApplet(appletName, this); - } - - if (item->checkState() == Qt::Checked) { - applets.removeAll(appletName); - } - } - } - - foreach (const QString &appletName, applets) { - s_manager->removeApplet(appletName, this); - } - - emit configNeedsSaving(); -} - -void Applet::checkDefaultApplets() -{ - if (config().readEntry("DefaultAppletsAdded", false)) { - m_firstRun = false; - return; - } - - // TODO: applets configuration is not saved - QStringList applets = s_manager->applets(this); - - if (!applets.contains("devicenotifier")) { - s_manager->addApplet("devicenotifier", this); - } - - if (!applets.contains("notifications")) { - s_manager->addApplet("notifications", this); - } - - if (!applets.contains("keyboard")) { - s_manager->addApplet("keyboard", this); - } - - if (!applets.contains("battery")) { - const QList batteries = Solid::Device::listFromType(Solid::DeviceInterface::Battery); - if (!batteries.isEmpty()) { - s_manager->addApplet("battery", this); - } - } - - if (!applets.contains("mixer")) { - s_manager->addApplet("mixer", this); - } - - config().writeEntry("DefaultAppletsAdded", true); -} - - -int Applet::getVisibilityPreference(QObject *task) const -{ - Task *t = qobject_cast(task); - if (!t) - return AutoVisibility; - if ( m_hiddenTypes.contains(t->taskId()) ) { - return AlwaysHidden; - } else if ( m_alwaysShownTypes.contains(t->taskId()) ) { - return AlwaysShown; - } - return AutoVisibility; -} - -QAction *Applet::createShortcutAction(QString action_id) const -{ - KAction *action = new KAction(parent()); - action->setObjectName(action_id); - return action; -} - -void Applet::updateShortcutAction(QAction *action, QString shortcut) const -{ - KAction *act = qobject_cast(action); - if (!act) { - return; - } - - act->forgetGlobalShortcut(); - if (!shortcut.isEmpty()) { - act->setGlobalShortcut(KShortcut(QKeySequence(shortcut)), - KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), - KAction::NoAutoloading); - } -} - -void Applet::destroyShortcutAction(QAction *action) const -{ - KAction *act = qobject_cast(action); - if (act) { - delete act; - } -} - -void Applet::showMenu(QObject *menu_var, int x, int y, QObject *item_var) const -{ - QGraphicsItem *item = qobject_cast(item_var); - QMenu *menu = qobject_cast(menu_var); - if (menu) { - QPoint pos(x, y); - menu->adjustSize(); - if (item && containment() && containment()->corona()) { - pos = containment()->corona()->popupPosition(item, menu->size()); - } else { - pos = Plasma::Applet::popupPosition(menu->size()); - } - menu->popup(pos); - } -} - -void Applet::hideFromTaskbar(qulonglong win_id) const -{ - if (win_id > 0) { - KWindowSystem::setState(win_id, NET::SkipTaskbar | NET::SkipPager); - } -} - -QString Applet::getUniqueId(QObject *obj) const -{ - return QString::number(reinterpret_cast(obj)); -} - -QPoint Applet::popupPosition(QObject *item_var, QSize size, int align) const -{ - QGraphicsItem *item = qobject_cast(item_var); - if ( item && containment() && containment()->corona() ) { - return containment()->corona()->popupPosition(item, size, (Qt::AlignmentFlag)align); - } - return Plasma::Applet::popupPosition(size, (Qt::AlignmentFlag)align); -} - - -} - -#include "moc_applet.cpp" diff --git a/plasma/applets/systemtray/ui/applet.h b/plasma/applets/systemtray/ui/applet.h deleted file mode 100644 index bcb2a346..00000000 --- a/plasma/applets/systemtray/ui/applet.h +++ /dev/null @@ -1,174 +0,0 @@ -/*************************************************************************** - * applet.h * - * * - * Copyright (C) 2008 Jason Stubbs * - * Copyright (C) 2010 Marco Martin * - * Copyright (C) 2012 Dmitry Ashkadov * - * * - * 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 APPLET_H -#define APPLET_H - -#include - -#include "ui_autohide.h" -#include "ui_visibleitems.h" - -#include "../core/task.h" - -namespace Plasma -{ -class ExtenderItem; -class TabBar; -class Dialog; -class DeclarativeWidget; -} - -#include - -namespace SystemTray -{ - -class Manager; - -class Applet : public Plasma::Applet -{ - Q_OBJECT - - Q_ENUMS(FormFactor) - Q_ENUMS(Location) - Q_ENUMS(VisibilityPreference) - - Q_PROPERTY(bool firstRun READ isFirstRun) - - // TODO: remove these properties in the future (they will be supported in Plasma::Applet) - Q_PROPERTY(int formFactor READ formFactor NOTIFY formFactorChanged) - Q_PROPERTY(int location READ location NOTIFY locationChanged) - -public: - // Form factor - enum FormFactor - { - Planar = Plasma::Planar, - MediaCenter = Plasma::MediaCenter, - Horizontal = Plasma::Horizontal, - Vertical = Plasma::Vertical - }; - - // Location - enum Location - { - Floating = Plasma::Floating, - Desktop = Plasma::Desktop, - FullScreen = Plasma::FullScreen, - TopEdge = Plasma::TopEdge, - BottomEdge = Plasma::BottomEdge, - LeftEdge = Plasma::LeftEdge, - RightEdge = Plasma::RightEdge - }; - - /// User's preference of visibility of task - enum VisibilityPreference { - AutoVisibility = 0, - AlwaysHidden, - AlwaysShown - }; - - explicit Applet(QObject *parent, const QVariantList &arguments = QVariantList()); - ~Applet(); - - void init(); - void constraintsEvent(Plasma::Constraints constraints); - Manager *manager() const; - QSet shownCategories() const; - bool isFirstRun(); - - Q_INVOKABLE int getVisibilityPreference(QObject *task) const; - Q_INVOKABLE QAction* createShortcutAction(QString action_id) const; - Q_INVOKABLE void updateShortcutAction(QAction *action, QString shortcut) const; - Q_INVOKABLE void destroyShortcutAction(QAction *action) const; - Q_INVOKABLE void showMenu(QObject *menu, int x, int y, QObject *item) const; - Q_INVOKABLE void hideFromTaskbar(qulonglong win_id) const; - Q_INVOKABLE QString getUniqueId(QObject *obj) const; - Q_INVOKABLE QPoint popupPosition(QObject *item, QSize size = QSize(0, 0), int align = Qt::AlignLeft) const; - -protected: - void createConfigurationInterface(KConfigDialog *parent); - void configChanged(); - - void mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event); } - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event); } - void hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); } - void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); } - -signals: - void formFactorChanged(); - void locationChanged(); - void visibilityPreferenceChanged(); ///< If user has changed his preference on visibility of tasks - - /** - * This signal is emmited for each new task - * @param task a new task - */ - void newTask(QObject *task); - - /** - * This signal is emmited before task is deleted - * @param task a task that is being deleted - */ - void deletedTask(QObject *task); - -private Q_SLOTS: - void configAccepted(); - void unlockContainment(); - void propogateSizeHintChange(Qt::SizeHint which); - void checkDefaultApplets(); - - void _onAddedTask(SystemTray::Task*); - void _onRemovedTask(SystemTray::Task*); - void _onStatusChangedTask(); - - void _onWidgetCreationFinished(); - -private: - QString _getActionName(Task *task) const; - -private: - static SystemTray::Manager *s_manager; - static int s_managerUsage; - - QWeakPointer m_autoHideInterface; - QWeakPointer m_visibleItemsInterface; - QSet m_shownCategories; - QSet m_hiddenTypes; - QSet m_alwaysShownTypes; - QDateTime m_lastActivity; - Plasma::DeclarativeWidget *m_widget; - - Ui::AutoHideConfig m_autoHideUi; - Ui::VisibleItemsConfig m_visibleItemsUi; - - QWeakPointer m_visibleItemsSourceModel; - - bool m_firstRun; -}; - -} - - -#endif diff --git a/plasma/applets/systemtray/ui/autohide.ui b/plasma/applets/systemtray/ui/autohide.ui deleted file mode 100644 index 6556c617..00000000 --- a/plasma/applets/systemtray/ui/autohide.ui +++ /dev/null @@ -1,57 +0,0 @@ - - - AutoHideConfig - - - - 0 - 0 - 422 - 253 - - - - - 0 - - - - - false - - - 3 - - - true - - - 100 - - - 100 - - - true - - - - Item - - - - - Visibility - - - - - Keyboard Shortcut - - - - - - - - diff --git a/plasma/applets/systemtray/ui/mouseredirectarea.cpp b/plasma/applets/systemtray/ui/mouseredirectarea.cpp deleted file mode 100644 index a69d161a..00000000 --- a/plasma/applets/systemtray/ui/mouseredirectarea.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: GPLv2+ - * Authors: Dmitry Ashkadov - * - * 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 . - **********************************************************************************************************************/ - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Includes -#include "mouseredirectarea.h" - -#include "../core/task.h" - -#include -#include -#include -#include -#include - -#include - - -namespace SystemTray -{ - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// class MouseRedirectArea -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template void MouseRedirectArea::forwardEvent(T *event, bool is_context_menu) -{ - if (!isEnabled() || !(m_task || m_widget) || !m_applet) - return; - QGraphicsObject *target = m_widget ? m_widget : (m_task ? m_task->widget(m_applet, false) : 0); - if (!target) - return; - - QPointF delta = target->sceneBoundingRect().center() - event->scenePos(); - event->setScenePos(target->sceneBoundingRect().center()); - event->setScreenPos((event->screenPos() + delta).toPoint()); - - if (m_isApplet) { - if (is_context_menu && m_applet->containment()) { - // redirect context menu event to containment because it is responsible for items of context menu of an applet - event->setPos(m_applet->containment()->mapFromScene(event->scenePos())); - scene()->sendEvent(m_applet->containment(), event); - } else { - event->setPos(scene()->itemAt(event->scenePos())->mapFromScene(event->scenePos())); - scene()->sendEvent(scene()->itemAt(event->scenePos()), event); - } - } else { - event->setPos(target->boundingRect().center()); - scene()->sendEvent(target, event); - } -} - - -MouseRedirectArea::MouseRedirectArea(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_widget(0) - , m_task(0) - , m_target(0) - , m_applet(0) - , m_isApplet(false) -{ - setAcceptHoverEvents(true); - setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); -} - -void MouseRedirectArea::setTarget(QObject *t) -{ - if (m_target != t) { - m_target = t; - processTarget(); - } -} - -void MouseRedirectArea::setApplet(QObject *a) -{ - Plasma::Applet *applet = qobject_cast(a); - if (m_applet != applet) { - m_applet = applet; - processTarget(); // it may be that target already set so we should process it - } -} - - -void MouseRedirectArea::wheelEvent(QGraphicsSceneWheelEvent *event) -{ - if (!m_isApplet && m_widget) { - switch (event->orientation()) { - case Qt::Vertical: - emit scrollVert(event->delta()); - break; - case Qt::Horizontal: - emit scrollHorz(event->delta()); - break; - default: - break; - } - return; - } - forwardEvent(event); -} - - -void MouseRedirectArea::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -{ - forwardEvent(event, true); -} - - -void MouseRedirectArea::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - if (!m_isApplet && m_widget) { - switch (event->button()) { - case Qt::MiddleButton: emit clickMiddle(); return; - case Qt::RightButton: emit clickRight(); return; - default: break; - } - } - forwardEvent(event); -} - - -void MouseRedirectArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - forwardEvent(event); -} - -void MouseRedirectArea::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - forwardEvent(event); - emit entered(); -} - - -void MouseRedirectArea::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - forwardEvent(event); - emit exited(); -} - -void MouseRedirectArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - QPointF pos = event->pos(); - emit changedMousePos(pos.x(), pos.y()); - forwardEvent(event); -} - -void MouseRedirectArea::processTarget() -{ - // we have target as QObject but it may be Task or Widget - if (!m_applet || !m_target) - return; // applet and target must be already set - - m_isApplet = false; - m_widget = 0; - m_task = 0; - m_task = qobject_cast(m_target); - if (m_task) { - QGraphicsWidget *widget = m_task->widget(m_applet); - m_isApplet = (qobject_cast(widget) != 0); - } else { - m_widget = qobject_cast(m_target); - } -} - - -} // namespace SystemTray diff --git a/plasma/applets/systemtray/ui/mouseredirectarea.h b/plasma/applets/systemtray/ui/mouseredirectarea.h deleted file mode 100644 index 76ca0db5..00000000 --- a/plasma/applets/systemtray/ui/mouseredirectarea.h +++ /dev/null @@ -1,97 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: GPLv2+ - * Authors: Dmitry Ashkadov - * - * 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 SYSTEMTRAY__MOUSEREDIRECTAREA_H -#define SYSTEMTRAY__MOUSEREDIRECTAREA_H - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//Includes -#include - -#include - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Forward declarations -#include -#include -#include - - -namespace SystemTray -{ -class Task; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** @class MouseRedirectArea - * This helper class is intended to handle and redirect some mouse events - */ -class MouseRedirectArea: public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QObject* target READ target WRITE setTarget) - Q_PROPERTY(QObject* applet READ applet WRITE setApplet) -public: - explicit MouseRedirectArea(QDeclarativeItem *parent = 0); - - QObject* target() const { return m_target; } - void setTarget(QObject* t); - QObject *applet() const { return m_applet; } - void setApplet(QObject *applet); - -signals: - void clickMiddle(); - void clickRight(); - void scrollVert(int delta); - void scrollHorz(int delta); - void changedMousePos(qreal mouseX, qreal mouseY); - void entered(); - void exited(); - -private: //Events - virtual void wheelEvent(QGraphicsSceneWheelEvent *event); - virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); - - template void forwardEvent(T *event, bool is_context_menu = false); - -private: // Methods - void processTarget(); - -private: //Variables - QGraphicsObject *m_widget; - Task *m_task; - QObject *m_target; - Plasma::Applet *m_applet; - bool m_isApplet; // true if target is an applet -}; - -} // namespace SystemTray - -#endif // SYSTEMTRAY__MOUSEREDIRECTAREA_H diff --git a/plasma/applets/systemtray/ui/visibleitems.ui b/plasma/applets/systemtray/ui/visibleitems.ui deleted file mode 100644 index dea6c774..00000000 --- a/plasma/applets/systemtray/ui/visibleitems.ui +++ /dev/null @@ -1,86 +0,0 @@ - - - VisibleItemsConfig - - - - 0 - 0 - 380 - 360 - - - - - 0 - 360 - - - - - 0 - - - - - Widgets are currently locked, disabling some options. - - - Qt::AlignCenter - - - true - - - - - - - - - Qt::Horizontal - - - - 34 - 24 - - - - - - - - Unlock Widgets - - - - - - - Qt::Horizontal - - - - 34 - 24 - - - - - - - - - - - - - - KCategorizedView - QListView -
kcategorizedview.h
-
-
- -
diff --git a/plasma/applets/systemtray/ui/widgetitem.cpp b/plasma/applets/systemtray/ui/widgetitem.cpp deleted file mode 100644 index 3fe30e46..00000000 --- a/plasma/applets/systemtray/ui/widgetitem.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: GPLv2+ - * Authors: Dmitry Ashkadov - * - * 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 . - **********************************************************************************************************************/ - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Includes -#include "widgetitem.h" - -#include "../core/task.h" - -#include -#include - -#include - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -namespace SystemTray -{ -// class WidgetItem -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -WidgetItem::WidgetItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_applet(0) -{ - setClip(false); - connect(this, SIGNAL(widthChanged()), this, SLOT(afterWidthChanged()), Qt::QueuedConnection); - connect(this, SIGNAL(heightChanged()), this, SLOT(afterHeightChanged()), Qt::QueuedConnection); -} - - -WidgetItem::~WidgetItem() -{ - unbind(); -} - -void WidgetItem::setTask(QObject *task) -{ - Task *t = qobject_cast(task); - if (m_task.data() == t) - return; - unbind(); - m_task = t; - bind(); - emit changedTask(); -} - -void WidgetItem::setApplet(QObject *a) -{ - Plasma::Applet *applet = qobject_cast(a); - if (m_applet == applet) - return; - unbind(); - m_applet = applet; - bind(); -} - -void WidgetItem::unbind() -{ - if (m_applet && m_task) { - QGraphicsWidget *widget = m_task.data()->widget(m_applet, false); - if (widget && widget->parentItem() == this) { - widget->hide(); - widget->setParentItem(0); - } - } -} - -void WidgetItem::bind() -{ - if (m_applet && m_task) { - QGraphicsWidget *widget = m_task.data()->widget(m_applet); - if (widget) { - widget->setParentItem(this); - widget->setPos(0, 0); - widget->setPreferredSize(width(), width()); - widget->setMinimumSize(width(), width()); - widget->setMaximumSize(width(), width()); - widget->show(); - } - } -} - - -void WidgetItem::afterWidthChanged() -{ - if (!m_applet || !m_task) { - return; - } - - QGraphicsWidget *widget = m_task.data()->widget(m_applet); - if (widget) { - widget->setPreferredSize(width(), width()); - widget->setMinimumSize(width(), width()); - widget->setMaximumSize(width(), width()); - widget->show(); - } -} - -void WidgetItem::afterHeightChanged() -{ - if (!m_applet || !m_task) { - return; - } - - QGraphicsWidget *widget = m_task.data()->widget(m_applet); - if (widget) { - widget->setPreferredSize(width(), width()); - widget->setMinimumSize(width(), width()); - widget->setMaximumSize(width(), width()); - widget->show(); - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -} //namespace SystemTray - diff --git a/plasma/applets/systemtray/ui/widgetitem.h b/plasma/applets/systemtray/ui/widgetitem.h deleted file mode 100644 index 87a74e27..00000000 --- a/plasma/applets/systemtray/ui/widgetitem.h +++ /dev/null @@ -1,81 +0,0 @@ -/*********************************************************************************************************************** - * KDE System Tray (Plasmoid) - * - * Copyright (C) 2012 ROSA - * License: GPLv2+ - * Authors: Dmitry Ashkadov - * - * 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 SYSTEMTRAY__WIDGETITEM_H -#define SYSTEMTRAY__WIDGETITEM_H - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Includess -#include "../core/task.h" - -#include - -#include - -namespace SystemTray -{ - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// class WidgetItem -/** @class WidgetItem - * Represents declarative item containing an specified graphics widget. - */ -class WidgetItem: public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QObject* applet READ applet WRITE setApplet) ///< host applet - Q_PROPERTY(QObject* task READ task WRITE setTask NOTIFY changedTask) ///< task -public: - explicit WidgetItem(QDeclarativeItem *parent = 0); - virtual ~WidgetItem(); - -public: - QObject *task() const { return m_task.data(); } - void setTask(QObject *task); - - /** - * @return applet as a host for widget - */ - QObject *applet() const { return m_applet; } - void setApplet(QObject *applet); - -signals: - void changedTask(); - -private Q_SLOTS: - void afterWidthChanged(); - void afterHeightChanged(); - -private: - void bind(); - void unbind(); - - Plasma::Applet *m_applet; - QWeakPointer m_task; -}; - -} //namespace SystemTray - -#endif // SYSTEMTRAY__WIDGETITEM_H diff --git a/plasma/applets/tasks/Messages.sh b/plasma/applets/tasks/Messages.sh index 4e524b3e..9ff50731 100755 --- a/plasma/applets/tasks/Messages.sh +++ b/plasma/applets/tasks/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_tasks.pot +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_tasks.pot rm -f rc.cpp diff --git a/plasma/applets/weather/Messages.sh b/plasma/applets/weather/Messages.sh index 17738e14..55e62e36 100755 --- a/plasma/applets/weather/Messages.sh +++ b/plasma/applets/weather/Messages.sh @@ -1,4 +1,4 @@ #!/bin/bash $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_weather.pot +$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_applet_weather.pot rm -f rc.cpp diff --git a/plasma/applets/weather/plasma-applet-weather.desktop b/plasma/applets/weather/plasma-applet-weather.desktop index 3ab18f9b..cd24b87b 100644 --- a/plasma/applets/weather/plasma-applet-weather.desktop +++ b/plasma/applets/weather/plasma-applet-weather.desktop @@ -122,4 +122,3 @@ X-KDE-PluginInfo-Website= X-KDE-ServiceTypes=Plasma/PopupApplet,Plasma/Applet X-KDE-Library=plasma_applet_weather X-Plasma-DefaultSize=420,200 -X-Plasma-NotificationArea=true diff --git a/plasma/dataengines/CMakeLists.txt b/plasma/dataengines/CMakeLists.txt index fcf7c63f..2f8a3507 100644 --- a/plasma/dataengines/CMakeLists.txt +++ b/plasma/dataengines/CMakeLists.txt @@ -4,6 +4,5 @@ add_subdirectory(dict) add_subdirectory(notifications) add_subdirectory(soliddevice) add_subdirectory(time) -add_subdirectory(statusnotifieritem) add_subdirectory(systemmonitor) diff --git a/plasma/dataengines/statusnotifieritem/CMakeLists.txt b/plasma/dataengines/statusnotifieritem/CMakeLists.txt deleted file mode 100644 index be2f7412..00000000 --- a/plasma/dataengines/statusnotifieritem/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -project(plasma-statusnotifieritem_engine) - -include_directories(${CMAKE_SOURCE_DIR}/statusnotifierwatcher) - -# We add our source code here -set(statusnotifieritem_engine_SRCS - statusnotifieritem_engine.cpp - statusnotifieritemsource.cpp - statusnotifieritemservice.cpp - statusnotifieritemjob.cpp - systemtraytypes.cpp -) - -set(statusnotifierwatcher_xml ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.StatusNotifierWatcher.xml) -QT4_ADD_DBUS_INTERFACE(statusnotifieritem_engine_SRCS ${statusnotifierwatcher_xml} statusnotifierwatcher_interface) - -set(statusnotifieritem_xml ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.StatusNotifierItem.xml) - -set_source_files_properties(${statusnotifieritem_xml} PROPERTIES - NO_NAMESPACE false - INCLUDE "systemtraytypes.h" - CLASSNAME OrgKdeStatusNotifierItem -) -QT4_ADD_DBUS_INTERFACE(statusnotifieritem_engine_SRCS ${statusnotifieritem_xml} statusnotifieritem_interface) - -kde4_add_plugin(plasma_engine_statusnotifieritem ${statusnotifieritem_engine_SRCS}) -target_link_libraries(plasma_engine_statusnotifieritem KDE4::kdeui KDE4::plasma) - -install(TARGETS plasma_engine_statusnotifieritem DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) -install(FILES plasma_engine_statusnotifieritem.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) diff --git a/plasma/dataengines/statusnotifieritem/plasma_engine_statusnotifieritem.desktop b/plasma/dataengines/statusnotifieritem/plasma_engine_statusnotifieritem.desktop deleted file mode 100644 index 49bbcd83..00000000 --- a/plasma/dataengines/statusnotifieritem/plasma_engine_statusnotifieritem.desktop +++ /dev/null @@ -1,127 +0,0 @@ -[Desktop Entry] -Name=Status Notifier Information -Name[ar]=معلومات حالة النظام -Name[ast]=Información de notificación d'estáu -Name[bs]=Podaci izveštavača o stanju -Name[ca]=Informació del notificador d'estats -Name[ca@valencia]=Informació del notificador d'estats -Name[cs]=Informace o oznamovači stavu -Name[da]=Information om statusbekendtgørelse -Name[de]=Status-Informationen -Name[el]=Πληροφορίες για τις ειδοποιήσεις κατάστασης -Name[en_GB]=Status Notifier Information -Name[es]=Información de notificación de estado -Name[et]=Oleku märguandja teave -Name[eu]=Egoera-jakinarazleari buruzko informazioa -Name[fi]=Järjestelmäilmoittimen tiedot -Name[fr]=Informations sur le notificateur d'état -Name[gl]=Información do notificador do estado -Name[he]=מידע מ־Status Notifier -Name[hi]=तंत्र सूचक जानकारी -Name[hr]=Informacije glasnika stanja -Name[hu]=Állaportértesítési információk -Name[ia]=Informationes de notificator de stato -Name[id]=Informasi Notifikasi Status -Name[is]=Stöðutilkynningaþjónn -Name[it]=Informazioni sul notificatore di stato -Name[ja]=ステータス通知情報 -Name[kk]=Күй-жайы туралы құлақтандыру мәліметі -Name[km]=ព័ត៌មាន​កម្មវិធី​ជំនួន​ដំណឹង​ស្ថានភាព -Name[kn]=ಸ್ಥಿತಿ ಸೂಚನಾ ಮಾಹಿತಿ -Name[ko]=장치 알림이 정보 -Name[lt]=Būsenos pranešėjo informacija -Name[lv]=Statusa ziņotāja informācija -Name[mr]=स्थिती निदर्शक माहिती -Name[nb]=StatusNotifier-opplysninger -Name[nds]=Statusbescheed-Informatschonen -Name[nl]=Melding van statusinformatie -Name[pa]=ਹਾਲਤ ਨੋਟੀਫਾਇਰ ਜਾਣਕਾਰੀ -Name[pl]=Informacja o powiadomieniach stanu -Name[pt]=Informações do Item de Notificação do Estado -Name[pt_BR]=Informações do Notificador de Status -Name[ro]=Informații notificator de stare -Name[ru]=Сведения уведомлений о состоянии -Name[si]=තත්ව දැනුම්දෙන්නාගේ තොරතුරු -Name[sk]=Informácie o oznámení stavu -Name[sl]=Podatki obvestilnika o stanju -Name[sr]=Подаци извештавача о стању -Name[sr@ijekavian]=Подаци извјештавача о стању -Name[sr@ijekavianlatin]=Podaci izvještavača o stanju -Name[sr@latin]=Podaci izveštavača o stanju -Name[sv]=Information från statusunderrättelser -Name[th]=ข้อมูลการแจ้งสถานะ -Name[tr]=Durum Bildirici Bilgileri -Name[ug]=ھالەت بىلدۈرگۈ ئۇچۇرى -Name[uk]=Відомості сповіщення про стан -Name[wa]=Informåcion do notifieu d' sitatut -Name[x-test]=xxStatus Notifier Informationxx -Name[zh_CN]=状态通知信息 -Name[zh_TW]=狀態通知器資訊 -Comment=Engine for applications' status information, based on the Status Notifier protocol. -Comment[ar]=محرك للمعلومات عن حالة البرامج, مبني على بروتوكول Status Notifier -Comment[ast]=Motor pa informar del estáu d'aplicaciones, basáu nel protocolu Status Notifier. -Comment[bs]=Motor za podatke o stanju programa, na osnovu protokola izveštavača o stanju. -Comment[ca]=Motor d'informació d'estat de les aplicacions, basat en el protocol notificador d'estat. -Comment[ca@valencia]=Motor d'informació d'estat de les aplicacions, basat en el protocol notificador d'estat. -Comment[cs]=Stroj pro informace o stavu aplikací, založen na protokolu Status Notifier -Comment[da]=Motor til programmers statusinformation, baseret på protokollen til statusbekendtgørelser. -Comment[de]=Treiber für Anwendungs-Status-Informationen, basierend auf dem Status-Informations-Protokoll. -Comment[el]=Μηχανή για τις πληροφορίες κατάστασης της εφαρμογής, βασισμένη στο πρωτόκολλο ειδοποιήσεων κατάστασης. -Comment[en_GB]=Engine for applications' status information, based on the Status Notifier protocol. -Comment[es]=Motor para informar del estado de aplicaciones, basado en el protocolo Status Notifier. -Comment[et]=Rakenduse olekuteabe mootor Status Notifieri protokolli alusel. -Comment[eu]=Aplikazioen egoerari buruzko informazioa emateko motorra, egoera-jakinarazlearen protokoloan oinarritua. -Comment[fi]=Kone sovelusten tilatiedoille, perustuu tilailmoitinyhteyskäytäntöön. -Comment[fr]=Moteur d'informations sur l'état des applications utilisant le protocole de notification d'état. -Comment[gl]=Motor para información do estado dos programas, baseado no protocolo Status Notifier. -Comment[he]=מנוע עבור מידע אודות מצב של יישומים, המתבסס על הפרוטוקול של Status Notifier. -Comment[hr]=Mehanizam za statusne informacije aplikacija baziran na protokolu glasnika stanja. -Comment[hu]=Az állaporértesítés protokollon alapuló modul az alkalmazások állapotértesítési információihoz. -Comment[ia]=Motor pro information de stato de applicationes basate sur le protocollo de Notificator de Stato -Comment[id]=Mesin untuk informasi status aplikasi, berbasis protokol Notifikasi Status. -Comment[is]=Kerfi fyrir stöðuupplýsingar forrita, byggt á samskiptamáta stöðutilkynninga (Status Notifier protocol). -Comment[it]=Motore per le informazioni di stato delle applicazioni, basato sul protocollo del notificatore di stato. -Comment[ja]=ステータス通知プロトコルに基づくアプリケーションステータス情報エンジン -Comment[kk]=Күй-жайы туралы құлақтандыру (Status Notifier) протоколын негіздеген қолданбаларға арналған тетік. -Comment[km]=ម៉ាស៊ីន​សម្រាប់​ព័ត៌មាន​ស្ថានភាព​របស់​​កម្មវិធី ដែលមាន​មូលដ្ឋាន​លើ​ពិធីការ​កម្មវិធី​ជូនដំណឹង​ស្ថានភាព ។ -Comment[ko]=상태 알림 프로토콜을 사용하는 프로그램 상태 정보 엔진입니다. -Comment[lt]=Programų būsenos informacijos varikliukas, pagrįstas būsenos pranešėjo protokolu. -Comment[lv]=Programmas statusa informācijas dzinējs, kas ir bāzēts uz sistēmas paziņojumu protokolu. -Comment[mr]=अनुप्रयोग स्थिती माहिती साठी स्थिती निदर्शक शिष्टाचारावर आधारित इंजिन -Comment[nb]=Motor for programstatus-informasjon basert på Status Notifier-protokollen. -Comment[nds]=Karn för Programmstatus-Informatschonen, de dat Statusbescheed-Protokoll bruukt. -Comment[nl]=Engine voor statusinformatie van toepassingen gebaseerde op het statusnotificatieprotocol. -Comment[pa]=ਹਾਲਤ ਨੋਟੀਫਾਇਰ ਪਰੋਟੋਕਾਲ ਉੱਤੇ ਅਧਾਰਿਤ ਐਪਲੀਕੇਸ਼ਨ ਹਾਲਤ ਜਾਣਕਾਰੀ ਲਈ ਇੰਜਣ। -Comment[pl]=Silnik do przekazywania informacji o stanie programów, oparty o protokół powiadomień o stanie. -Comment[pt]=Motor para a informação do estado das aplicações, baseado no protocolo do Item de Notificação do Estado. -Comment[pt_BR]=Mecanismo para informação de status de aplicativos baseado no protocolo do Notificador de Status. -Comment[ro]=Motor pentru informațiile de stare ale aplicațiilor, bazat pe protocolul Notificator de Stare. -Comment[ru]=Движок данных о состоянии программ, основанный на протоколе уведомлений о состоянии. -Comment[si]=තත්ව දැනුම්දීම් නියමාවලිය මත පදනම් වූ යෙදුම්වල තත්ව තොරතුරු සඳහා එන්ජිම. -Comment[sk]=Nástroj pre informácie o stave aplikácie, založený na protokole o oznámení stavu. -Comment[sl]=Pogon za podatke o stanju programov, ki temelji na protokolu obvestilnika o stanju. -Comment[sr]=Мотор за податке о стању програма, на основу протокола извештавача о стању. -Comment[sr@ijekavian]=Мотор за податке о стању програма, на основу протокола извјештавача о стању. -Comment[sr@ijekavianlatin]=Motor za podatke o stanju programa, na osnovu protokola izvještavača o stanju. -Comment[sr@latin]=Motor za podatke o stanju programa, na osnovu protokola izveštavača o stanju. -Comment[sv]=Gränssnitt för statusinformation om program baserat på protokollet för statusunderrättelser. -Comment[th]=กลไกสำหรับข้อมูลสถานะแอพลิเคชัน โดยใช้โพรโทคอลตัวแจ้งสถานะ -Comment[tr]=Uygulamaların durum bilgisi için motor -Comment[ug]=ھالەت ئۇقتۇرۇش كېلىشىمى ئاساسىدا، پروگرامما ھالەت ئۇچۇرىغا ئېرىشىشتە ئىشلىتىلىدىغان ماتور. -Comment[uk]=Рушій даних щодо стану програм, заснований на протоколі сповіщення про стан. -Comment[vi]=Cơ chế cho thông tin trạng thái ứng dụng, dựa trên giao thức Trình thông báo trạng thái -Comment[wa]=Moteur po l' informacion so l' estat do programe, båzé sol protocole Status Notifier. -Comment[x-test]=xxEngine for applications' status information, based on the Status Notifier protocol.xx -Comment[zh_CN]=用于提供应用程序状态信息的引擎,急于状态通知协议。 -Comment[zh_TW]=基於狀態通知器協定的應用程式狀態資訊引擎。 -Icon=preferences-desktop-notification - -X-KDE-ServiceTypes=Plasma/DataEngine -Type=Service -X-KDE-Library=plasma_engine_statusnotifieritem -X-KDE-PluginInfo-Author=Matthieu Gallien -X-KDE-PluginInfo-Email=matthieu_gallien@yahoo.fr -X-KDE-PluginInfo-Name=statusnotifieritem -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp b/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp deleted file mode 100644 index f89a98c8..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * Copyright (C) 2009 Matthieu Gallien * - * * - * 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 "statusnotifieritem_engine.h" -#include "statusnotifieritemsource.h" - -#include -#include -#include -#include - -static const QString s_watcherServiceName("org.kde.StatusNotifierWatcher"); - -StatusNotifierItemEngine::StatusNotifierItemEngine(QObject *parent, const QVariantList& args) - : Plasma::DataEngine(parent, args), - m_statusNotifierWatcher(0) -{ - Q_UNUSED(args); -} - -StatusNotifierItemEngine::~StatusNotifierItemEngine() -{ - QDBusConnection::sessionBus().unregisterService(m_serviceName); -} - -Plasma::Service* StatusNotifierItemEngine::serviceForSource(const QString &name) -{ - StatusNotifierItemSource *source = qobject_cast(containerForSource(name)); - // if source does not exist, return null service - if (!source) { - return Plasma::DataEngine::serviceForSource(name); - } - - Plasma::Service *service = source->createService(); - service->setParent(this); - return service; -} - -void StatusNotifierItemEngine::init() -{ - if (QDBusConnection::sessionBus().isConnected()) { - m_serviceName = "org.kde.StatusNotifierHost-" + QString::number(QCoreApplication::applicationPid()); - QDBusConnection::sessionBus().registerService(m_serviceName); - - QDBusServiceWatcher *watcher = new QDBusServiceWatcher(s_watcherServiceName, QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForOwnerChange, this); - connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(serviceChange(QString,QString,QString))); - - registerWatcher(s_watcherServiceName); - } -} - -void StatusNotifierItemEngine::serviceChange(const QString& name, const QString& oldOwner, const QString& newOwner) -{ - kDebug()<< "Service" << name << "status change, old owner:" << oldOwner << "new:" << newOwner; - - if (newOwner.isEmpty()) { - //unregistered - unregisterWatcher(name); - } else if (oldOwner.isEmpty()) { - //registered - registerWatcher(name); - } -} - -void StatusNotifierItemEngine::registerWatcher(const QString& service) -{ - kDebug()<<"service appeared"<isValid() && - m_statusNotifierWatcher->property("ProtocolVersion").toBool() == s_protocolVersion) { - connect(m_statusNotifierWatcher, SIGNAL(StatusNotifierItemRegistered(QString)), this, SLOT(serviceRegistered(QString))); - connect(m_statusNotifierWatcher, SIGNAL(StatusNotifierItemUnregistered(QString)), this, SLOT(serviceUnregistered(QString))); - - m_statusNotifierWatcher->call(QDBus::NoBlock, "RegisterStatusNotifierHost", m_serviceName); - - QStringList registeredItems = m_statusNotifierWatcher->property("RegisteredStatusNotifierItems").value(); - foreach (const QString &service, registeredItems) { - newItem(service); - } - } else { - delete m_statusNotifierWatcher; - m_statusNotifierWatcher = 0; - kDebug()<<"System tray daemon not reachable"; - } - } -} - -void StatusNotifierItemEngine::unregisterWatcher(const QString& service) -{ - if (service == s_watcherServiceName) { - kDebug()<< s_watcherServiceName << "disappeared"; - - disconnect(m_statusNotifierWatcher, SIGNAL(StatusNotifierItemRegistered(QString)), this, SLOT(serviceRegistered(QString))); - disconnect(m_statusNotifierWatcher, SIGNAL(StatusNotifierItemUnregistered(QString)), this, SLOT(serviceUnregistered(QString))); - - removeAllSources(); - - delete m_statusNotifierWatcher; - m_statusNotifierWatcher = 0; - } -} - -void StatusNotifierItemEngine::serviceRegistered(const QString &service) -{ - kDebug() << "Registering"< * - * Copyright (C) 2009 Matthieu Gallien * - * * - * 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 STATUSNOTIFIERITEM_ENGINE_H -#define STATUSNOTIFIERITEM_ENGINE_H - -#include "statusnotifierwatcher_interface.h" -#include -#include -#include - -// Define our plasma Runner -class StatusNotifierItemEngine : public Plasma::DataEngine { - Q_OBJECT - -public: - // Basic Create/Destroy - StatusNotifierItemEngine( QObject *parent, const QVariantList& args ); - ~StatusNotifierItemEngine(); - Plasma::Service *serviceForSource(const QString &name); -protected: - - virtual void init(); - void newItem(const QString &service); - -protected Q_SLOTS: - void serviceChange(const QString& name, - const QString& oldOwner, - const QString& newOwner); - void registerWatcher(const QString& service); - void unregisterWatcher(const QString& service); - void serviceRegistered(const QString &service); - void serviceUnregistered(const QString &service); - -private: - org::kde::StatusNotifierWatcher *m_statusNotifierWatcher; - QString m_serviceName; - static const int s_protocolVersion = 0; -}; - -#endif diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritemjob.cpp b/plasma/dataengines/statusnotifieritem/statusnotifieritemjob.cpp deleted file mode 100644 index adf12aba..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritemjob.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2008 Alain Boyer - * Copyright (C) 2009 Matthieu Gallien - * - * This program 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 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 Library 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 "statusnotifieritemjob.h" -#include - -StatusNotifierItemJob::StatusNotifierItemJob(StatusNotifierItemSource *source, const QString &operation, const QMap ¶meters, QObject *parent) : - ServiceJob(source->objectName(), operation, parameters, parent), - m_source(source) -{ - connect(source, SIGNAL(contextMenuReady(QMenu*)), this, SLOT(contextMenuReady(QMenu*))); -} - -StatusNotifierItemJob::~StatusNotifierItemJob() -{ -} - -void StatusNotifierItemJob::start() -{ - if (operationName() == QString::fromLatin1("Activate")) { - m_source->activate(parameters()["x"].toInt(), parameters()["y"].toInt()); - setResult(0); - } else if (operationName() == QString::fromLatin1("SecondaryActivate")) { - m_source->secondaryActivate(parameters()["x"].toInt(), parameters()["y"].toInt()); - setResult(0); - } else if (operationName() == QString::fromLatin1("ContextMenu")) { - m_source->contextMenu(parameters()["x"].toInt(), parameters()["y"].toInt()); - } else if (operationName() == QString::fromLatin1("Scroll")) { - m_source->scroll(parameters()["delta"].toInt(), parameters()["direction"].toString()); - setResult(0); - } -} - -void StatusNotifierItemJob::contextMenuReady(QMenu *menu) -{ - if (operationName() == QString::fromLatin1("ContextMenu")) { - setResult(qVariantFromValue((QObject*)menu)); - } -} - -#include "moc_statusnotifieritemjob.cpp" diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritemjob.h b/plasma/dataengines/statusnotifieritem/statusnotifieritemjob.h deleted file mode 100644 index 2c135493..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritemjob.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008 Alain Boyer - * Copyright (C) 2009 Matthieu Gallien - * - * This program 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 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 Library 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 STATUSNOTIFIERITEMJOB_H -#define STATUSNOTIFIERITEMJOB_H - -// own -#include "statusnotifieritemsource.h" - -// plasma -#include - -/** - * Task Job - */ -class StatusNotifierItemJob : public Plasma::ServiceJob -{ - Q_OBJECT - -public: - StatusNotifierItemJob(StatusNotifierItemSource *source, const QString &operation, const QMap ¶meters, QObject *parent = NULL); - ~StatusNotifierItemJob(); - -protected: - void start(); - -private Q_SLOTS: - void contextMenuReady(QMenu *menu); - -private: - StatusNotifierItemSource *m_source; - -}; - -#endif // STATUSNOTIFIERITEMJOB_H diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritemservice.cpp b/plasma/dataengines/statusnotifieritem/statusnotifieritemservice.cpp deleted file mode 100644 index 37c39be6..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritemservice.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008 Alain Boyer - * Copyright (C) 2009 Matthieu Gallien - * - * This program 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 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 Library 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 "statusnotifieritemservice.h" - -// own -#include "statusnotifieritemjob.h" - -StatusNotifierItemService::StatusNotifierItemService(StatusNotifierItemSource *source) : - Plasma::Service(source), - m_source(source) -{ - setName("statusnotifieritem"); - setOperationNames( - QStringList() - << "Activate" - << "SecondaryActivate" - << "Scroll" - << "ContextMenu" - ); -} - -StatusNotifierItemService::~StatusNotifierItemService() -{ -} - -Plasma::ServiceJob* StatusNotifierItemService::createJob(const QString &operation, const QMap ¶meters) -{ - return new StatusNotifierItemJob(m_source, operation, parameters, this); -} - -#include "moc_statusnotifieritemservice.cpp" diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritemservice.h b/plasma/dataengines/statusnotifieritem/statusnotifieritemservice.h deleted file mode 100644 index 54e6f9c5..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritemservice.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008 Alain Boyer - * Copyright (C) 2009 Matthieu Gallien - * - * This program 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 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 Library 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 STATUSNOTIFIERITEMSERVICE_H -#define STATUSNOTIFIERITEMSERVICE_H - -// own -#include "statusnotifieritemsource.h" - -// plasma -#include -#include - -/** - * StatusNotifierItem Service - */ -class StatusNotifierItemService : public Plasma::Service -{ - - Q_OBJECT - - public: - StatusNotifierItemService(StatusNotifierItemSource *source); - ~StatusNotifierItemService(); - - protected: - Plasma::ServiceJob *createJob(const QString &operation, const QMap ¶meters); - - private: - StatusNotifierItemSource *m_source; -}; - -#endif // STATUSNOTIFIERITEMSERVICE_H diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.cpp b/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.cpp deleted file mode 100644 index 12b2fda5..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.cpp +++ /dev/null @@ -1,460 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * Copyright (C) 2009 Matthieu Gallien * - * * - * 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 "statusnotifieritemsource.h" -#include "systemtraytypes.h" -#include "statusnotifieritemservice.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class PlasmaDBusMenuImporter : public KDBusMenuImporter -{ -public: - PlasmaDBusMenuImporter(const QString &service, const QString &path, KIconLoader *iconLoader, QObject *parent) - : KDBusMenuImporter(service, path, parent) - , m_iconLoader(iconLoader) - {} - -protected: - virtual QIcon iconForName(const QString &name) - { - return KIcon(name, m_iconLoader); - } - -private: - KIconLoader *m_iconLoader; -}; - -StatusNotifierItemSource::StatusNotifierItemSource(const QString ¬ifierItemId, QObject *parent) - : Plasma::DataContainer(parent), - m_customIconLoader(0), - m_menuImporter(0), - m_refreshing(false), - m_needsReRefreshing(false), - m_titleUpdate(true), - m_iconUpdate(true), - m_tooltipUpdate(true), - m_statusUpdate(true) -{ - setObjectName(notifierItemId); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - m_typeId = notifierItemId; - m_name = notifierItemId; - - int slash = notifierItemId.indexOf('/'); - if (slash == -1) { - kError() << "Invalid notifierItemId:" << notifierItemId; - m_valid = false; - m_statusNotifierItemInterface = 0; - return; - } - QString service = notifierItemId.left(slash); - QString path = notifierItemId.mid(slash); - - m_statusNotifierItemInterface = new org::kde::StatusNotifierItem(service, path, - QDBusConnection::sessionBus(), this); - - m_refreshTimer.setSingleShot(true); - m_refreshTimer.setInterval(10); - connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(performRefresh())); - - m_valid = !service.isEmpty() && m_statusNotifierItemInterface->isValid(); - if (m_valid) { - connect(m_statusNotifierItemInterface, SIGNAL(NewTitle()), this, SLOT(refreshTitle())); - connect(m_statusNotifierItemInterface, SIGNAL(NewIcon()), this, SLOT(refreshIcons())); - connect(m_statusNotifierItemInterface, SIGNAL(NewAttentionIcon()), this, SLOT(refreshIcons())); - connect(m_statusNotifierItemInterface, SIGNAL(NewOverlayIcon()), this, SLOT(refreshIcons())); - connect(m_statusNotifierItemInterface, SIGNAL(NewToolTip()), this, SLOT(refreshToolTip())); - connect(m_statusNotifierItemInterface, SIGNAL(NewStatus(QString)), this, SLOT(syncStatus(QString))); - refresh(); - } -} - -StatusNotifierItemSource::~StatusNotifierItemSource() -{ - delete m_statusNotifierItemInterface; -} - -KIconLoader *StatusNotifierItemSource::iconLoader() const -{ - return m_customIconLoader ? m_customIconLoader : KIconLoader::global(); -} - -Plasma::Service *StatusNotifierItemSource::createService() -{ - return new StatusNotifierItemService(this); -} - -void StatusNotifierItemSource::syncStatus(QString status) -{ - setData("TitleChanged", false); - setData("IconsChanged", false); - setData("TooltipChanged", false); - setData("StatusChanged", true); - setData("Status", status); - checkForUpdate(); -} - -void StatusNotifierItemSource::refreshTitle() -{ - m_titleUpdate = true; - refresh(); -} - -void StatusNotifierItemSource::refreshIcons() -{ - m_iconUpdate = true; - refresh(); -} - -void StatusNotifierItemSource::refreshToolTip() -{ - m_tooltipUpdate = true; - refresh(); -} - -void StatusNotifierItemSource::refresh() -{ - if (!m_refreshTimer.isActive()) { - m_refreshTimer.start(); - } -} - -void StatusNotifierItemSource::performRefresh() -{ - if (m_refreshing) { - m_needsReRefreshing = true; - return; - } - - m_refreshing = true; - QDBusMessage message = QDBusMessage::createMethodCall(m_statusNotifierItemInterface->service(), - m_statusNotifierItemInterface->path(), "org.freedesktop.DBus.Properties", "GetAll"); - - message << m_statusNotifierItemInterface->interface(); - QDBusPendingCall call = m_statusNotifierItemInterface->connection().asyncCall(message); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(refreshCallback(QDBusPendingCallWatcher*))); -} - -/** - \todo add a smart pointer to guard call and to automatically delete it at the end of the function - */ -void StatusNotifierItemSource::refreshCallback(QDBusPendingCallWatcher *call) -{ - m_refreshing = false; - if (m_needsReRefreshing) { - m_needsReRefreshing = false; - performRefresh(); - call->deleteLater(); - return; - } - - QDBusPendingReply reply = *call; - if (reply.isError()) { - m_valid = false; - } else { - // record what has changed - setData("TitleChanged", m_titleUpdate); - m_titleUpdate = false; - setData("IconsChanged", m_iconUpdate); - m_iconUpdate = false; - setData("ToolTipChanged", m_tooltipUpdate); - m_tooltipUpdate = false; - setData("StatusChanged", m_statusUpdate); - m_statusUpdate = false; - - //IconThemePath (handle this one first, because it has an impact on - //others) - QVariantMap properties = reply.argumentAt<0>(); - if (!m_customIconLoader) { - QString path = properties["IconThemePath"].toString(); - if (!path.isEmpty()) { - QStringList tokens = path.split('/', QString::SkipEmptyParts); - if (tokens.length() >= 3) { - QString appName = tokens.takeLast(); - QString prefix = '/' + tokens.join("/"); - // FIXME: Fix KIconLoader and KIconTheme so that we can use - // our own instance of KStandardDirs - KGlobal::dirs()->addResourceDir("data", prefix); - // We use a separate instance of KIconLoader to avoid - // adding all application dirs to KIconLoader::global(), to - // avoid potential icon name clashes between application - // icons - m_customIconLoader = new KIconLoader(appName, 0 /* dirs */, this); - } else { - kWarning() << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'"; - } - } - } - setData("IconThemePath", properties["IconThemePath"]); - - setData("Category", properties["Category"]); - setData("Status", properties["Status"]); - setData("Title", properties["Title"]); - setData("Id", properties["Id"]); - setData("WindowId", properties["WindowId"]); - setData("ItemIsMenu", properties["ItemIsMenu"]); - - QIcon overlay; - QStringList overlayNames; - - //Icon - { - KDbusImageVector image; - QIcon icon; - QString iconName; - - QDBusArgument argumentValue = properties["OverlayIconPixmap"].value(); - if (argumentValue.currentType() != QDBusArgument::UnknownType) { - argumentValue >> image; - } - if (image.isEmpty()) { - QString iconName = properties["OverlayIconName"].toString(); - setData("OverlayIconName", iconName); - if (!iconName.isEmpty()) { - overlayNames << iconName; - overlay = KIcon(iconName, iconLoader()); - } - } else { - overlay = imageVectorToPixmap(image); - } - - argumentValue = properties["IconPixmap"].value(); - if (argumentValue.currentType() != QDBusArgument::UnknownType) { - argumentValue >> image; - } - if (image.isEmpty()) { - iconName = properties["IconName"].toString(); - if (!iconName.isEmpty()) { - icon = KIcon(iconName, iconLoader(), overlayNames); - - if (overlayNames.isEmpty() && !overlay.isNull()) { - overlayIcon(&icon, &overlay); - } - } - } else { - icon = imageVectorToPixmap(image); - if (!icon.isNull() && !overlay.isNull()) { - overlayIcon(&icon, &overlay); - } - } - setData("Icon", icon); - setData("IconName", iconName); - } - - //Attention icon - { - KDbusImageVector image; - QIcon attentionIcon; - - QDBusArgument argumentValue = properties["AttentionIconPixmap"].value(); - if (argumentValue.currentType() != QDBusArgument::UnknownType) { - argumentValue >> image; - } - if (image.isEmpty()) { - QString iconName = properties["AttentionIconName"].toString(); - setData("AttentionIconName", iconName); - if (!iconName.isEmpty()) { - attentionIcon = KIcon(iconName, iconLoader(), overlayNames); - - if (overlayNames.isEmpty() && !overlay.isNull()) { - overlayIcon(&attentionIcon, &overlay); - } - } - } else { - attentionIcon = imageVectorToPixmap(image); - if (!attentionIcon.isNull() && !overlay.isNull()) { - overlayIcon(&attentionIcon, &overlay); - } - } - setData("AttentionIcon", attentionIcon); - } - - //ToolTip - { - KDbusToolTipStruct toolTip; - QDBusArgument argumentValue = properties["ToolTip"].value(); - if (argumentValue.currentType() != QDBusArgument::UnknownType) { - argumentValue >> toolTip; - } - if (toolTip.title.isEmpty()) { - setData("ToolTipTitle", QVariant()); - setData("ToolTipSubTitle", QVariant()); - setData("ToolTipIcon", QVariant()); - } else { - QIcon toolTipIcon; - if (toolTip.image.size() == 0) { - toolTipIcon = KIcon(toolTip.icon, iconLoader()); - } else { - toolTipIcon = imageVectorToPixmap(toolTip.image); - } - setData("ToolTipTitle", toolTip.title); - setData("ToolTipSubTitle", toolTip.subTitle); - setData("ToolTipIcon", toolTipIcon); - } - } - - //Menu - if (!m_menuImporter) { - QString menuObjectPath = properties["Menu"].value().path(); - if (!menuObjectPath.isEmpty()) { - if (menuObjectPath == "/NO_DBUSMENU") { - // This is a hack to make it possible to disable DBusMenu in an - // application. The string "/NO_DBUSMENU" must be the same as in - // KStatusNotifierItem::setContextMenu(). - kWarning() << "DBusMenu disabled for this application"; - } else { - m_menuImporter = new PlasmaDBusMenuImporter(m_statusNotifierItemInterface->service(), menuObjectPath, iconLoader(), this); - connect(m_menuImporter, SIGNAL(menuUpdated()), this, SLOT(contextMenuReady())); - } - } - } - } - - checkForUpdate(); - call->deleteLater(); -} - -void StatusNotifierItemSource::contextMenuReady() -{ - emit contextMenuReady(m_menuImporter->menu()); -} - -QPixmap StatusNotifierItemSource::KDbusImageStructToPixmap(const KDbusImageStruct &image) const -{ - QImage iconImage(image.width, image.height, QImage::Format_ARGB32 ); - memcpy(iconImage.bits(), (uchar*)image.data.data(), iconImage.byteCount()); - - return QPixmap::fromImage(iconImage); -} - -QIcon StatusNotifierItemSource::imageVectorToPixmap(const KDbusImageVector &vector) const -{ - QIcon icon; - - for (int i = 0; ipixmap(KIconLoader::SizeSmall, KIconLoader::SizeSmall); - - QPainter p(&m_iconPixmap); - - const int size = KIconLoader::SizeSmall/2; - p.drawPixmap(QRect(size, size, size, size), overlay->pixmap(size, size), QRect(0,0,size,size)); - p.end(); - tmp.addPixmap(m_iconPixmap); - - //if an m_icon exactly that size wasn't found don't add it to the vector - m_iconPixmap = icon->pixmap(KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium); - if (m_iconPixmap.width() == KIconLoader::SizeSmallMedium) { - const int size = KIconLoader::SizeSmall/2; - QPainter p(&m_iconPixmap); - p.drawPixmap(QRect(m_iconPixmap.width()-size, m_iconPixmap.height()-size, size, size), overlay->pixmap(size, size), QRect(0,0,size,size)); - p.end(); - tmp.addPixmap(m_iconPixmap); - } - - m_iconPixmap = icon->pixmap(KIconLoader::SizeMedium, KIconLoader::SizeMedium); - if (m_iconPixmap.width() == KIconLoader::SizeMedium) { - const int size = KIconLoader::SizeSmall/2; - QPainter p(&m_iconPixmap); - p.drawPixmap(QRect(m_iconPixmap.width()-size, m_iconPixmap.height()-size, size, size), overlay->pixmap(size, size), QRect(0,0,size,size)); - p.end(); - tmp.addPixmap(m_iconPixmap); - } - - m_iconPixmap = icon->pixmap(KIconLoader::SizeLarge, KIconLoader::SizeLarge); - if (m_iconPixmap.width() == KIconLoader::SizeLarge) { - const int size = KIconLoader::SizeSmall; - QPainter p(&m_iconPixmap); - p.drawPixmap(QRect(m_iconPixmap.width()-size, m_iconPixmap.height()-size, size, size), overlay->pixmap(size, size), QRect(0,0,size,size)); - p.end(); - tmp.addPixmap(m_iconPixmap); - } - - // We can't do 'm_icon->addPixmap()' because if 'm_icon' uses KIconEngine, - // it will ignore the added pixmaps. This is not a bug in KIconEngine, - // QIcon::addPixmap() doc says: "Custom m_icon engines are free to ignore - // additionally added pixmaps". - *icon = tmp; - //hopefully huge and enormous not necessary right now, since it's quite costly -} - -void StatusNotifierItemSource::activate(int x, int y) -{ - if (m_statusNotifierItemInterface && m_statusNotifierItemInterface->isValid()) { - m_statusNotifierItemInterface->call(QDBus::NoBlock, "Activate", x, y); - } -} - -void StatusNotifierItemSource::secondaryActivate(int x, int y) -{ - if (m_statusNotifierItemInterface && m_statusNotifierItemInterface->isValid()) { - m_statusNotifierItemInterface->call(QDBus::NoBlock, "SecondaryActivate", x, y); - } -} - -void StatusNotifierItemSource::scroll(int delta, const QString &direction) -{ - if (m_statusNotifierItemInterface && m_statusNotifierItemInterface->isValid()) { - m_statusNotifierItemInterface->call(QDBus::NoBlock, "Scroll", delta, direction); - } -} - -void StatusNotifierItemSource::contextMenu(int x, int y) -{ - if (m_menuImporter) { - m_menuImporter->updateMenu(); - } else { - kWarning() << "Could not find DBusMenu interface, falling back to calling ContextMenu()"; - if (m_statusNotifierItemInterface && m_statusNotifierItemInterface->isValid()) { - m_statusNotifierItemInterface->call(QDBus::NoBlock, "ContextMenu", x, y); - } - } -} - -#include "moc_statusnotifieritemsource.cpp" diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.h b/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.h deleted file mode 100644 index 5928282e..00000000 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * Copyright (C) 2009 Matthieu Gallien * - * * - * 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 STATUSNOTIFIERITEMSOURCE_H -#define STATUSNOTIFIERITEMSOURCE_H - -#include -#include -#include - -#include "statusnotifieritem_interface.h" - -class KIconLoader; -class KDBusMenuImporter; - -class StatusNotifierItemSource : public Plasma::DataContainer -{ - - Q_OBJECT - -public: - StatusNotifierItemSource(const QString &service, QObject *parent); - ~StatusNotifierItemSource(); - Plasma::Service *createService(); - - void activate(int x, int y); - void secondaryActivate(int x, int y); - void scroll(int delta, const QString &direction); - void contextMenu(int x, int y); - -Q_SIGNALS: - void contextMenuReady(QMenu *menu); - -private slots: - void contextMenuReady(); - void refreshTitle(); - void refreshIcons(); - void refreshToolTip(); - void refresh(); - void performRefresh(); - void syncStatus(QString); - void refreshCallback(QDBusPendingCallWatcher *); - -private: - - QPixmap KDbusImageStructToPixmap(const KDbusImageStruct &image) const; - QIcon imageVectorToPixmap(const KDbusImageVector &vector) const; - void overlayIcon(QIcon *icon, QIcon *overlay); - KIconLoader *iconLoader() const; - - bool m_valid; - QString m_typeId; - QString m_name; - QTimer m_refreshTimer; - KIconLoader *m_customIconLoader; - KDBusMenuImporter *m_menuImporter; - org::kde::StatusNotifierItem *m_statusNotifierItemInterface; - bool m_refreshing : 1; - bool m_needsReRefreshing : 1; - bool m_titleUpdate : 1; - bool m_iconUpdate : 1; - bool m_tooltipUpdate : 1; - bool m_statusUpdate : 1; -}; - -#endif // STATUSNOTIFIERITEMSOURCE_H diff --git a/plasma/dataengines/statusnotifieritem/systemtraytypes.cpp b/plasma/dataengines/statusnotifieritem/systemtraytypes.cpp deleted file mode 100644 index dab7f949..00000000 --- a/plasma/dataengines/statusnotifieritem/systemtraytypes.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * * - * 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 "systemtraytypes.h" - - -// Marshall the ImageStruct data into a D-BUS argument -const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusImageStruct &icon) -{ - argument.beginStructure(); - argument << icon.width; - argument << icon.height; - argument << icon.data; - argument.endStructure(); - return argument; -} -#include - -// Retrieve the ImageStruct data from the D-BUS argument -const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusImageStruct &icon) -{ - qint32 width = 0; - qint32 height = 0; - QByteArray data; - - if (argument.currentType() == QDBusArgument::StructureType) { - argument.beginStructure(); - //kDebug() << "begun structure"; - argument >> width; - //kDebug() << width; - argument >> height; - //kDebug() << height; - argument >> data; - //kDebug() << data.size(); - argument.endStructure(); - } - - icon.width = width; - icon.height = height; - icon.data = data; - - return argument; -} - -// Marshall the ImageVector data into a D-BUS argument -const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusImageVector &iconVector) -{ - argument.beginArray(qMetaTypeId()); - for (int i=0; i>(const QDBusArgument &argument, KDbusImageVector &iconVector) -{ - iconVector.clear(); - - if (argument.currentType() == QDBusArgument::ArrayType) { - argument.beginArray(); - - while (!argument.atEnd()) { - KDbusImageStruct element; - argument >> element; - iconVector.append(element); - } - - argument.endArray(); - } - - return argument; -} - -// Marshall the ToolTipStruct data into a D-BUS argument -const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusToolTipStruct &toolTip) -{ - argument.beginStructure(); - argument << toolTip.icon; - argument << toolTip.image; - argument << toolTip.title; - argument << toolTip.subTitle; - argument.endStructure(); - - return argument; -} - -// Retrieve the ToolTipStruct data from the D-BUS argument -const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusToolTipStruct &toolTip) -{ - QString icon; - KDbusImageVector image; - QString title; - QString subTitle; - - if (argument.currentType() == QDBusArgument::StructureType) { - argument.beginStructure(); - argument >> icon; - argument >> image; - argument >> title; - argument >> subTitle; - argument.endStructure(); - } - - toolTip.icon = icon; - toolTip.image = image; - toolTip.title = title; - toolTip.subTitle = subTitle; - - return argument; -} diff --git a/plasma/dataengines/statusnotifieritem/systemtraytypes.h b/plasma/dataengines/statusnotifieritem/systemtraytypes.h deleted file mode 100644 index 95a77257..00000000 --- a/plasma/dataengines/statusnotifieritem/systemtraytypes.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * * - * 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 SYSTEMTRAYTYPES_H -#define SYSTEMTRAYTYPES_H - -#include - -#include "systemtraytypedefs.h" - -const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusImageStruct &icon); -const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusImageStruct &icon); - - -const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusImageVector &iconVector); -const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusImageVector &iconVector); - -const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusToolTipStruct &toolTip); -const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusToolTipStruct &toolTip); - - -#endif diff --git a/plasma/declarativeimports/CMakeLists.txt b/plasma/declarativeimports/CMakeLists.txt deleted file mode 100644 index 4449fa50..00000000 --- a/plasma/declarativeimports/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(core) -add_subdirectory(qtextracomponents) -add_subdirectory(plasmacomponents) diff --git a/plasma/declarativeimports/core/CMakeLists.txt b/plasma/declarativeimports/core/CMakeLists.txt deleted file mode 100644 index 20f47ccd..00000000 --- a/plasma/declarativeimports/core/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -project(corebindings) - -set(corebindings_SRCS - declarativeitemcontainer.cpp - corebindingsplugin.cpp - theme.cpp - svgitem.cpp - framesvgitem.cpp - dialog.cpp - tooltip.cpp - iconitem.cpp -) - -include_directories( - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} - ${KDECLARATIVE_INCLUDE_DIR} -) - -add_library(corebindingsplugin SHARED ${corebindings_SRCS}) -target_link_libraries(corebindingsplugin - KDE4::plasma - KDE4::kdeclarative - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} -) - -install( - TARGETS corebindingsplugin - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/plasma/core -) - -install( - FILES qmldir - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/plasma/core -) diff --git a/plasma/declarativeimports/core/corebindingsplugin.cpp b/plasma/declarativeimports/core/corebindingsplugin.cpp deleted file mode 100644 index 078952ac..00000000 --- a/plasma/declarativeimports/core/corebindingsplugin.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - * Copyright 2010 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "corebindingsplugin.h" - -#include -#include -#include - -#include - -#include -#include -#include - -#include "framesvgitem.h" -#include "svgitem.h" -#include "theme.h" -#include "dialog.h" -#include "iconitem.h" -#include "tooltip.h" - -void CoreBindingsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) -{ - QDeclarativeExtensionPlugin::initializeEngine(engine, uri); - - QDeclarativeContext *context = engine->rootContext(); - - ThemeProxy *theme = new ThemeProxy(context); - context->setContextProperty("theme", theme); - - KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(engine); - kdeclarative.initialize(); - QScriptEngine *scriptEngine = kdeclarative.scriptEngine(); - - //inject the hack only if wasn't injected already - if (!scriptEngine->globalObject().property("i18n").isValid()) { - //binds things like kconfig and icons - kdeclarative.setupBindings(); - } -} - -void CoreBindingsPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.core")); - - qmlRegisterType(uri, 0, 1, "Svg"); - qmlRegisterType(uri, 0, 1, "FrameSvg"); - qmlRegisterType(uri, 0, 1, "SvgItem"); - qmlRegisterType(uri, 0, 1, "FrameSvgItem"); - - qmlRegisterType(uri, 0, 1, "Theme"); - - qmlRegisterType(uri, 0, 1, "Dialog"); - qmlRegisterType(uri, 0, 1, "ToolTip"); - - qmlRegisterType(); - qmlRegisterType(uri, 0, 1, "IconItem"); -} - - -#include "moc_corebindingsplugin.cpp" - diff --git a/plasma/declarativeimports/core/corebindingsplugin.h b/plasma/declarativeimports/core/corebindingsplugin.h deleted file mode 100644 index 8d87bdf9..00000000 --- a/plasma/declarativeimports/core/corebindingsplugin.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - * Copyright 2010 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 COREBINDINGSPLUGIN_H -#define COREBINDINGSPLUGIN_H - -#include -#include - -#include - -class CoreBindingsPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - void initializeEngine(QDeclarativeEngine *engine, const char *uri); - void registerTypes(const char *uri); -}; - -Q_EXPORT_PLUGIN(CoreBindingsPlugin) - -#endif diff --git a/plasma/declarativeimports/core/declarativeitemcontainer.cpp b/plasma/declarativeimports/core/declarativeitemcontainer.cpp deleted file mode 100644 index abf80959..00000000 --- a/plasma/declarativeimports/core/declarativeitemcontainer.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "declarativeitemcontainer_p.h" - -#include - -DeclarativeItemContainer::DeclarativeItemContainer(QGraphicsItem *parent) - : QGraphicsWidget(parent) -{ -} - -DeclarativeItemContainer::~DeclarativeItemContainer() -{ -} - -void DeclarativeItemContainer::setDeclarativeItem(QDeclarativeItem *item, bool reparent) -{ - if (m_declarativeItem) { - disconnect(m_declarativeItem.data(), 0, this, 0); - } - - setMinimumWidth(item->implicitWidth()); - setMinimumHeight(item->implicitHeight()); - - resize(item->width(), item->height()); - - m_declarativeItem = item; - if (reparent) { - static_cast(item)->setParentItem(this); - } - - connect(m_declarativeItem.data(), SIGNAL(widthChanged()), this, SLOT(widthChanged())); - connect(m_declarativeItem.data(), SIGNAL(heightChanged()), this, SLOT(heightChanged())); - - qreal minimumWidth = -1; - qreal minimumHeight = -1; - qreal maximumWidth = -1; - qreal maximumHeight = -1; - qreal preferredWidth = -1; - qreal preferredHeight = -1; - - - if (item->metaObject()->indexOfProperty("minimumWidth") >= 0 ) { - minimumWidth = item->property("minimumWidth").toReal(); - QObject::connect(item, SIGNAL(minimumWidthChanged()), this, SLOT(minimumWidthChanged())); - } - - if (item->metaObject()->indexOfProperty("minimumHeight") >= 0 ) { - minimumHeight = item->property("minimumHeight").toReal(); - QObject::connect(item, SIGNAL(minimumHeightChanged()), this, SLOT(minimumHeightChanged())); - } - - if (item->metaObject()->indexOfProperty("maximumWidth") >= 0 ) { - maximumWidth = item->property("maximumWidth").toReal(); - QObject::connect(item, SIGNAL(maximumWidthChanged()), this, SLOT(maximumWidthChanged())); - } - - if (item->metaObject()->indexOfProperty("maximumHeight") >= 0 ) { - maximumHeight = item->property("maximumHeight").toReal(); - QObject::connect(item, SIGNAL(maximumHeightChanged()), this, SLOT(maximumHeightChanged())); - } - - if (item->metaObject()->indexOfProperty("preferredWidth") >= 0 ) { - preferredWidth = item->property("preferredWidth").toReal(); - QObject::connect(item, SIGNAL(preferredWidthChanged()), this, SLOT(preferredWidthChanged())); - } - - if (item->metaObject()->indexOfProperty("preferredHeight") >= 0 ) { - preferredHeight = item->property("preferredHeight").toReal(); - QObject::connect(item, SIGNAL(preferredHeightChanged()), this, SLOT(preferredHeightChanged())); - } - - if (minimumWidth > 0 && minimumHeight > 0) { - setMinimumSize(minimumWidth, minimumHeight); - } else { - setMinimumSize(-1, -1); - } - - if (maximumWidth > 0 && maximumHeight > 0) { - setMaximumSize(maximumWidth, maximumHeight); - } else { - setMaximumSize(-1, -1); - } - - if (preferredWidth > 0 && preferredHeight > 0) { - setPreferredSize(preferredWidth, preferredHeight); - } else { - setPreferredSize(-1, -1); - } -} - -QDeclarativeItem *DeclarativeItemContainer::declarativeItem() const -{ - return m_declarativeItem.data(); -} - -void DeclarativeItemContainer::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - if (m_declarativeItem) { - m_declarativeItem.data()->setProperty("width", event->newSize().width()); - m_declarativeItem.data()->setProperty("height", event->newSize().height()); - } -} - -void DeclarativeItemContainer::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - event->ignore(); -} - -void DeclarativeItemContainer::widthChanged() -{ - if (!m_declarativeItem) { - return; - } - - QSizeF newSize(size()); - newSize.setWidth(m_declarativeItem.data()->width()); - resize(newSize); -} - -void DeclarativeItemContainer::heightChanged() -{ - if (!m_declarativeItem) { - return; - } - - QSizeF newSize(size()); - newSize.setHeight(m_declarativeItem.data()->height()); - resize(newSize); -} - - -void DeclarativeItemContainer::minimumWidthChanged() -{ - qreal minimumWidth = m_declarativeItem.data()->property("minimumWidth").toReal(); - setMinimumWidth(minimumWidth); -} - -void DeclarativeItemContainer::minimumHeightChanged() -{ - qreal minimumHeight = m_declarativeItem.data()->property("minimumHeight").toReal(); - setMinimumHeight(minimumHeight); -} - -void DeclarativeItemContainer::maximumWidthChanged() -{ - qreal maximumWidth = m_declarativeItem.data()->property("maximumWidth").toReal(); - setMaximumWidth(maximumWidth); -} - -void DeclarativeItemContainer::maximumHeightChanged() -{ - qreal maximumHeight = m_declarativeItem.data()->property("maximumHeight").toReal(); - setMaximumHeight(maximumHeight); -} - -void DeclarativeItemContainer::preferredWidthChanged() -{ - qreal preferredWidth = m_declarativeItem.data()->property("preferredWidth").toReal(); - setPreferredWidth(preferredWidth); -} - -void DeclarativeItemContainer::preferredHeightChanged() -{ - qreal preferredHeight = m_declarativeItem.data()->property("preferredHeight").toReal(); - setPreferredHeight(preferredHeight); -} - -#include "moc_declarativeitemcontainer_p.cpp" diff --git a/plasma/declarativeimports/core/declarativeitemcontainer_p.h b/plasma/declarativeimports/core/declarativeitemcontainer_p.h deleted file mode 100644 index 53d837f0..00000000 --- a/plasma/declarativeimports/core/declarativeitemcontainer_p.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 DECLARATIVEITEMCONTAINER_P -#define DECLARATIVEITEMCONTAINER_P - -#include -#include -#include -#include - - -class DeclarativeItemContainer : public QGraphicsWidget -{ - Q_OBJECT - -public: - DeclarativeItemContainer(QGraphicsItem *parent = 0); - ~DeclarativeItemContainer(); - - void setDeclarativeItem(QDeclarativeItem *item, bool reparent = true); - QDeclarativeItem *declarativeItem() const; - -protected: - void resizeEvent(QGraphicsSceneResizeEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - -protected Q_SLOTS: - void widthChanged(); - void heightChanged(); - - void minimumWidthChanged(); - void minimumHeightChanged(); - void maximumWidthChanged(); - void maximumHeightChanged(); - void preferredWidthChanged(); - void preferredHeightChanged(); - -private: - QWeakPointer m_declarativeItem; -}; - -#endif diff --git a/plasma/declarativeimports/core/dialog.cpp b/plasma/declarativeimports/core/dialog.cpp deleted file mode 100644 index bd5ae708..00000000 --- a/plasma/declarativeimports/core/dialog.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "dialog.h" -#include "declarativeitemcontainer_p.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - - -int DialogProxy::offscreenX = 0; -int DialogProxy::offscreenY = 0; - -DialogMargins::DialogMargins(Plasma::Dialog *dialog, QObject *parent) - : QObject(parent), - m_left(0), m_top(0), m_right(0), m_bottom(0), - m_dialog(dialog) -{ - checkMargins(); -} - -void DialogMargins::checkMargins() -{ - int left, top, right, bottom; - m_dialog->getContentsMargins(&left, &top, &right, &bottom); - - if (left != m_left) { - m_left = left; - emit leftChanged(); - } - if (top != m_top) { - m_top = top; - emit topChanged(); - } - if (right != m_right) { - m_right = right; - emit rightChanged(); - } - if (bottom != m_bottom) { - m_bottom = bottom; - emit bottomChanged(); - } -} - -int DialogMargins::left() const -{ - return m_left; -} - -int DialogMargins::top() const -{ - return m_top; -} - -int DialogMargins::right() const -{ - return m_right; -} - -int DialogMargins::bottom() const -{ - return m_bottom; -} - -DialogProxy::DialogProxy(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_declarativeItemContainer(0), - m_activeWindow(false), - m_location(Plasma::Floating) -{ - m_dialog = new Plasma::Dialog(); - m_margins = new DialogMargins(m_dialog, this); - m_dialog->installEventFilter(this); - m_flags = m_dialog->windowFlags(); -} - -DialogProxy::~DialogProxy() -{ - delete m_declarativeItemContainer; - delete m_dialog; -} - -QGraphicsObject *DialogProxy::mainItem() const -{ - return m_mainItem.data(); -} - -void DialogProxy::setMainItem(QGraphicsObject *mainItem) -{ - if (m_mainItem.data() != mainItem) { - if (m_mainItem) { - m_mainItem.data()->setParent(mainItem ? mainItem->parent() : 0); - } - - m_mainItem = mainItem; - - if (mainItem) { - mainItem->setParentItem(0); - mainItem->setParent(this); - } - - //if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene - QTimer::singleShot(0, this, SLOT(syncMainItem())); - emit mainItemChanged(); - } -} - -void DialogProxy::syncMainItem() -{ - if (!m_mainItem) { - return; - } - - if (static_cast(m_dialog->graphicsWidget()) == m_mainItem.data() || - (m_declarativeItemContainer && m_declarativeItemContainer->declarativeItem() == m_mainItem.data())) { - return; - } - - //not have a scene? go up in the hyerarchy until we find something with a scene - QGraphicsScene *scene = m_mainItem.data()->scene(); - if (!scene) { - QObject *parent = m_mainItem.data(); - while ((parent = parent->parent())) { - QGraphicsObject *qo = qobject_cast(parent); - if (qo) { - scene = qo->scene(); - if (scene) { - scene->addItem(m_mainItem.data()); - break; - } - } - } - } - - if (!scene) { - return; - } - - //the parent of the qobject never changed, only the parentitem, so put it back what it was - m_mainItem.data()->setParentItem(qobject_cast(m_mainItem.data()->parent())); - - QGraphicsWidget *widget = qobject_cast(m_mainItem.data()); - if (widget) { - if (m_declarativeItemContainer) { - m_declarativeItemContainer->deleteLater(); - m_declarativeItemContainer = 0; - } - } else { - QDeclarativeItem *di = qobject_cast(m_mainItem.data()); - if (di) { - if (!m_declarativeItemContainer) { - m_declarativeItemContainer = new DeclarativeItemContainer(); - scene->addItem(m_declarativeItemContainer); - } - m_declarativeItemContainer->setDeclarativeItem(di); - widget = m_declarativeItemContainer; - } - } - m_dialog->setGraphicsWidget(widget); - - if (!qobject_cast(scene)) { - offscreenX -= 10000; - offscreenY -= 10000; - widget->setPos(offscreenX, offscreenY); - } -} - -bool DialogProxy::isVisible() const -{ - return m_dialog->isVisible(); -} - -void DialogProxy::setVisible(const bool visible) -{ - if (m_dialog->isVisible() != visible) { - //FIXME: workaround to prevent dialogs of Popup type disappearing on the second show - const QSize s = m_dialog->size(); - m_dialog->resize(0,0); - m_dialog->resize(s); - - const QRect workArea(KWindowSystem::workArea()); - if (!workArea.contains(m_dialog->geometry())) { - m_dialog->move(qBound(workArea.left(), m_dialog->x(), workArea.right() - m_dialog->width()), - qBound(workArea.top(), m_dialog->y(), workArea.bottom() - m_dialog->height()) - ); - } - - m_dialog->setVisible(visible); - if (visible && !m_dialog->testAttribute(Qt::WA_X11NetWmWindowTypeDock)) { - m_dialog->raise(); - } - } -} - -QPoint DialogProxy::popupPosition(QGraphicsObject *item, int alignment) -{ - QGraphicsObject *actualItem = item; - - //if no item is passed search the root item in order to figure out the view - if (!actualItem) { - actualItem = qobject_cast(parent()); - - //search the root object - while (true) { - QGraphicsObject *ancestor = qobject_cast(actualItem->parent()); - - if (ancestor) { - actualItem = ancestor; - } else { - break; - } - } - if (!actualItem) { - return QPoint(); - } - } - - //ensure the dialog has the proper size - syncMainItem(); - m_dialog->syncToGraphicsWidget(); - - Plasma::Corona *corona = qobject_cast(actualItem->scene()); - if (corona && item) { - return corona->popupPosition(actualItem, m_dialog->size(), (Qt::AlignmentFlag)alignment); - } else { - - if (!actualItem->scene()) { - return QPoint(); - } - - QList views = actualItem->scene()->views(); - - - if (views.size() < 1) { - return QPoint(); - } - - QGraphicsView *view = 0; - if (views.size() == 1) { - view = views[0]; - } else { - QGraphicsView *found = 0; - QGraphicsView *possibleFind = 0; - - foreach (QGraphicsView *v, views) { - if (v->sceneRect().intersects(actualItem->sceneBoundingRect()) || - v->sceneRect().contains(actualItem->scenePos())) { - if (v->isActiveWindow()) { - found = v; - } else { - possibleFind = v; - } - } - } - view = found ? found : possibleFind; - } - - if (!view) { - return QPoint(); - } - - //if no item was explicitly specified, align the dialog in the center of the parent view - if (!item) { - return view->geometry().center() - QPoint(m_dialog->width()/2, m_dialog->height()/2); - } - - //swap direction if necessary - if (QApplication::isRightToLeft() && alignment != Qt::AlignCenter) { - if (alignment == Qt::AlignRight) { - alignment = Qt::AlignLeft; - } else { - alignment = Qt::AlignRight; - } - } - - int xOffset = 0; - - if (alignment == Qt::AlignCenter) { - xOffset = actualItem->boundingRect().width()/2 - m_dialog->width()/2; - } else if (alignment == Qt::AlignRight) { - xOffset = actualItem->boundingRect().width() - m_dialog->width(); - } - - const QRect avail = QApplication::desktop()->availableGeometry(view); - QPoint menuPos = view->mapToGlobal(view->mapFromScene(actualItem->scenePos()+QPoint(xOffset, actualItem->boundingRect().height()))); - - if (menuPos.y() + m_dialog->height() > avail.bottom()) { - menuPos = view->mapToGlobal(view->mapFromScene(actualItem->scenePos() - QPoint(-xOffset, m_dialog->height()))); - } - return menuPos; - } -} - - -int DialogProxy::x() const -{ - return m_dialog->pos().x(); -} - -void DialogProxy::setX(int x) -{ - m_dialog->move(x, m_dialog->pos().y()); -} - -int DialogProxy::y() const -{ - return m_dialog->pos().y(); -} - -void DialogProxy::setY(int y) -{ - m_dialog->move(m_dialog->pos().x(), y); -} - -int DialogProxy::width() const -{ - return m_dialog->size().width(); -} - -int DialogProxy::height() const -{ - return m_dialog->size().height(); -} - -bool DialogProxy::isActiveWindow() const -{ - return m_activeWindow; -} - -void DialogProxy::activateWindow() -{ - m_dialog->activateWindow(); -} - -int DialogProxy::windowFlags() const -{ - return (int)m_flags; -} - -qulonglong DialogProxy::windowId() const -{ - return m_dialog->winId(); -} - -void DialogProxy::setWindowFlags(const int flags) -{ - m_flags = (Qt::WindowFlags)flags; - m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags); -} - -int DialogProxy::location() const -{ - return (int)m_location; -} - -void DialogProxy::setLocation(int location) -{ - if (m_location == location) { - return; - } - m_location = (Plasma::Location)location; - emit locationChanged(); -} - - -QObject *DialogProxy::margins() const -{ - return m_margins; -} - -bool DialogProxy::eventFilter(QObject *watched, QEvent *event) -{ - if (watched == m_dialog && event->type() == QEvent::Move) { - QMoveEvent *me = static_cast(event); - if (me->oldPos().x() != me->pos().x()) { - emit xChanged(); - } - if (me->oldPos().y() != me->pos().y()) { - emit yChanged(); - } - if ((me->oldPos().x() != me->pos().x()) || (me->oldPos().y() != me->pos().y())) { - m_margins->checkMargins(); - } - } else if (watched == m_dialog && event->type() == QEvent::Resize) { - QResizeEvent *re = static_cast(event); - if (re->oldSize().width() != re->size().width()) { - emit widthChanged(); - } - if (re->oldSize().height() != re->size().height()) { - emit heightChanged(); - } - } else if (watched == m_dialog && event->type() == QEvent::Show) { - Plasma::WindowEffects::slideWindow(m_dialog, m_location); - if (m_dialog->testAttribute(Qt::WA_X11NetWmWindowTypeDock)) { - KWindowSystem::setOnAllDesktops(m_dialog->winId(), true); - } else { - KWindowSystem::setOnAllDesktops(m_dialog->winId(), false); - } - emit visibleChanged(); - } else if (watched == m_dialog && event->type() == QEvent::Hide) { - Plasma::WindowEffects::slideWindow(m_dialog, m_location); - emit visibleChanged(); - } else if (watched == m_dialog && event->type() == QEvent::WindowActivate) { - m_activeWindow = true; - emit activeWindowChanged(); - } else if (watched == m_dialog && event->type() == QEvent::WindowDeactivate) { - m_activeWindow = false; - emit activeWindowChanged(); - } - return false; -} - -void DialogProxy::setAttribute(int attribute, bool on) -{ - m_dialog->setAttribute((Qt::WidgetAttribute)attribute, on); - - if (attribute == Qt::WA_X11NetWmWindowTypeDock) { - KWindowSystem::setOnAllDesktops(m_dialog->winId(), on); - } -} - -#include "moc_dialog.cpp" - diff --git a/plasma/declarativeimports/core/dialog.h b/plasma/declarativeimports/core/dialog.h deleted file mode 100644 index db23ee65..00000000 --- a/plasma/declarativeimports/core/dialog.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 DIALOG_PROXY_P -#define DIALOG_PROXY_P - -#include -#include -#include - -#include - -#include - -namespace Plasma -{ - class Dialog; -} - -class DeclarativeItemContainer; - -class DialogMargins : public QObject -{ - Q_OBJECT - - /** - * Width in pixels of the left margin - */ - Q_PROPERTY(int left READ left NOTIFY leftChanged) - - /** - * Height in pixels of the top margin - */ - Q_PROPERTY(int top READ top NOTIFY topChanged) - - /** - * Width in pixels of the right margin - */ - Q_PROPERTY(int right READ right NOTIFY rightChanged) - - /** - * Height in pixels of the bottom margin - */ - Q_PROPERTY(int bottom READ bottom NOTIFY bottomChanged) - -public: - DialogMargins(Plasma::Dialog *dialog, QObject *parent = 0); - - int left() const; - int top() const; - int right() const; - int bottom() const; - -Q_SIGNALS: - void leftChanged(); - void rightChanged(); - void topChanged(); - void bottomChanged(); - -protected: - void checkMargins(); - -private: - int m_left; - int m_top; - int m_right; - int m_bottom; - Plasma::Dialog *m_dialog; - friend class DialogProxy; -}; - -/** - * QML wrapper for kdelibs Plasma::Dialog - * - * Exposed as `Dialog` in QML. - */ -class DialogProxy : public QDeclarativeItem -{ - Q_OBJECT - - /** - * The main QML item that will be displayed in the Dialog - */ - Q_PROPERTY(QGraphicsObject *mainItem READ mainItem WRITE setMainItem NOTIFY mainItemChanged) - - /** - * Visibility of the Dialog window. Doesn't have anything to do with the visibility of the mainItem. - */ - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) - - /** - * X position of the dialog window in screen coordinates. - */ - Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) - - /** - * X position of the dialog window in screen coordinates. - */ - Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) - //to set the size try to force doing so from the inner item - - /** - * Read only width of the dialog window. It depends from the width of the mainItem - */ - Q_PROPERTY(int width READ width NOTIFY widthChanged) - - /** - * Read only height of the dialog window. It depends from the height of the mainItem - */ - Q_PROPERTY(int height READ height NOTIFY heightChanged) - - /** - * Window flags of the Dialog window - */ - Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags) - - /** - * Margins of the dialog around the mainItem. - * @see DialogMargins - */ - Q_PROPERTY(QObject *margins READ margins CONSTANT) - - /** - * True if the dialog window is the active one in the window manager. - */ - Q_PROPERTY(bool activeWindow READ isActiveWindow NOTIFY activeWindowChanged) - - /** - * Plasma Location of the dialog window. Useful if this dialog is apopup for a panel - */ - Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged) -//This won't be available on windows, but should be used only by kwin and never by applets anyways - /** - * Window ID of the dialog window. - **/ - Q_PROPERTY(qulonglong windowId READ windowId CONSTANT) - -public: - enum WidgetAttribute { - WA_X11NetWmWindowTypeDock = Qt::WA_X11NetWmWindowTypeDock - }; - - DialogProxy(QDeclarativeItem *parent = 0); - ~DialogProxy(); - - QGraphicsObject *mainItem() const; - void setMainItem(QGraphicsObject *mainItem); - - bool isVisible() const; - void setVisible(const bool visible); - - int x() const; - void setX(int x); - - int y() const; - void setY(int y); - - int width() const; - int height() const; - - bool isActiveWindow() const; - - /** - * Ask the window manager to activate the window. - * The window manager may or may not accept the activiation request - */ - Q_INVOKABLE void activateWindow(); - - //FIXME: passing an int is ugly - int windowFlags() const; - void setWindowFlags(const int); - - int location() const; - void setLocation(int location); - - QObject *margins() const; - - qulonglong windowId() const; - - /** - * @returns The suggested screen position for the popup - * @arg item the item the popup has to be positioned relatively to. if null, the popup will be positioned in the center of the window - * @arg alignment alignment of the popup compared to the item - */ - //FIXME: alignment should be Qt::AlignmentFlag - Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item, int alignment=Qt::AlignLeft) ; - - /** - * Set a Qt.WidgetAttribute to the dialog window - * - * @arg int attribute see Qt.WidgetAttribute - * @arg bool on activate or deactivate the atrtibute - */ - //FIXME:: Qt::WidgetAttribute should be already - Q_INVOKABLE void setAttribute(int attribute, bool on); - -Q_SIGNALS: - void mainItemChanged(); - void visibleChanged(); - void xChanged(); - void yChanged(); - void widthChanged(); - void heightChanged(); - void activeWindowChanged(); - void locationChanged(); - -protected Q_SLOTS: - void syncMainItem(); - -protected: - bool eventFilter(QObject *watched, QEvent *event); - -private: - Plasma::Dialog *m_dialog; - Qt::WindowFlags m_flags; - DeclarativeItemContainer *m_declarativeItemContainer; - QWeakPointer m_mainItem; - DialogMargins *m_margins; - bool m_activeWindow; - Plasma::Location m_location; - static int offscreenX; - static int offscreenY; -}; - -#endif diff --git a/plasma/declarativeimports/core/framesvgitem.cpp b/plasma/declarativeimports/core/framesvgitem.cpp deleted file mode 100644 index fa4662c6..00000000 --- a/plasma/declarativeimports/core/framesvgitem.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "framesvgitem.h" - -#include - -#include "kdebug.h" - - -namespace Plasma -{ - -FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *parent) - : QObject(parent), - m_frameSvg(frameSvg) -{ - //kDebug() << "margins at: " << left() << top() << right() << bottom(); - connect(m_frameSvg, SIGNAL(repaintNeeded()), this, SLOT(update())); -} - -qreal FrameSvgItemMargins::left() const -{ - return m_frameSvg->marginSize(LeftMargin); -} - -qreal FrameSvgItemMargins::top() const -{ - return m_frameSvg->marginSize(TopMargin); -} - -qreal FrameSvgItemMargins::right() const -{ - return m_frameSvg->marginSize(RightMargin); -} - -qreal FrameSvgItemMargins::bottom() const -{ - return m_frameSvg->marginSize(BottomMargin); -} - -void FrameSvgItemMargins::update() -{ - emit marginsChanged(); -} - -FrameSvgItem::FrameSvgItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent) -{ - m_frameSvg = new Plasma::FrameSvg(this); - m_margins = new FrameSvgItemMargins(m_frameSvg, this); - setFlag(QGraphicsItem::ItemHasNoContents, false); - connect(m_frameSvg, SIGNAL(repaintNeeded()), this, SLOT(doUpdate())); -} - - -FrameSvgItem::~FrameSvgItem() -{ -} - -void FrameSvgItem::setImagePath(const QString &path) -{ - if (m_frameSvg->imagePath() == path) { - return; - } - - m_frameSvg->setImagePath(path); - m_frameSvg->setElementPrefix(m_prefix); - - if (implicitWidth() <= 0) { - setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin)); - } - - if (implicitHeight() <= 0) { - setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin)); - } - - emit imagePathChanged(); - m_margins->update(); - update(); -} - -QString FrameSvgItem::imagePath() const -{ - return m_frameSvg->imagePath(); -} - - -void FrameSvgItem::setPrefix(const QString &prefix) -{ - if (m_prefix == prefix) { - return; - } - - m_frameSvg->setElementPrefix(prefix); - m_prefix = prefix; - - if (implicitWidth() <= 0) { - setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin)); - } - - if (implicitHeight() <= 0) { - setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin)); - } - - emit prefixChanged(); - m_margins->update(); - update(); -} - -QString FrameSvgItem::prefix() const -{ - return m_prefix; -} - -FrameSvgItemMargins *FrameSvgItem::margins() const -{ - return m_margins; -} - -void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders) -{ - if (m_frameSvg->enabledBorders() == borders) - return; - - m_frameSvg->setEnabledBorders(borders); - emit enabledBordersChanged(); -} - -Plasma::FrameSvg::EnabledBorders FrameSvgItem::enabledBorders() const -{ - return m_frameSvg->enabledBorders(); -} - -void FrameSvgItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - m_frameSvg->paintFrame(painter); -} - -void FrameSvgItem::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - m_frameSvg->resizeFrame(newGeometry.size()); - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -void FrameSvgItem::doUpdate() -{ - if (implicitWidth() <= 0) { - setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin)); - } - - if (implicitHeight() <= 0) { - setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin)); - } - - update(); -} - -void FrameSvgItem::setImplicitWidth(qreal width) -{ - if (implicitWidth() == width) { - return; - } - - QDeclarativeItem::setImplicitWidth(width); - - emit implicitWidthChanged(); -} - -qreal FrameSvgItem::implicitWidth() const -{ - return QDeclarativeItem::implicitWidth(); -} - -void FrameSvgItem::setImplicitHeight(qreal height) -{ - if (implicitHeight() == height) { - return; - } - - QDeclarativeItem::setImplicitHeight(height); - - emit implicitHeightChanged(); -} - -qreal FrameSvgItem::implicitHeight() const -{ - return QDeclarativeItem::implicitHeight(); -} - -} // Plasma namespace - -#include "moc_framesvgitem.cpp" diff --git a/plasma/declarativeimports/core/framesvgitem.h b/plasma/declarativeimports/core/framesvgitem.h deleted file mode 100644 index 4fb7227b..00000000 --- a/plasma/declarativeimports/core/framesvgitem.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 FRAMESVGITEM_P -#define FRAMESVGITEM_P - -#include - -#include - -namespace Plasma { - - class FrameSvg; - -class FrameSvgItemMargins : public QObject -{ - Q_OBJECT - - /** - * width in pixels of the left margin - */ - Q_PROPERTY(qreal left READ left NOTIFY marginsChanged) - - /** - * height in pixels of the top margin - */ - Q_PROPERTY(qreal top READ top NOTIFY marginsChanged) - - /** - * width in pixels of the right margin - */ - Q_PROPERTY(qreal right READ right NOTIFY marginsChanged) - - /** - * height in pixels of the bottom margin - */ - Q_PROPERTY(qreal bottom READ bottom NOTIFY marginsChanged) - -public: - FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *parent = 0); - - qreal left() const; - qreal top() const; - qreal right() const; - qreal bottom() const; - -public Q_SLOTS: - void update(); - -Q_SIGNALS: - void marginsChanged(); - -private: - FrameSvg *m_frameSvg; -}; - -class FrameSvgItem : public QDeclarativeItem -{ - Q_OBJECT - - /** - * Theme relative path of the svg, like "widgets/background" - */ - Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged) - - /** - * prefix for the 9 piece svg, like "pushed" or "normal" for the button - */ - Q_PROPERTY(QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged) - - /** - * The margins of the frame, read only - * @see FrameSvgItemMargins - */ - Q_PROPERTY(QObject *margins READ margins CONSTANT) - - Q_FLAGS(Plasma::FrameSvg::EnabledBorders) - /** - * The borders that will be rendered, it's a flag combination of: - * NoBorder - * TopBorder - * BottomBorder - * LeftBorder - * RightBorder - */ - Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders NOTIFY enabledBordersChanged) - - /** - * suggested default size hint for width - */ - Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged) - - /** - * suggested default size hint for height - */ - Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged) - -public: - FrameSvgItem(QDeclarativeItem *parent=0); - ~FrameSvgItem(); - - void setImagePath(const QString &path); - QString imagePath() const; - - void setPrefix(const QString &prefix); - QString prefix() const; - - void setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders); - Plasma::FrameSvg::EnabledBorders enabledBorders() const; - - FrameSvgItemMargins *margins() const; - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - - void setImplicitWidth(qreal width); - qreal implicitWidth() const; - - void setImplicitHeight(qreal height); - qreal implicitHeight() const; - -signals: - void imagePathChanged(); - void prefixChanged(); - void enabledBordersChanged(); - void implicitWidthChanged(); - void implicitHeightChanged(); - -private Q_SLOTS: - void doUpdate(); - -private: - Plasma::FrameSvg *m_frameSvg; - FrameSvgItemMargins *m_margins; - QString m_prefix; -}; - -} - -#endif diff --git a/plasma/declarativeimports/core/iconitem.cpp b/plasma/declarativeimports/core/iconitem.cpp deleted file mode 100644 index 4e824cc6..00000000 --- a/plasma/declarativeimports/core/iconitem.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright 2012 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "iconitem.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -IconItem::IconItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_svgIcon(0), - m_smooth(false), - m_active(false), - m_animValue(0) -{ - m_animation = new QPropertyAnimation(this); - connect(m_animation, SIGNAL(valueChanged(QVariant)), - this, SLOT(valueChanged(QVariant))); - connect(m_animation, SIGNAL(finished()), - this, SLOT(animationFinished())); - m_animation->setTargetObject(this); - m_animation->setEasingCurve(QEasingCurve::InOutQuad); - m_animation->setDuration(250); - - setFlag(QGraphicsItem::ItemHasNoContents, false); - - connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), - this, SIGNAL(implicitWidthChanged())); - connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), - this, SIGNAL(implicitHeightChanged())); - - - connect(this, SIGNAL(enabledChanged()), - this, SLOT(loadPixmap())); - - //initialize implicit size to the Dialog size - setImplicitWidth(KIconLoader::global()->currentSize(KIconLoader::Dialog)); - setImplicitHeight(KIconLoader::global()->currentSize(KIconLoader::Dialog)); -} - - -IconItem::~IconItem() -{ -} - -void IconItem::setSource(const QVariant &source) -{ - if (source == m_source) { - return; - } - - m_source = source; - - if (source.canConvert()) { - m_icon = source.value(); - m_pixmapIcon = QPixmap(); - delete m_svgIcon; - m_svgIcon = 0; - - } else if (source.canConvert()) { - if (!m_svgIcon) { - m_svgIcon = new Plasma::Svg(this); - } - const QString element = source.toString(); - const QString filename = element.split('-').first(); - //try as a svg toolbar icon - m_svgIcon->setImagePath("toolbar-icons/" + filename); - - //try as a svg normal icon (like systray) - if (!m_svgIcon->isValid() || !m_svgIcon->hasElement(element)) { - m_svgIcon->setImagePath("icons/" + filename); - } - m_svgIcon->setContainsMultipleImages(true); - - //success? - if (m_svgIcon->isValid() && m_svgIcon->hasElement(element)) { - m_icon = QIcon(); - } else { - //ok, svg not available - m_icon = KIcon(element); - delete m_svgIcon; - m_svgIcon = 0; - } - - m_pixmapIcon = QPixmap(); - - } else if (source.canConvert()) { - m_icon = QIcon(); - m_pixmapIcon = source.value(); - delete m_svgIcon; - m_svgIcon = 0; - - } else { - m_icon = QIcon(); - m_pixmapIcon = QPixmap(); - delete m_svgIcon; - m_svgIcon = 0; - } - - if (width() > 0 && height() > 0) { - loadPixmap(); - } - - emit sourceChanged(); - emit validChanged(); -} - -QVariant IconItem::source() const -{ - return m_source; -} - -bool IconItem::isActive() const -{ - return m_active; -} - -void IconItem::setActive(bool active) -{ - if (m_active == active) { - return; - } - - m_active = active; - loadPixmap(); - emit activeChanged(); -} - -void IconItem::setImplicitWidth(qreal width) -{ - if (implicitWidth() == width) { - return; - } - - QDeclarativeItem::setImplicitWidth(width); - - emit implicitWidthChanged(); -} - -qreal IconItem::implicitWidth() const -{ - return QDeclarativeItem::implicitWidth(); -} - -void IconItem::setImplicitHeight(qreal height) -{ - if (implicitHeight() == height) { - return; - } - - QDeclarativeItem::setImplicitHeight(height); - - emit implicitHeightChanged(); -} - -qreal IconItem::implicitHeight() const -{ - return QDeclarativeItem::implicitHeight(); -} - -void IconItem::setSmooth(const bool smooth) -{ - if (smooth == m_smooth) { - return; - } - m_smooth = smooth; - update(); -} - -bool IconItem::smooth() const -{ - return m_smooth; -} - -bool IconItem::isValid() const -{ - return !m_icon.isNull() || m_svgIcon || !m_pixmapIcon.isNull(); -} - -void IconItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - if (m_iconPixmaps.isEmpty()) { - return; - } - painter->save(); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); - - const QRect destRect(QPointF(boundingRect().center() - QPointF(m_iconPixmaps.first().width()/2, m_iconPixmaps.first().height()/2)).toPoint(), - m_iconPixmaps.first().size()); - - if (m_animation->state() == QAbstractAnimation::Running) { - QPixmap result = m_iconPixmaps.first(); - result = Plasma::PaintUtils::transition(result, - m_iconPixmaps.last(), m_animValue); - painter->drawPixmap(destRect, result); - //simpler logic for just paint - } else { - painter->drawPixmap(destRect, m_iconPixmaps.first()); - } - - painter->restore(); -} - -void IconItem::animationFinished() -{ - while (m_iconPixmaps.count() > 1) { - m_iconPixmaps.pop_front(); - } -} - -void IconItem::valueChanged(const QVariant &value) -{ - m_animValue = value.toReal(); - update(); -} - -void IconItem::loadPixmap() -{ - int size = qMin(width(), height()); - - //FIXME: Heuristic: allow 24x24 for icons/ that are in the systray(ugly) - if (m_svgIcon && m_svgIcon->imagePath().contains("icons/") && - size > KIconLoader::SizeSmallMedium && - size < KIconLoader::SizeMedium) { - size = 24; - - //if size is less than 16, leave as is - } else if (size < KIconLoader::SizeSmall) { - //do nothing - } else if (size < KIconLoader::SizeSmallMedium) { - size = KIconLoader::SizeSmall; - } else if (size < KIconLoader::SizeMedium) { - size = KIconLoader::SizeSmallMedium; - } else if (size < KIconLoader::SizeLarge) { - size = KIconLoader::SizeMedium; - } else if (size < KIconLoader::SizeHuge) { - size = KIconLoader::SizeLarge; - //if size is more than 64, leave as is - } - - - //final pixmap to paint - QPixmap result; - if (size <= 0) { - m_animation->stop(); - update(); - return; - } else if (m_svgIcon) { - m_svgIcon->resize(size, size); - result = m_svgIcon->pixmap(m_source.toString()); - } else if (!m_icon.isNull() && size>0) { - result = m_icon.pixmap(QSize(size, size)); - } else if (!m_pixmapIcon.isNull()) { - result = m_pixmapIcon; - } else { - m_iconPixmaps.clear(); - m_animation->stop(); - update(); - return; - } - - if (!isEnabled()) { - result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::DisabledState); - } else if (m_active) { - result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::ActiveState); - } - - //this happen only when loadPixmap has been called when an anim is running - while (m_iconPixmaps.count() > 1) { - m_iconPixmaps.pop_front(); - } - - m_iconPixmaps << result; - //if there is only one image, don't animate - //if an animation was already running, immediate transition, to not overload - if (m_animation->state() == QAbstractAnimation::Running) { - m_animation->stop(); - m_iconPixmaps.pop_front(); - } else if (m_iconPixmaps.count() > 1) { - m_animation->setStartValue((qreal)0); - m_animation->setEndValue((qreal)1); - m_animation->start(); - } - update(); -} - -void IconItem::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - if (newGeometry.size() != oldGeometry.size()) { - m_iconPixmaps.clear(); - if (newGeometry.width() > 0 && newGeometry.height() > 0) { - loadPixmap(); - } - - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); - } -} - -#include "moc_iconitem.cpp" diff --git a/plasma/declarativeimports/core/iconitem.h b/plasma/declarativeimports/core/iconitem.h deleted file mode 100644 index f1d0ecc7..00000000 --- a/plasma/declarativeimports/core/iconitem.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2012 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 ICONITEM_H -#define ICONITEM_H - -#include -#include -#include - -#include - -namespace Plasma { - class Svg; -} - -class IconItem : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) - Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged) - Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged) - Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) - Q_PROPERTY(bool valid READ isValid NOTIFY validChanged) - -public: - - IconItem(QDeclarativeItem *parent=0); - ~IconItem(); - - void setSource(const QVariant &source); - QVariant source() const; - - bool isActive() const; - void setActive(bool active); - - void setImplicitWidth(qreal width); - qreal implicitWidth() const; - - void setImplicitHeight(qreal height); - qreal implicitHeight() const; - - void setSmooth(const bool smooth); - bool smooth() const; - - bool isValid() const; - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - -Q_SIGNALS: - void activeChanged(); - void sourceChanged(); - void smoothChanged(); - void validChanged(); - void implicitWidthChanged(); - void implicitHeightChanged(); - -private Q_SLOTS: - void loadPixmap(); - void animationFinished(); - void valueChanged(const QVariant &value); - -private: - //all the ways we can set an source. Only one of them will be valid - QIcon m_icon; - Plasma::Svg *m_svgIcon; - QPixmap m_pixmapIcon; - //this contains the raw variant it was passed - QVariant m_source; - - bool m_smooth; - bool m_active; - - //This list contains at most 2 sources, when a pixmap transition is due, - //a new pixmap is queued, the old one is removed when the animation finishes - QList m_iconPixmaps; - - //animation on pixmap change - QPropertyAnimation *m_animation; - qreal m_animValue; -}; - -#endif diff --git a/plasma/declarativeimports/core/qmldir b/plasma/declarativeimports/core/qmldir deleted file mode 100644 index 9f76b2ca..00000000 --- a/plasma/declarativeimports/core/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -plugin corebindingsplugin - diff --git a/plasma/declarativeimports/core/svgitem.cpp b/plasma/declarativeimports/core/svgitem.cpp deleted file mode 100644 index a2dfc1f4..00000000 --- a/plasma/declarativeimports/core/svgitem.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "svgitem.h" - -#include - -#include "kdebug.h" -#include "plasma/svg.h" - -namespace Plasma -{ - -SvgItem::SvgItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_smooth(false) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); -} - - -SvgItem::~SvgItem() -{ -} - -void SvgItem::setElementId(const QString &elementID) -{ - if (elementID == m_elementID) { - return; - } - - if (implicitWidth() <= 0) { - setImplicitWidth(naturalSize().width()); - } - if (implicitHeight() <= 0) { - setImplicitHeight(naturalSize().height()); - } - - m_elementID = elementID; - emit elementIdChanged(); - emit naturalSizeChanged(); - update(); -} - -QString SvgItem::elementId() const -{ - return m_elementID; -} - -QSizeF SvgItem::naturalSize() const -{ - if (!m_svg) { - return QSizeF(); - } else if (!m_elementID.isEmpty()) { - return m_svg.data()->elementSize(m_elementID); - } - - return m_svg.data()->size(); -} - - -void SvgItem::setSvg(Plasma::Svg *svg) -{ - if (m_svg) { - disconnect(m_svg.data(), 0, this, 0); - } - m_svg = svg; - if (svg) { - connect(svg, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded())); - connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged())); - connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged())); - } - - if (implicitWidth() <= 0) { - setImplicitWidth(naturalSize().width()); - } - if (implicitHeight() <= 0) { - setImplicitHeight(naturalSize().height()); - } - - emit svgChanged(); - emit naturalSizeChanged(); -} - -Plasma::Svg *SvgItem::svg() const -{ - return m_svg.data(); -} - -void SvgItem::setSmooth(const bool smooth) -{ - if (smooth == m_smooth) { - return; - } - m_smooth = smooth; - emit smoothChanged(); - update(); -} - -bool SvgItem::smooth() const -{ - return m_smooth; -} - -void SvgItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - if (!m_svg) { - return; - } - //do without painter save, faster and the support can be compiled out - const bool wasAntiAlias = painter->testRenderHint(QPainter::Antialiasing); - const bool wasSmoothTransform = painter->testRenderHint(QPainter::SmoothPixmapTransform); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); - - //setContainsMultipleImages has to be done there since m_frameSvg can be shared with somebody else - m_svg.data()->setContainsMultipleImages(!m_elementID.isEmpty()); - m_svg.data()->paint(painter, boundingRect(), m_elementID); - painter->setRenderHint(QPainter::Antialiasing, wasAntiAlias); - painter->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothTransform); -} - -void SvgItem::updateNeeded() -{ - if (implicitWidth() <= 0) { - setImplicitWidth(naturalSize().width()); - } - if (implicitHeight() <= 0) { - setImplicitHeight(naturalSize().height()); - } - update(); -} - -void SvgItem::setImplicitWidth(qreal width) -{ - if (implicitWidth() == width) { - return; - } - - QDeclarativeItem::setImplicitWidth(width); - - emit implicitWidthChanged(); -} - -qreal SvgItem::implicitWidth() const -{ - return QDeclarativeItem::implicitWidth(); -} - -void SvgItem::setImplicitHeight(qreal height) -{ - if (implicitHeight() == height) { - return; - } - - QDeclarativeItem::setImplicitHeight(height); - - emit implicitHeightChanged(); -} - -qreal SvgItem::implicitHeight() const -{ - return QDeclarativeItem::implicitHeight(); -} - -} // Plasma namespace - -#include "moc_svgitem.cpp" diff --git a/plasma/declarativeimports/core/svgitem.h b/plasma/declarativeimports/core/svgitem.h deleted file mode 100644 index f4375e80..00000000 --- a/plasma/declarativeimports/core/svgitem.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 SVGITEM_P -#define SVGITEM_P - -#include - -namespace Plasma { - - class Svg; - -class SvgItem : public QDeclarativeItem -{ - Q_OBJECT - - /** - * The sub element of the svg we want to render. If empty the whole svg document will be painted. - */ - Q_PROPERTY(QString elementId READ elementId WRITE setElementId NOTIFY elementIdChanged) - - /** - * Svg class that is the source of the image, use it like that: - * - * SvgItem { - * svg: Svg {imagePath: "widgets/arrows"} - * elementId: "arrow-left" - * } - * - * Instead of a Svg declaration it can also be the id of a Svg declared elsewhere, useful to share Svg instances. - */ - Q_PROPERTY(Plasma::Svg * svg READ svg WRITE setSvg NOTIFY svgChanged) - - /** - * The natural, unscaled size of the svg document or the element. useful if a pixel perfect rendering of outlines is needed. - */ - Q_PROPERTY(QSizeF naturalSize READ naturalSize NOTIFY naturalSizeChanged) - - /** - * If true enable antialiasing in paint: default off, better quality but less performance. - */ - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) - - /** - * suggested default size hint for width (default to naturalSize.width) - */ - Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged) - - /** - * suggested default size hint for height (default to naturalSize.height) - */ - Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged) - -public: - SvgItem(QDeclarativeItem *parent=0); - ~SvgItem(); - - void setElementId(const QString &elementID); - QString elementId() const; - - void setSvg(Plasma::Svg *svg); - Plasma::Svg *svg() const; - - void setSmooth(const bool smooth); - bool smooth() const; - - QSizeF naturalSize() const; - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - void setImplicitWidth(qreal width); - qreal implicitWidth() const; - - void setImplicitHeight(qreal height); - qreal implicitHeight() const; - -Q_SIGNALS: - void elementIdChanged(); - void svgChanged(); - void naturalSizeChanged(); - void smoothChanged(); - void implicitWidthChanged(); - void implicitHeightChanged(); - -protected Q_SLOTS: - void updateNeeded(); - -private: - QWeakPointer m_svg; - QString m_elementID; - bool m_smooth; -}; -} - -#endif diff --git a/plasma/declarativeimports/core/theme.cpp b/plasma/declarativeimports/core/theme.cpp deleted file mode 100644 index 79aa6bab..00000000 --- a/plasma/declarativeimports/core/theme.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "theme.h" - -#include - -#include - -class FontProxySingleton -{ -public: - FontProxySingleton() - : defaultFont(Plasma::Theme::DefaultFont), - desktopFont(Plasma::Theme::DesktopFont), - smallestFont(Plasma::Theme::SmallestFont) - { - } - - FontProxy defaultFont; - FontProxy desktopFont; - FontProxy smallestFont; -}; - -K_GLOBAL_STATIC(FontProxySingleton, privateFontProxySingleton) - -FontProxy::FontProxy(Plasma::Theme::FontRole role, QObject *parent) - : QObject(parent), - m_fontRole(role) -{ - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(boldChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(familyChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(italicChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(pixelSizeChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(pointSizeChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(strikeoutChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(underlineChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(weightChanged())); - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), - this, SIGNAL(mSizeChanged())); -} - -FontProxy::~FontProxy() -{ -} - -FontProxy *FontProxy::defaultFont() -{ - return &privateFontProxySingleton->defaultFont; -} - -FontProxy *FontProxy::desktopFont() -{ - return &privateFontProxySingleton->desktopFont; -} - -FontProxy *FontProxy::smallestFont() -{ - return &privateFontProxySingleton->smallestFont; -} - -bool FontProxy::bold() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).bold(); -} - -QString FontProxy::family() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).family(); -} - -bool FontProxy::italic() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).italic(); -} - -int FontProxy::pixelSize() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).pixelSize(); -} - -qreal FontProxy::pointSize() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).pointSizeF(); -} - -bool FontProxy::strikeout() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).strikeOut(); -} - -bool FontProxy::underline() const -{ - return Plasma::Theme::defaultTheme()->font(m_fontRole).underline(); -} - -FontProxy::Weight FontProxy::weight() const -{ - return (FontProxy::Weight)Plasma::Theme::defaultTheme()->font(m_fontRole).weight(); -} - -QSize FontProxy::mSize() const -{ - return QFontMetrics(Plasma::Theme::defaultTheme()->font(m_fontRole)).boundingRect("M").size(); -} - - -//********** Theme ************* - -ThemeProxy::ThemeProxy(QObject *parent) - : QObject(parent) -{ - m_defaultIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop); - - m_iconSizes = new QDeclarativePropertyMap(this); - m_iconSizes->insert("desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop))); - m_iconSizes->insert("panel", QVariant(KIconLoader::global()->currentSize(KIconLoader::Panel))); - m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar)); - m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); - m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog)); - - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SIGNAL(themeChanged())); - connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged())); -} - -ThemeProxy::~ThemeProxy() -{ -} - -QString ThemeProxy::themeName() const -{ - return Plasma::Theme::defaultTheme()->themeName(); -} - -QObject *ThemeProxy::defaultFont() const -{ - return FontProxy::defaultFont(); -} - -QObject *ThemeProxy::desktopFont() const -{ - return FontProxy::desktopFont(); -} - -QObject *ThemeProxy::smallestFont() const -{ - return FontProxy::smallestFont(); -} - -bool ThemeProxy::windowTranslucencyEnabled() const -{ - return Plasma::Theme::defaultTheme()->windowTranslucencyEnabled(); -} - -KUrl ThemeProxy::homepage() const -{ - return Plasma::Theme::defaultTheme()->homepage(); -} - -bool ThemeProxy::useGlobalSettings() const -{ - return Plasma::Theme::defaultTheme()->useGlobalSettings(); -} - -QString ThemeProxy::wallpaperPath() const -{ - return Plasma::Theme::defaultTheme()->wallpaperPath(); -} - -QString ThemeProxy::wallpaperPathForSize(int width, int height) const -{ - return Plasma::Theme::defaultTheme()->wallpaperPath(QSize(width, height)); -} - -QColor ThemeProxy::textColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor); -} - -QColor ThemeProxy::highlightColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::HighlightColor); -} - -QColor ThemeProxy::backgroundColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor); -} - -QColor ThemeProxy::buttonTextColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonTextColor); -} - -QColor ThemeProxy::buttonBackgroundColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonBackgroundColor); -} - -QColor ThemeProxy::linkColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::LinkColor); -} - -QColor ThemeProxy::visitedLinkColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::VisitedLinkColor); -} - -QColor ThemeProxy::buttonHoverColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonHoverColor); -} - -QColor ThemeProxy::buttonFocusColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonFocusColor); -} - -QColor ThemeProxy::viewTextColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewTextColor); -} - -QColor ThemeProxy::viewBackgroundColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewBackgroundColor); -} - -QColor ThemeProxy::viewHoverColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewHoverColor); -} - -QColor ThemeProxy::viewFocusColor() const -{ - return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewFocusColor); -} - -QString ThemeProxy::styleSheet() const -{ - return Plasma::Theme::defaultTheme()->styleSheet(QString()); -} - -int ThemeProxy::smallIconSize() const -{ - return KIconLoader::SizeSmall; -} - -int ThemeProxy::smallMediumIconSize() const -{ - return KIconLoader::SizeSmallMedium; -} - -int ThemeProxy::mediumIconSize() const -{ - return KIconLoader::SizeMedium; -} - -int ThemeProxy::largeIconSize() const -{ - return KIconLoader::SizeLarge; -} - -int ThemeProxy::hugeIconSize() const -{ - return KIconLoader::SizeHuge; -} - -int ThemeProxy::enormousIconSize() const -{ - return KIconLoader::SizeEnormous; -} - -void ThemeProxy::iconLoaderSettingsChanged() -{ - m_defaultIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop); - - m_iconSizes->insert("desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop))); - m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar)); - m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); - m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog)); - - - emit defaultIconSizeChanged(); - emit iconSizesChanged(); -} - -int ThemeProxy::defaultIconSize() const -{ - return m_defaultIconSize; -} - -QDeclarativePropertyMap *ThemeProxy::iconSizes() const -{ - return m_iconSizes; -} - -#include "moc_theme.cpp" - diff --git a/plasma/declarativeimports/core/theme.h b/plasma/declarativeimports/core/theme.h deleted file mode 100644 index 18eb5b0d..00000000 --- a/plasma/declarativeimports/core/theme.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 THEME_PROXY_P -#define THEME_PROXY_P - -#include - -#include -#include -#include - -#include - -#include - -class FontProxy : public QObject -{ - Q_OBJECT - - /** - * true if the font is bold - */ - Q_PROPERTY(bool bold READ bold NOTIFY boldChanged) - - /** - * name of the font family - */ - Q_PROPERTY(QString family READ family NOTIFY familyChanged ) - - /** - * true if the font is italic - */ - Q_PROPERTY(bool italic READ italic NOTIFY italicChanged ) - - /** - * Size of the font in pixels: settings this is strongly discouraged. - * @see pointSize - */ - Q_PROPERTY(int pixelSize READ pixelSize NOTIFY pixelSizeChanged ) - - /** - * Size of the font in points - */ - Q_PROPERTY(qreal pointSize READ pointSize NOTIFY pointSizeChanged ) - - /** - * True if the text is striked out with an horizontal line - */ - Q_PROPERTY(bool strikeout READ strikeout NOTIFY strikeoutChanged ) - - /** - * True if all the text will be underlined - */ - Q_PROPERTY(bool underline READ underline NOTIFY underlineChanged ) - - /** - * One of: - * Light - * Normal - * DemiBold - * Bold - * Black - */ - Q_PROPERTY(Weight weight READ weight NOTIFY weightChanged ) - - /** - * Size in pixels of an uppercase "M" letter - */ - Q_PROPERTY(QSize mSize READ mSize NOTIFY mSizeChanged ) - - Q_ENUMS(Weight) - -public: - enum Weight { - Light = 25, - Normal = 50, - DemiBold = 63, - Bold = 75, - Black = 87 - }; - - FontProxy(Plasma::Theme::FontRole role, QObject *parent = 0); - ~FontProxy(); - static FontProxy *defaultFont(); - static FontProxy *desktopFont(); - static FontProxy *smallestFont(); - - bool bold() const; - QString family() const; - bool italic() const; - int pixelSize() const; - qreal pointSize() const; - bool strikeout() const; - bool underline() const; - Weight weight() const; - - /** - * @return The size of an uppercase M in this font - */ - QSize mSize() const; - -Q_SIGNALS: - void boldChanged(); - void familyChanged(); - void italicChanged(); - void pixelSizeChanged(); - void pointSizeChanged(); - void strikeoutChanged(); - void underlineChanged(); - void weightChanged(); - void mSizeChanged(); - -private: - Plasma::Theme::FontRole m_fontRole; -}; - -/** - * QML wrapper for kdelibs Plasma::Theme - * - * Exposed as `Theme` in QML. - */ -class ThemeProxy : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString themeName READ themeName NOTIFY themeChanged) - Q_PROPERTY(bool windowTranslucentEnabled READ windowTranslucencyEnabled NOTIFY themeChanged) - Q_PROPERTY(KUrl homepage READ homepage NOTIFY themeChanged) - Q_PROPERTY(bool useGlobalSettings READ useGlobalSettings NOTIFY themeChanged) - Q_PROPERTY(QString wallpaperPath READ wallpaperPath NOTIFY themeChanged) - - //fonts - Q_PROPERTY(QObject *defaultFont READ defaultFont CONSTANT) - Q_PROPERTY(QObject *desktopFont READ desktopFont CONSTANT) - Q_PROPERTY(QObject *smallestFont READ smallestFont CONSTANT) - - // colors - Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChanged) - Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChanged) - Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChanged) - Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChanged) - Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY themeChanged) - Q_PROPERTY(QColor linkColor READ linkColor NOTIFY themeChanged) - Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChanged) - Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChanged) - Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY themeChanged) - Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY themeChanged) - Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY themeChanged) - Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY themeChanged) - Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChanged) - Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChanged) - Q_PROPERTY(QString styleSheet READ styleSheet NOTIFY themeChanged) - - // icon sizes - Q_PROPERTY(int smallIconSize READ smallIconSize CONSTANT) - Q_PROPERTY(int smallMediumIconSize READ smallMediumIconSize CONSTANT) - Q_PROPERTY(int mediumIconSize READ mediumIconSize CONSTANT) - Q_PROPERTY(int largeIconSize READ largeIconSize CONSTANT) - Q_PROPERTY(int hugeIconSize READ hugeIconSize CONSTANT) - Q_PROPERTY(int enormousIconSize READ enormousIconSize CONSTANT) - Q_PROPERTY(int defaultIconSize READ defaultIconSize NOTIFY defaultIconSizeChanged) - - /** - * icon sizes depending from the context: use those if possible - * Access with theme.iconSizes.desktop theme.iconSizes.small etc. - * available keys are: - * * desktop - * * toolbar - * * small - * * dialog - */ - Q_PROPERTY(QDeclarativePropertyMap *iconSizes READ iconSizes NOTIFY iconSizesChanged) - -public: - ThemeProxy(QObject *parent = 0); - ~ThemeProxy(); - - QString themeName() const; - QObject *defaultFont() const; - QObject *desktopFont() const; - QObject *smallestFont() const; - bool windowTranslucencyEnabled() const; - KUrl homepage() const; - bool useGlobalSettings() const; - QString wallpaperPath() const; - Q_INVOKABLE QString wallpaperPathForSize(int width=-1, int height=-1) const; - - QColor textColor() const; - QColor highlightColor() const; - QColor backgroundColor() const; - QColor buttonTextColor() const; - QColor buttonBackgroundColor() const; - QColor linkColor() const; - QColor visitedLinkColor() const; - QColor buttonHoverColor() const; - QColor buttonFocusColor() const; - QColor viewTextColor() const; - QColor viewBackgroundColor() const; - QColor viewHoverColor() const; - QColor viewFocusColor() const; - QString styleSheet() const; - - int smallIconSize() const; - int smallMediumIconSize() const; - int mediumIconSize() const; - int largeIconSize() const; - int hugeIconSize() const; - int enormousIconSize() const; - int defaultIconSize() const; - QDeclarativePropertyMap *iconSizes() const; - -private Q_SLOTS: - void iconLoaderSettingsChanged(); - -Q_SIGNALS: - void themeChanged(); - void defaultIconSizeChanged(); - void iconSizesChanged(); - -private: - int m_defaultIconSize; - QDeclarativePropertyMap *m_iconSizes; -}; - -#endif diff --git a/plasma/declarativeimports/core/tooltip.cpp b/plasma/declarativeimports/core/tooltip.cpp deleted file mode 100644 index d09ffc5f..00000000 --- a/plasma/declarativeimports/core/tooltip.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * Copyright 2011 Artur Duque de Souza - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "tooltip.h" -#include "declarativeitemcontainer_p.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -ToolTipProxy::ToolTipProxy(QObject *parent) - : QObject(parent), m_mainText(""), m_subText(""), m_widget(0) -{ - connect(this, SIGNAL(targetChanged()), this, SLOT(updateToolTip())); - connect(this, SIGNAL(mainTextChanged()), this, SLOT(updateToolTip())); - connect(this, SIGNAL(subTextChanged()), this, SLOT(updateToolTip())); - connect(this, SIGNAL(imageChanged()), this, SLOT(updateToolTip())); -} - -ToolTipProxy::~ToolTipProxy() -{ -} - -QGraphicsObject *ToolTipProxy::target() const -{ - return m_target.data(); -} - -void ToolTipProxy::setTarget(QGraphicsObject *target) -{ - if (m_target.data() != target) { - m_target = target; - - m_widget = qobject_cast(m_target.data()); - if (!m_widget) { - // if this is called in Compenent.onCompleted we have to - // wait a loop for the item to be added to a scene - QTimer::singleShot(0, this, SLOT(syncTarget())); - return; - } - emit targetChanged(); - } -} - -void ToolTipProxy::syncTarget() -{ - if (!m_target) { - return; - } - // find the scene - QGraphicsScene *scene = m_target.data()->scene(); - if (!scene) { - QObject *parent = m_target.data(); - while ((parent = parent->parent())) { - QGraphicsObject *qo = qobject_cast(parent); - if (qo && qo->scene()) { - scene = qo->scene(); - scene->addItem(m_target.data()); - break; - } - } - } - - QDeclarativeItem *item = qobject_cast(m_target.data()); - if (!item) { - return; - } - - if (!m_declarativeItemContainer && scene) { - m_declarativeItemContainer = QWeakPointer(new DeclarativeItemContainer()); - m_declarativeItemContainer.data()->setObjectName("DIContainer"); - scene->addItem(m_declarativeItemContainer.data()); - } - - if (m_declarativeItemContainer) { - m_target.data()->setObjectName("Original Item"); - m_declarativeItemContainer.data()->setDeclarativeItem(item, false); - m_declarativeItemContainer.data()->setAcceptHoverEvents(true); - m_declarativeItemContainer.data()->setParentItem(m_target.data()); - m_widget = m_declarativeItemContainer.data(); - emit targetChanged(); - } -} - -QString ToolTipProxy::mainText() const -{ - return m_mainText; -} - -void ToolTipProxy::setMainText(const QString &text) -{ - if (text == m_mainText) { - return; - } - - m_mainText = text; - emit mainTextChanged(); -} - -QString ToolTipProxy::subText() const -{ - return m_subText; -} - -void ToolTipProxy::setSubText(const QString &text) -{ - if (text == m_subText) { - return; - } - - m_subText = text; - emit subTextChanged(); -} - -QVariant ToolTipProxy::image() const -{ - return m_image; -} - -void ToolTipProxy::setImage(QVariant name) -{ - if (name == m_image) { - return; - } - - m_image = name; - emit imageChanged(); -} - -void ToolTipProxy::updateToolTip() -{ - if (!m_widget) { - return; - } - - Plasma::ToolTipContent data; - data.setMainText(m_mainText); - data.setSubText(m_subText); - - // set image - switch (m_image.type()) { - case QVariant::String: { - QString name = m_image.toString(); - if (!name.isEmpty()) { - KIcon icon(name); - if (!icon.isNull()) { - data.setImage(icon.pixmap(IconSize(KIconLoader::Desktop))); - } - } - break; - } - - case QVariant::Icon: { - data.setImage(m_image.value()); - break; - } - - case QVariant::Pixmap: { - data.setImage(m_image.value()); - break; - } - - default: - break; - } - Plasma::ToolTipManager::self()->setContent(m_widget, data); -} - -#include "moc_tooltip.cpp" - diff --git a/plasma/declarativeimports/core/tooltip.h b/plasma/declarativeimports/core/tooltip.h deleted file mode 100644 index c7988ef9..00000000 --- a/plasma/declarativeimports/core/tooltip.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * Copyright 2011 Artur Duque de Souza - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 TOOLTIP_PROXY_P -#define TOOLTIP_PROXY_P - -#include -#include -#include - -#include -#include -class DeclarativeItemContainer; - -/** - * QML wrapper for kdelibs Plasma::ToolTip - * - * Exposed as `ToolTip` in QML. - */ -class ToolTipProxy : public QObject -{ - Q_OBJECT - - /** - * The item that will display this tooltip on mouse over - */ - Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget NOTIFY targetChanged) - - /** - * The title of the tooltip, not more that 2-3 words - */ - Q_PROPERTY(QString mainText READ mainText WRITE setMainText NOTIFY mainTextChanged) - - /** - * subtitle of the tooltip. needed if a longer description is needed - */ - Q_PROPERTY(QString subText READ subText WRITE setSubText NOTIFY subTextChanged) - - /** - * Image to display in the tooltip, can be an image full path or a Freedesktop icon name or QIcon or QPixmap - */ - Q_PROPERTY(QVariant image READ image WRITE setImage NOTIFY imageChanged) - -public: - ToolTipProxy(QObject *parent = 0); - ~ToolTipProxy(); - - QGraphicsObject *target() const; - void setTarget(QGraphicsObject *target); - - QString mainText() const; - void setMainText(const QString &text); - - QString subText() const; - void setSubText(const QString &text); - - QVariant image() const; - void setImage(QVariant name); - -Q_SIGNALS: - void targetChanged(); - void mainTextChanged(); - void subTextChanged(); - void imageChanged(); - -protected Q_SLOTS: - void syncTarget(); - void updateToolTip(); - -private: - QString m_mainText; - QString m_subText; - QVariant m_image; - QGraphicsWidget *m_widget; - QWeakPointer m_declarativeItemContainer; - QWeakPointer m_target; -}; - -#endif diff --git a/plasma/declarativeimports/plasmacomponents/CMakeLists.txt b/plasma/declarativeimports/plasmacomponents/CMakeLists.txt deleted file mode 100644 index 11e5ddf9..00000000 --- a/plasma/declarativeimports/plasmacomponents/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -project(plasmacomponents) - -set(plasmacomponents_SRCS - declarativetabbar.cpp - plasmacomponentsplugin.cpp -) - -include_directories( - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} -) - -add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS}) -target_link_libraries(plasmacomponentsplugin - ${QT_QTCORE_LIBRARY} - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTGUI_LIBRARY} - KDE4::kdeui - KDE4::plasma -) - -install( - TARGETS plasmacomponentsplugin - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/plasma/components -) - -install( - DIRECTORY qml/ - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/plasma/components -) - diff --git a/plasma/declarativeimports/plasmacomponents/declarativetabbar.cpp b/plasma/declarativeimports/plasmacomponents/declarativetabbar.cpp deleted file mode 100644 index a2a11920..00000000 --- a/plasma/declarativeimports/plasmacomponents/declarativetabbar.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "declarativetabbar.h" - -TabBarAttached::TabBarAttached(QObject *parent) - : QObject(parent) -{ -} - -void TabBarAttached::setTabText(const QString &text) -{ - if (text == m_tabText) - return; - - m_tabText = text; - emit tabTextChanged(reinterpret_cast(parent()), m_tabText); -} - -QString TabBarAttached::tabText()const -{ - return m_tabText; -} - -DeclarativeTabBar::DeclarativeTabBar(QObject *parent) - : Plasma::TabBar(qobject_cast(parent)) -{} - -DeclarativeTabBar::~DeclarativeTabBar() -{} - -void DeclarativeTabBar::updateTabText(QGraphicsLayoutItem *item, const QString &text) -{ - for (int i=0; i < count(); ++i) { - if (item == tabAt(i)) { - setTabText(i, text); - break; - } - } -} - -QHash DeclarativeTabBar::m_attachedProperties; - -TabBarAttached *DeclarativeTabBar::qmlAttachedProperties(QObject *obj) -{ - // ### This is not allowed - you must attach to any object - if (!qobject_cast(obj)) { - return 0; - } - - TabBarAttached *attached = new TabBarAttached(obj); - m_attachedProperties.insert(qobject_cast(obj), attached); - return attached; -} - -#include "moc_declarativetabbar.cpp" - diff --git a/plasma/declarativeimports/plasmacomponents/declarativetabbar.h b/plasma/declarativeimports/plasmacomponents/declarativetabbar.h deleted file mode 100644 index 70870d46..00000000 --- a/plasma/declarativeimports/plasmacomponents/declarativetabbar.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 DECLARATIVETABBAR -#define DECLARATIVETABBAR - -#include -#include - -#include "plasma/widgets/tabbar.h" - -class TabBarAttached : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString tabText READ tabText WRITE setTabText NOTIFY tabTextChanged) - -public: - TabBarAttached(QObject *parent); - - void setTabText(const QString& text); - QString tabText() const; - -Q_SIGNALS: - void tabTextChanged(QGraphicsLayoutItem*, const QString&); - -private: - QString m_tabText; -}; - -class DeclarativeTabBar : public Plasma::TabBar -{ - Q_OBJECT - - Q_PROPERTY(KTabBar *nativeWidget READ nativeWidget) - Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex) - Q_PROPERTY(int count READ count) - Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) - Q_PROPERTY(bool tabBarShown READ isTabBarShown WRITE setTabBarShown) - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_CLASSINFO("DefaultProperty", "children") - -public: - DeclarativeTabBar(QObject *parent = 0); - ~DeclarativeTabBar(); - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } - - static TabBarAttached *qmlAttachedProperties(QObject *); - -private Q_SLOTS: - void updateTabText(QGraphicsLayoutItem *, const QString&); - -private: - static QHash m_attachedProperties; - - static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { - QString text; - DeclarativeTabBar *tabBar = static_cast(prop->object); - if (TabBarAttached *obj = m_attachedProperties.value(item)) { - text = obj->tabText(); - QObject::connect(obj, SIGNAL(tabTextChanged(QGraphicsLayoutItem*,int)), - tabBar, SLOT(updateTabText(QGraphicsLayoutItem*,int))); - } - tabBar->addTab(text, item); - } - - static void children_clear(QDeclarativeListProperty *prop) { - DeclarativeTabBar *tabBar = static_cast(prop->object); - for (int i=0; i < tabBar->count(); ++i) { - tabBar->removeTab(0); - } - } - - static int children_count(QDeclarativeListProperty *prop) { - return static_cast(prop->object)->count(); - } - - static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { - return static_cast(prop->object)->tabAt(index); - } -}; - -QML_DECLARE_TYPE(DeclarativeTabBar) -QML_DECLARE_TYPEINFO(DeclarativeTabBar, QML_HAS_ATTACHED_PROPERTIES) - -#endif diff --git a/plasma/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp b/plasma/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp deleted file mode 100644 index 1dbde2a1..00000000 --- a/plasma/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - * Copyright 2010 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "plasmacomponentsplugin.h" -#include "declarativetabbar.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 - -Q_EXPORT_PLUGIN(PlasmaComponentsPlugin) - -SignalPlotter::SignalPlotter(QGraphicsItem *parent) - : Plasma::SignalPlotter(parent) -{ -} - -SignalPlotter::~SignalPlotter() -{ -} - -void SignalPlotter::addSample(const QVariantList &samples) -{ - QList doubleSamples; - foreach (const QVariant &sampleItem, samples) { - doubleSamples << sampleItem.toDouble(); - } - if (plotColors().size() == doubleSamples.size()) { - Plasma::SignalPlotter::addSample(doubleSamples); - } -} - -void PlasmaComponentsPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.components")); - qmlRegisterType(uri, 0, 1, "TabBar"); - qmlRegisterType(uri, 0, 1, "SignalPlotter"); - - qmlRegisterType(uri, 0, 1, "BusyWidget"); - qmlRegisterType(uri, 0, 1, "CheckBox"); - qmlRegisterType(uri, 0, 1, "ComboBox"); - qmlRegisterType(uri, 0, 1, "FlashingLabel"); - qmlRegisterType(uri, 0, 1, "Frame"); - qmlRegisterType(uri, 0, 1, "GroupBox"); - qmlRegisterType(uri, 0, 1, "IconWidget"); - qmlRegisterType(uri, 0, 1, "ItemBackground"); - qmlRegisterType(uri, 0, 1, "Label"); - qmlRegisterType(uri, 0, 1, "LineEdit"); - qmlRegisterType(uri, 0, 1, "Meter"); - qmlRegisterType(uri, 0, 1, "PushButton"); - qmlRegisterType(uri, 0, 1, "RadioButton"); - qmlRegisterType(uri, 0, 1, "ScrollBar"); - qmlRegisterType(uri, 0, 1, "ScrollWidget"); - qmlRegisterType(uri, 0, 1, "Separator"); - qmlRegisterType(uri, 0, 1, "Slider"); - qmlRegisterType(uri, 0, 1, "SpinBox"); - qmlRegisterType(uri, 0, 1, "SvgWidget"); - qmlRegisterType(uri, 0, 1, "TextBrowser"); - qmlRegisterType(uri, 0, 1, "TextEdit"); - qmlRegisterType(uri, 0, 1, "ToolButton"); - qmlRegisterType(uri, 0, 1, "TreeView"); - qmlRegisterType(uri, 0, 1, "CalendarWidget"); -} - -#include "moc_plasmacomponentsplugin.cpp" diff --git a/plasma/declarativeimports/plasmacomponents/plasmacomponentsplugin.h b/plasma/declarativeimports/plasmacomponents/plasmacomponentsplugin.h deleted file mode 100644 index 8b9f2d0d..00000000 --- a/plasma/declarativeimports/plasmacomponents/plasmacomponentsplugin.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - * Copyright 2010 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 PLASMACOMPONENTSPLUGIN_H -#define PLASMACOMPONENTSPLUGIN_H - -#include -#include - -#include -#include -#include - -class SignalPlotter : public Plasma::SignalPlotter -{ - Q_OBJECT - -public: - SignalPlotter(QGraphicsItem *parent = 0); - ~SignalPlotter(); - Q_INVOKABLE void addSample(const QVariantList &samples); -}; - -class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - void registerTypes(const char *uri); -}; - -#endif diff --git a/plasma/declarativeimports/plasmacomponents/qml/Button.qml b/plasma/declarativeimports/plasmacomponents/qml/Button.qml deleted file mode 100644 index c2de143f..00000000 --- a/plasma/declarativeimports/plasmacomponents/qml/Button.qml +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (C) 2011 by Daker Fernandes Pinheiro -* Copyright (C) 2011 by Mark Gaiser -* Copyright (C) 2011 by Marco Martin -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details -* -* You should have received a copy of the GNU Library 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. -*/ - - -/** - * A button with optional label and icon which uses the plasma theme. - * - * This button component can also be used as a checkable button by using - * the checkable and checked properties for that. Plasma theme is the - * theme which changes via the systemsetting-workspace appearance -desktop - * theme. - */ -import QtQuick 1.1 - -import org.kde.plasma.core 0.1 as PlasmaCore -import "private" as Private - -Item { - id: button - - - // Commmon API - /** - * This property holds whether this button is checked or not. - * The button must be in the checkable state to enable users to check or - * uncheck it. - * - * The default value is false. - * - * @see checkable - */ - property bool checked: false - - /** - * This property holds if the button is acting like a checkable button or - * not. - * - * The default value is false. - */ - property bool checkable: false - - /** - * type:bool - * This property holds if the button is pressed or not. - * Read-only. - */ - property alias pressed: mouse.pressed - - /** - * type:string - * This property holds the text label for the button. - */ - property alias text: label.text - - /** - * type:string - * - * This property holds the source url for the Button's icon. - * It can be any image from any protocol supported by the Image element, or - * a freedesktop-compatible icon name - * - * The default value is an empty url, which displays no icon. - */ - property alias iconSource: icon.source - - /** - * type:font - * - * This property holds the font used by the button label. - * - * See also Qt documentation for font type. - */ - property alias font: label.font - - //icon + label + left margin + right margin + spacing between icon and text - /** - * Smallest width this button can be to show all the contents - */ - property real minimumWidth: icon.width + label.paintedWidth + surfaceNormal.margins.left + surfaceNormal.margins.right + ((icon.valid) ? surfaceNormal.margins.left : 0) - - /** - * Smallest height this button can be to show all the contents - */ - property real minimumHeight: Math.max(theme.smallIconSize, label.paintedHeight) + surfaceNormal.margins.top + surfaceNormal.margins.bottom - - /** - * This signal is emitted when the button is clicked. - */ - signal clicked() - - implicitWidth: { - if (label.text.length == 0) { - height; - } else { - Math.max(theme.defaultFont.mSize.width*12, minimumWidth); - } - } - - implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, minimumHeight) - - // TODO: needs to define if there will be specific graphics for - // disabled buttons - opacity: enabled ? 1.0 : 0.5 - - QtObject { - id: internal - property bool userPressed: false - - function belongsToButtonGroup() - { - return button.parent - && button.parent.hasOwnProperty("checkedButton") - && button.parent.exclusive - } - - function clickButton() - { - userPressed = false - if (!button.enabled) { - return - } - - if ((!belongsToButtonGroup() || !button.checked) && button.checkable) { - button.checked = !button.checked - } - - button.forceActiveFocus() - button.clicked() - } - } - - Keys.onSpacePressed: internal.userPressed = true - Keys.onReturnPressed: internal.userPressed = true - Keys.onReleased: { - internal.userPressed = false - if (event.key == Qt.Key_Space || - event.key == Qt.Key_Return) - internal.clickButton(); - } - - Private.ButtonShadow { - id: shadow - anchors.fill: parent - state: { - if (internal.userPressed || checked) { - return "hidden" - } else if (mouse.containsMouse) { - return "hover" - } else if (button.activeFocus) { - return "focus" - } else { - return "shadow" - } - } - } - - // The normal button state - PlasmaCore.FrameSvgItem { - id: surfaceNormal - - anchors.fill: parent - imagePath: "widgets/button" - prefix: "normal" - } - - // The pressed state - PlasmaCore.FrameSvgItem { - id: surfacePressed - - anchors.fill: parent - imagePath: "widgets/button" - prefix: "pressed" - opacity: 0 - } - - Row { - id: buttonContent - state: (internal.userPressed || checked) ? "pressed" : "normal" - spacing: icon.valid ? surfaceNormal.margins.left : 0 - - states: [ - State { name: "normal" }, - State { name: "pressed" - PropertyChanges { - target: surfaceNormal - opacity: 0 - } - PropertyChanges { - target: surfacePressed - opacity: 1 - } - } - ] - transitions: [ - Transition { - to: "normal" - // Cross fade from pressed to normal - ParallelAnimation { - NumberAnimation { target: surfaceNormal; property: "opacity"; to: 1; duration: 100 } - NumberAnimation { target: surfacePressed; property: "opacity"; to: 0; duration: 100 } - } - } - ] - - anchors { - fill: parent - leftMargin: surfaceNormal.margins.left - topMargin: surfaceNormal.margins.top - rightMargin: surfaceNormal.margins.right - bottomMargin: surfaceNormal.margins.bottom - } - - PlasmaCore.IconItem { - id: icon - anchors.verticalCenter: parent.verticalCenter - width: valid? parent.height: 0 - height: width - active: shadow.hasOverState && mouse.containsMouse - } - - Text { - id: label - - width: parent.width - icon.width - parent.spacing - height: parent.height - - font.family: theme.defaultFont.family - font.italic: theme.defaultFont.italic - font.pointSize: theme.defaultFont.pointSize - font.strikeout: theme.defaultFont.strikeout - font.underline: theme.defaultFont.underline - font.weight: theme.defaultFont.weight - color: theme.buttonTextColor - horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: button.width < button.implicitWidth ? Text.ElideRight : Text.ElideNone - } - } - - MouseArea { - id: mouse - - anchors.fill: parent - hoverEnabled: true - onPressed: internal.userPressed = true - onReleased: internal.userPressed = false - onCanceled: internal.userPressed = false - onClicked: internal.clickButton() - } -} diff --git a/plasma/declarativeimports/plasmacomponents/qml/Highlight.qml b/plasma/declarativeimports/plasmacomponents/qml/Highlight.qml deleted file mode 100644 index 06f978de..00000000 --- a/plasma/declarativeimports/plasmacomponents/qml/Highlight.qml +++ /dev/null @@ -1,93 +0,0 @@ - /* - * Copyright 2011 Daker Fernandes Pinheiro - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore - -/** - * Used to highlight an item of a list. to be used only as the "highlight" - * property of the ListView and GridView primitive QML components (or their - * derivates) - * - * Provides built-in animation of Behavior on opacity Easing.OutQuad for a - * duration of 250. - * - * (TODO, make optional? e.g. animate: false) - */ -Item { - id: highlight - - /** true if the user is hovering over the component */ - //in the case we are the highlight of a listview, it follows the mouse, so hover = true - property bool hover: ListView ? true : false - - /** true if the mouse button is pressed over the component. */ - property bool pressed: false - width: ListView.view ? ListView.view.width : undefined - - property alias marginHints: background.margins; - - Connections { - target: highlight.ListView.view - onCurrentIndexChanged: { - if (highlight.ListView.view.currentIndex >= 0) { - background.opacity = 1 - } else { - background.opacity = 0 - } - } - } - - Behavior on opacity { - NumberAnimation { - duration: 250 - easing.type: Easing.OutQuad - } - } - - PlasmaCore.FrameSvgItem { - id: background - imagePath: "widgets/viewitem" - prefix: { - if (pressed) - return hover ? "selected+hover" : "selected"; - - if (hover) - return "hover"; - - return "normal"; - } - - Behavior on opacity { - NumberAnimation { - duration: 250 - easing.type: Easing.OutQuad - } - } - - anchors { - fill: parent - //FIXME: breaks listviews and highlight item - // topMargin: -background.margins.top - // leftMargin: -background.margins.left - // bottomMargin: -background.margins.bottom - // rightMargin: -background.margins.right - } - } -} diff --git a/plasma/declarativeimports/plasmacomponents/qml/private/ButtonShadow.qml b/plasma/declarativeimports/plasmacomponents/qml/private/ButtonShadow.qml deleted file mode 100644 index 8c00c35c..00000000 --- a/plasma/declarativeimports/plasmacomponents/qml/private/ButtonShadow.qml +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2011 by Daker Fernandes Pinheiro - * Copyright (C) 2011 by Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library 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. - */ - -/**Documented API -Inherits: - Item - -Imports: - QtQuick 1.0 - org.kde.plasma.core - -Description: -TODO i need more info here - - -Properties: -**/ - -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - id: main - state: parent.state - //used to tell apart this implementation with the touch components one - property bool hasOverState: true - - PlasmaCore.FrameSvgItem { - id: hover - - anchors { - fill: parent - leftMargin: -margins.left - topMargin: -margins.top - rightMargin: -margins.right - bottomMargin: -margins.bottom - } - opacity: 0 - imagePath: "widgets/button" - prefix: "hover" - } - - PlasmaCore.FrameSvgItem { - id: shadow - - anchors { - fill: parent - leftMargin: -margins.left - topMargin: -margins.top - rightMargin: -margins.right - bottomMargin: -margins.bottom - } - imagePath: "widgets/button" - prefix: "shadow" - } - - states: [ - State { - name: "shadow" - PropertyChanges { - target: shadow - opacity: 1 - } - PropertyChanges { - target: hover - opacity: 0 - prefix: "hover" - } - }, - State { - name: "hover" - PropertyChanges { - target: shadow - opacity: 0 - } - PropertyChanges { - target: hover - opacity: 1 - prefix: "hover" - } - }, - State { - name: "focus" - PropertyChanges { - target: shadow - opacity: 0 - } - PropertyChanges { - target: hover - opacity: 1 - prefix: "focus" - } - }, - State { - name: "hidden" - PropertyChanges { - target: shadow - opacity: 0 - } - PropertyChanges { - target: hover - opacity: 0 - prefix: "hover" - } - } - ] - - transitions: [ - Transition { - PropertyAnimation { - properties: "opacity" - duration: 250 - easing.type: Easing.OutQuad - } - } - ] -} diff --git a/plasma/declarativeimports/plasmacomponents/qml/qmldir b/plasma/declarativeimports/plasmacomponents/qml/qmldir deleted file mode 100644 index bc982876..00000000 --- a/plasma/declarativeimports/plasmacomponents/qml/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -plugin plasmacomponentsplugin - -Button 0.1 Button.qml -Highlight 0.1 Highlight.qml diff --git a/plasma/declarativeimports/qtextracomponents/CMakeLists.txt b/plasma/declarativeimports/qtextracomponents/CMakeLists.txt deleted file mode 100644 index fd4021e5..00000000 --- a/plasma/declarativeimports/qtextracomponents/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -project(qtextracomponents) - -set(qtextracomponents_SRCS - qtextracomponentsplugin.cpp - qpixmapitem.cpp - qimageitem.cpp - qiconitem.cpp - mouseeventlistener.cpp -) - -include_directories( - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} -) - -add_library(qtextracomponentsplugin SHARED ${qtextracomponents_SRCS}) -target_link_libraries(qtextracomponentsplugin - KDE4::kdeui - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} -) - -install( - TARGETS qtextracomponentsplugin - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/qtextracomponents -) - -install( - FILES qmldir - DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/qtextracomponents -) diff --git a/plasma/declarativeimports/qtextracomponents/mouseeventlistener.cpp b/plasma/declarativeimports/qtextracomponents/mouseeventlistener.cpp deleted file mode 100644 index d60c0a3b..00000000 --- a/plasma/declarativeimports/qtextracomponents/mouseeventlistener.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* - Copyright 2011 Marco Martin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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. -*/ - -#include "mouseeventlistener.h" - -#include -#include -#include -#include - -#include - -static const int PressAndHoldDelay = 800; - -MouseEventListener::MouseEventListener(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_pressed(false), - m_pressAndHoldEvent(0), - m_lastEvent(0), - m_containsMouse(false) -{ - m_pressAndHoldTimer = new QTimer(this); - m_pressAndHoldTimer->setSingleShot(true); - connect(m_pressAndHoldTimer, SIGNAL(timeout()), - this, SLOT(handlePressAndHold())); - - qmlRegisterType(); - qmlRegisterType(); - - setFiltersChildEvents(true); - setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton|Qt::MiddleButton); -} - -MouseEventListener::~MouseEventListener() -{ -} - -void MouseEventListener::setHoverEnabled(bool enable) -{ - if (enable == acceptHoverEvents()) { - return; - } - - setAcceptHoverEvents(enable); - emit hoverEnabledChanged(enable); -} - -bool MouseEventListener::hoverEnabled() const -{ - return acceptHoverEvents(); -} - -void MouseEventListener::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - - m_containsMouse = true; - emit containsMouseChanged(true); -} - -void MouseEventListener::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - - m_containsMouse = false; - emit containsMouseChanged(false); -} - -bool MouseEventListener::containsMouse() const -{ - return m_containsMouse; -} - -void MouseEventListener::mousePressEvent(QGraphicsSceneMouseEvent *me) -{ - if (m_lastEvent == me) { - m_lastEvent = 0; - return; - } - - //FIXME: when a popup window is visible: a click anywhere hides it: but the old qgraphicswidget will continue to think it's under the mouse - //doesn't seem to be any good way to properly reset this. - //this msolution will still caused a missed click after the popup is gone, but gets the situation unblocked. - if (!isUnderMouse()) { - me->ignore(); - return; - } - - KDeclarativeMouseEvent dme(me->pos().x(), me->pos().y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - m_pressAndHoldEvent = new KDeclarativeMouseEvent(me->pos().x(), me->pos().y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - emit pressed(&dme); - m_pressed = true; - - m_pressAndHoldTimer->start(PressAndHoldDelay); -} - -void MouseEventListener::mouseMoveEvent(QGraphicsSceneMouseEvent *me) -{ - if (m_lastEvent == me) { - m_lastEvent = 0; - return; - } - - KDeclarativeMouseEvent dme(me->pos().x(), me->pos().y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - emit positionChanged(&dme); -} - -void MouseEventListener::mouseReleaseEvent(QGraphicsSceneMouseEvent *me) -{ - if (m_lastEvent == me) { - m_lastEvent = 0; - return; - } - - KDeclarativeMouseEvent dme(me->pos().x(), me->pos().y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - m_pressed = false; - emit released(&dme); - - if (boundingRect().contains(me->pos()) && m_pressAndHoldTimer->isActive()) { - emit clicked(&dme); - m_pressAndHoldTimer->stop(); - } -} - -void MouseEventListener::wheelEvent(QGraphicsSceneWheelEvent *we) -{ - if (m_lastEvent == we) { - m_lastEvent = 0; - return; - } - - KDeclarativeWheelEvent dwe(we->pos(), we->screenPos(), we->delta(), we->buttons(), we->modifiers(), we->orientation()); - emit wheelMoved(&dwe); -} - -void MouseEventListener::handlePressAndHold() -{ - if (m_pressed) { - emit pressAndHold(m_pressAndHoldEvent); - //delete m_pressAndHoldEvent; - } -} - - -bool MouseEventListener::sceneEventFilter(QGraphicsItem *item, QEvent *event) -{ - if (!isEnabled()) { - return false; - } - - // If we already processed this event for another child, don't do it again. - if (m_lastEvent == event) { - return false; - } - - switch (event->type()) { - case QEvent::GraphicsSceneMousePress: { - m_lastEvent = event; - QGraphicsSceneMouseEvent *me = static_cast(event); - //the parent will receive events in its own coordinates - const QPointF myPos = item->mapToItem(this, me->pos()); - KDeclarativeMouseEvent dme(myPos.x(), myPos.y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - m_pressAndHoldEvent = new KDeclarativeMouseEvent(myPos.x(), myPos.y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - //kDebug() << "pressed in sceneEventFilter"; - emit pressed(&dme); - m_pressed = true; - - m_pressAndHoldTimer->start(PressAndHoldDelay); - break; - } - case QEvent::GraphicsSceneMouseMove: { - m_lastEvent = event; - QGraphicsSceneMouseEvent *me = static_cast(event); - const QPointF myPos = item->mapToItem(this, me->pos()); - KDeclarativeMouseEvent dme(myPos.x(), myPos.y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - //kDebug() << "positionChanged..." << dme.x() << dme.y(); - m_pressAndHoldEvent = new KDeclarativeMouseEvent(myPos.x(), myPos.y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - emit positionChanged(&dme); - break; - } - case QEvent::GraphicsSceneMouseRelease: { - m_lastEvent = event; - QGraphicsSceneMouseEvent *me = static_cast(event); - const QPointF myPos = item->mapToItem(this, me->pos()); - KDeclarativeMouseEvent dme(myPos.x(), myPos.y(), me->screenPos().x(), me->screenPos().y(), me->button(), me->buttons(), me->modifiers()); - m_pressed = false; - - emit released(&dme); - - if (QPointF(me->pos() - me->buttonDownPos(me->button())).manhattanLength() <= QApplication::startDragDistance() && m_pressAndHoldTimer->isActive()) { - emit clicked(&dme); - m_pressAndHoldTimer->stop(); - } - break; - } - case QEvent::GraphicsSceneWheel: { - m_lastEvent = event; - QGraphicsSceneWheelEvent *we = static_cast(event); - KDeclarativeWheelEvent dwe(we->pos(), we->screenPos(), we->delta(), we->buttons(), we->modifiers(), we->orientation()); - emit wheelMoved(&dwe); - break; - } - default: - break; - } - - return QDeclarativeItem::sceneEventFilter(item, event); -} - -#include "moc_mouseeventlistener.cpp" - diff --git a/plasma/declarativeimports/qtextracomponents/mouseeventlistener.h b/plasma/declarativeimports/qtextracomponents/mouseeventlistener.h deleted file mode 100644 index 633fa6d6..00000000 --- a/plasma/declarativeimports/qtextracomponents/mouseeventlistener.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - Copyright 2011 Marco Martin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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. -*/ - -#ifndef MOUSEEVENTLISTENER_H -#define MOUSEEVENTLISTENER_H - -#include -#include - -class KDeclarativeMouseEvent : public QObject -{ - Q_OBJECT - Q_PROPERTY(int x READ x) - Q_PROPERTY(int y READ y) - Q_PROPERTY(int screenX READ screenX) - Q_PROPERTY(int screenY READ screenY) - Q_PROPERTY(int button READ button) - Q_PROPERTY(Qt::MouseButtons buttons READ buttons) - Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers) - -public: - KDeclarativeMouseEvent(int x, int y, int screenX, int screenY, - Qt::MouseButton button, - Qt::MouseButtons buttons, - Qt::KeyboardModifiers modifiers) - : m_x(x), - m_y(y), - m_screenX(screenX), - m_screenY(screenY), - m_button(button), - m_buttons(buttons), - m_modifiers(modifiers) - {} - - int x() const { return m_x; } - int y() const { return m_y; } - int screenX() const { return m_screenX; } - int screenY() const { return m_screenY; } - int button() const { return m_button; } - Qt::MouseButtons buttons() const { return m_buttons; } - Qt::KeyboardModifiers modifiers() const { return m_modifiers; } - - // only for internal usage - void setX(int x) { m_x = x; } - void setY(int y) { m_y = y; } - -private: - int m_x; - int m_y; - int m_screenX; - int m_screenY; - Qt::MouseButton m_button; - Qt::MouseButtons m_buttons; - Qt::KeyboardModifiers m_modifiers; -}; - -class KDeclarativeWheelEvent : public QObject -{ - Q_OBJECT - Q_PROPERTY(int x READ x CONSTANT) - Q_PROPERTY(int y READ y CONSTANT) - Q_PROPERTY(int screenX READ screenX CONSTANT) - Q_PROPERTY(int screenY READ screenY CONSTANT) - Q_PROPERTY(int delta READ delta CONSTANT) - Q_PROPERTY(Qt::MouseButtons buttons READ buttons CONSTANT) - Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers CONSTANT) - Q_PROPERTY(Qt::Orientation orientation READ orientation CONSTANT) - -public: - KDeclarativeWheelEvent(QPointF pos, QPoint screenPos, int delta, - Qt::MouseButtons buttons, - Qt::KeyboardModifiers modifiers, - Qt::Orientation orientation) - : m_x(pos.x()), - m_y(pos.y()), - m_screenX(screenPos.x()), - m_screenY(screenPos.y()), - m_delta(delta), - m_buttons(buttons), - m_modifiers(modifiers), - m_orientation(orientation) - {} - - int x() const { return m_x; } - int y() const { return m_y; } - int screenX() const { return m_screenX; } - int screenY() const { return m_screenY; } - int delta() const { return m_delta; } - Qt::MouseButtons buttons() const { return m_buttons; } - Qt::KeyboardModifiers modifiers() const { return m_modifiers; } - Qt::Orientation orientation() { return m_orientation; } - - // only for internal usage - void setX(int x) { m_x = x; } - void setY(int y) { m_y = y; } - -private: - int m_x; - int m_y; - int m_screenX; - int m_screenY; - int m_delta; - Qt::MouseButtons m_buttons; - Qt::KeyboardModifiers m_modifiers; - Qt::Orientation m_orientation; -}; - -class MouseEventListener : public QDeclarativeItem -{ - Q_OBJECT - /** - * This property holds whether hover events are handled. - * By default hover events are disabled. - */ - Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) - - /** - * True if this MouseEventListener or any of its children contains the mouse cursor. - * If hoverEnabled is false, this property will change only when the mouse button is pressed. - */ - Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged) - -public: - MouseEventListener(QDeclarativeItem *parent=0); - ~MouseEventListener(); - - bool containsMouse() const; - void setHoverEnabled(bool enable); - bool hoverEnabled() const; - -protected: - void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void wheelEvent(QGraphicsSceneWheelEvent *event); - bool sceneEventFilter(QGraphicsItem *i, QEvent *e); - -Q_SIGNALS: - void pressed(KDeclarativeMouseEvent *mouse); - void positionChanged(KDeclarativeMouseEvent *mouse); - void released(KDeclarativeMouseEvent *mouse); - void clicked(KDeclarativeMouseEvent *mouse); - void pressAndHold(KDeclarativeMouseEvent *mouse); - void wheelMoved(KDeclarativeWheelEvent *wheel); - void containsMouseChanged(bool containsMouseChanged); - void hoverEnabledChanged(bool hoverEnabled); - -private Q_SLOTS: - void handlePressAndHold(); -private: - bool m_pressed; - KDeclarativeMouseEvent* m_pressAndHoldEvent; - QPointF m_pressAndHoldPosition; - //Important: used only for comparison. If you will ever need to access this pointer, make it a QWeakPointer - QEvent *m_lastEvent; - QTimer *m_pressAndHoldTimer; - bool m_containsMouse; -}; - -#endif diff --git a/plasma/declarativeimports/qtextracomponents/qiconitem.cpp b/plasma/declarativeimports/qtextracomponents/qiconitem.cpp deleted file mode 100644 index 29f157f1..00000000 --- a/plasma/declarativeimports/qtextracomponents/qiconitem.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "qiconitem.h" - -#include -#include -#include -#include - - -QIconItem::QIconItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_smooth(false), - m_state(DefaultState) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); -} - - -QIconItem::~QIconItem() -{ -} - -void QIconItem::setIcon(const QVariant &icon) -{ - if (icon.canConvert()) { - m_icon = icon.value(); - } else if(icon.canConvert()) { - m_icon = KIcon(icon.toString()); - } else { - m_icon = QIcon(); - } - update(); -} - -QIcon QIconItem::icon() const -{ - return m_icon; -} - -QIconItem::State QIconItem::state() const -{ - return m_state; -} - -void QIconItem::setState(QIconItem::State state) -{ - if (m_state == state) { - return; - } - - m_state = state; - emit stateChanged(state); - update(); -} - -int QIconItem::implicitWidth() const -{ - return KIconLoader::global()->currentSize(KIconLoader::Desktop); -} - -int QIconItem::implicitHeight() const -{ - return KIconLoader::global()->currentSize(KIconLoader::Desktop); -} - -void QIconItem::setSmooth(const bool smooth) -{ - if (smooth == m_smooth) { - return; - } - m_smooth = smooth; - update(); -} - -bool QIconItem::smooth() const -{ - return m_smooth; -} - -void QIconItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - if (m_icon.isNull()) { - return; - } - //do without painter save, faster and the support can be compiled out - const bool wasAntiAlias = painter->testRenderHint(QPainter::Antialiasing); - const bool wasSmoothTransform = painter->testRenderHint(QPainter::SmoothPixmapTransform); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); - - if (m_state == ActiveState) { - QPixmap result = m_icon.pixmap(boundingRect().size().toSize()); - result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::ActiveState); - painter->drawPixmap(0, 0, result); - } else { - m_icon.paint(painter, boundingRect().toRect(), Qt::AlignCenter, isEnabled() ? QIcon::Normal : QIcon::Disabled); - } - - painter->setRenderHint(QPainter::Antialiasing, wasAntiAlias); - painter->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothTransform); -} - - -#include "moc_qiconitem.cpp" diff --git a/plasma/declarativeimports/qtextracomponents/qiconitem.h b/plasma/declarativeimports/qtextracomponents/qiconitem.h deleted file mode 100644 index 3cb99a6f..00000000 --- a/plasma/declarativeimports/qtextracomponents/qiconitem.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 QICONITEM_H -#define QICONITEM_H - -#include -#include -#include - -class QIconItem : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QVariant icon READ icon WRITE setIcon) - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) - Q_PROPERTY(int implicitWidth READ implicitWidth CONSTANT) - Q_PROPERTY(int implicitHeight READ implicitHeight CONSTANT) - Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged) - - Q_ENUMS(State) - -public: - - enum State { - DefaultState, ///The default state. - ActiveState, ///Icon is active. - DisabledState ///Icon is disabled. - }; - - QIconItem(QDeclarativeItem *parent=0); - ~QIconItem(); - - void setIcon(const QVariant &icon); - QIcon icon() const; - - QIconItem::State state() const; - void setState(State state); - - int implicitWidth() const; - int implicitHeight() const; - - void setSmooth(const bool smooth); - bool smooth() const; - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - -Q_SIGNALS: - void stateChanged(State state); - -private: - QIcon m_icon; - bool m_smooth; - State m_state; -}; - -#endif diff --git a/plasma/declarativeimports/qtextracomponents/qimageitem.cpp b/plasma/declarativeimports/qtextracomponents/qimageitem.cpp deleted file mode 100644 index 286b3e14..00000000 --- a/plasma/declarativeimports/qtextracomponents/qimageitem.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "qimageitem.h" - -#include - - -QImageItem::QImageItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_smooth(false), - m_fillMode(QImageItem::Stretch) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); -} - - -QImageItem::~QImageItem() -{ -} - -void QImageItem::setImage(const QImage &image) -{ - bool oldImageNull = m_image.isNull(); - m_image = image; - update(); - emit nativeWidthChanged(); - emit nativeHeightChanged(); - emit imageChanged(); - if (oldImageNull != m_image.isNull()) { - emit nullChanged(); - } -} - -QImage QImageItem::image() const -{ - return m_image; -} - -void QImageItem::setSmooth(const bool smooth) -{ - if (smooth == m_smooth) { - return; - } - m_smooth = smooth; - update(); -} - -bool QImageItem::smooth() const -{ - return m_smooth; -} - -int QImageItem::nativeWidth() const -{ - return m_image.width(); -} - -int QImageItem::nativeHeight() const -{ - return m_image.height(); -} - -QImageItem::FillMode QImageItem::fillMode() const -{ - return m_fillMode; -} - -void QImageItem::setFillMode(QImageItem::FillMode mode) -{ - if (mode == m_fillMode) { - return; - } - - m_fillMode = mode; - update(); - emit fillModeChanged(); -} - -void QImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - if (m_image.isNull()) { - return; - } - painter->save(); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); - - QRect sourceRect = m_image.rect(); - QRect destRect; - switch (m_fillMode) { - case PreserveAspectFit: { - QSize scaled = m_image.size(); - - scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatio); - destRect = QRect(QPoint(0, 0), scaled); - destRect.moveCenter(boundingRect().center().toPoint()); - break; - } - case PreserveAspectCrop: { - destRect = boundingRect().toRect(); - sourceRect = destRect; - sourceRect.moveCenter(m_image.rect().center()); - break; - } - case TileVertically: { - painter->scale(width()/(qreal)m_image.width(), 1); - destRect = boundingRect().toRect(); - destRect.setWidth(destRect.width() / (width()/(qreal)m_image.width())); - break; - } - case TileHorizontally: { - painter->scale(1, height()/(qreal)m_image.height()); - destRect = boundingRect().toRect(); - destRect.setHeight(destRect.height() / (height()/(qreal)m_image.height())); - break; - } - case Stretch: - case Tile: - default: - destRect = boundingRect().toRect(); - } - - if (m_fillMode >= Tile) { - painter->drawTiledPixmap(destRect, QPixmap::fromImage(m_image)); - } else { - painter->drawImage(destRect, m_image, sourceRect); - } - - painter->restore(); -} - -bool QImageItem::isNull() const -{ - return m_image.isNull(); -} - -#include "moc_qimageitem.cpp" diff --git a/plasma/declarativeimports/qtextracomponents/qimageitem.h b/plasma/declarativeimports/qtextracomponents/qimageitem.h deleted file mode 100644 index 7dd1aa36..00000000 --- a/plasma/declarativeimports/qtextracomponents/qimageitem.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 QIMAGEITEM_H -#define QIMAGEITEM_H - -#include -#include - -class QImageItem : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged) - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) - Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) - Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) - Q_PROPERTY(bool null READ isNull NOTIFY nullChanged) - Q_ENUMS(FillMode) - -public: - enum FillMode { - Stretch, // the image is scaled to fit - PreserveAspectFit, // the image is scaled uniformly to fit without cropping - PreserveAspectCrop, // the image is scaled uniformly to fill, cropping if necessary - Tile, // the image is duplicated horizontally and vertically - TileVertically, // the image is stretched horizontally and tiled vertically - TileHorizontally //the image is stretched vertically and tiled horizontally - }; - - QImageItem(QDeclarativeItem *parent=0); - ~QImageItem(); - - void setImage(const QImage &image); - QImage image() const; - - void setSmooth(const bool smooth); - bool smooth() const; - - int nativeWidth() const; - int nativeHeight() const; - - FillMode fillMode() const; - void setFillMode(FillMode mode); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - bool isNull() const; - -Q_SIGNALS: - void nativeWidthChanged(); - void nativeHeightChanged(); - void fillModeChanged(); - void imageChanged(); - void nullChanged(); - -private: - QImage m_image; - bool m_smooth; - FillMode m_fillMode; -}; - -#endif diff --git a/plasma/declarativeimports/qtextracomponents/qmldir b/plasma/declarativeimports/qtextracomponents/qmldir deleted file mode 100644 index b2452e3f..00000000 --- a/plasma/declarativeimports/qtextracomponents/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -plugin qtextracomponentsplugin - - diff --git a/plasma/declarativeimports/qtextracomponents/qpixmapitem.cpp b/plasma/declarativeimports/qtextracomponents/qpixmapitem.cpp deleted file mode 100644 index 3d76d92e..00000000 --- a/plasma/declarativeimports/qtextracomponents/qpixmapitem.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "qpixmapitem.h" - -#include - - -QPixmapItem::QPixmapItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_smooth(false), - m_fillMode(QPixmapItem::Stretch) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); -} - - -QPixmapItem::~QPixmapItem() -{ -} - -void QPixmapItem::setPixmap(const QPixmap &pixmap) -{ - bool oldPixmapNull = m_pixmap.isNull(); - m_pixmap = pixmap; - update(); - emit nativeWidthChanged(); - emit nativeHeightChanged(); - emit pixmapChanged(); - if (oldPixmapNull != m_pixmap.isNull()) { - emit nullChanged(); - } -} - -QPixmap QPixmapItem::pixmap() const -{ - return m_pixmap; -} - -void QPixmapItem::setSmooth(const bool smooth) -{ - if (smooth == m_smooth) { - return; - } - m_smooth = smooth; - update(); -} - -bool QPixmapItem::smooth() const -{ - return m_smooth; -} - -int QPixmapItem::nativeWidth() const -{ - return m_pixmap.width(); -} - -int QPixmapItem::nativeHeight() const -{ - return m_pixmap.height(); -} - -QPixmapItem::FillMode QPixmapItem::fillMode() const -{ - return m_fillMode; -} - -void QPixmapItem::setFillMode(QPixmapItem::FillMode mode) -{ - if (mode == m_fillMode) { - return; - } - - m_fillMode = mode; - update(); - emit fillModeChanged(); -} - -void QPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - if (m_pixmap.isNull()) { - return; - } - painter->save(); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); - - QRect sourceRect = m_pixmap.rect(); - QRect destRect; - switch (m_fillMode) { - case PreserveAspectFit: { - QSize scaled = m_pixmap.size(); - - scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatio); - destRect = QRect(QPoint(0, 0), scaled); - destRect.moveCenter(boundingRect().center().toPoint()); - break; - } - case PreserveAspectCrop: { - destRect = boundingRect().toRect(); - sourceRect = destRect; - sourceRect.moveCenter(m_pixmap.rect().center()); - break; - } - case TileVertically: { - painter->scale(width()/(qreal)m_pixmap.width(), 1); - destRect = boundingRect().toRect(); - destRect.setWidth(destRect.width() / (width()/(qreal)m_pixmap.width())); - break; - } - case TileHorizontally: { - painter->scale(1, height()/(qreal)m_pixmap.height()); - destRect = boundingRect().toRect(); - destRect.setHeight(destRect.height() / (height()/(qreal)m_pixmap.height())); - break; - } - case Stretch: - case Tile: - default: - destRect = boundingRect().toRect(); - } - - if (m_fillMode >= Tile) { - painter->drawTiledPixmap(destRect, m_pixmap); - } else { - painter->drawPixmap(destRect, m_pixmap, m_pixmap.rect()); - } - - painter->restore(); -} - -bool QPixmapItem::isNull() const -{ - return m_pixmap.isNull(); -} - -#include "moc_qpixmapitem.cpp" diff --git a/plasma/declarativeimports/qtextracomponents/qpixmapitem.h b/plasma/declarativeimports/qtextracomponents/qpixmapitem.h deleted file mode 100644 index c87540b0..00000000 --- a/plasma/declarativeimports/qtextracomponents/qpixmapitem.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 QPIXMAPITEM_H -#define QPIXMAPITEM_H - -#include -#include - -class QPixmapItem : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap NOTIFY pixmapChanged) - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) - Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) - Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) - Q_PROPERTY(bool null READ isNull NOTIFY nullChanged) - Q_ENUMS(FillMode) - -public: - enum FillMode { - Stretch, // the image is scaled to fit - PreserveAspectFit, // the image is scaled uniformly to fit without cropping - PreserveAspectCrop, // the image is scaled uniformly to fill, cropping if necessary - Tile, // the image is duplicated horizontally and vertically - TileVertically, // the image is stretched horizontally and tiled vertically - TileHorizontally //the image is stretched vertically and tiled horizontally - }; - - QPixmapItem(QDeclarativeItem *parent=0); - ~QPixmapItem(); - - void setPixmap(const QPixmap &pixmap); - QPixmap pixmap() const; - - void setSmooth(const bool smooth); - bool smooth() const; - - int nativeWidth() const; - int nativeHeight() const; - - FillMode fillMode() const; - void setFillMode(FillMode mode); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - - bool isNull() const; - -Q_SIGNALS: - void nativeWidthChanged(); - void nativeHeightChanged(); - void fillModeChanged(); - void pixmapChanged(); - void nullChanged(); - -private: - QPixmap m_pixmap; - bool m_smooth; - FillMode m_fillMode; -}; - -#endif diff --git a/plasma/declarativeimports/qtextracomponents/qtextracomponentsplugin.cpp b/plasma/declarativeimports/qtextracomponents/qtextracomponentsplugin.cpp deleted file mode 100644 index 8f863b34..00000000 --- a/plasma/declarativeimports/qtextracomponents/qtextracomponentsplugin.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - * Copyright 2010 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "qtextracomponentsplugin.h" - -#include - -#include "qpixmapitem.h" -#include "qimageitem.h" -#include "qiconitem.h" -#include "mouseeventlistener.h" - -void QtExtraComponentsPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.qtextracomponents")); - - qmlRegisterType(uri, 0, 1, "QPixmapItem"); - qmlRegisterType(uri, 0, 1, "QImageItem"); - qmlRegisterType(uri, 0, 1, "QIconItem"); - qmlRegisterType(uri, 0, 1, "MouseEventListener"); -} - - -#include "moc_qtextracomponentsplugin.cpp" - diff --git a/plasma/declarativeimports/qtextracomponents/qtextracomponentsplugin.h b/plasma/declarativeimports/qtextracomponents/qtextracomponentsplugin.h deleted file mode 100644 index 88d46808..00000000 --- a/plasma/declarativeimports/qtextracomponents/qtextracomponentsplugin.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - * Copyright 2011 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 QTEXTRACOMPONENTSPLUGIN_H -#define QTEXTRACOMPONENTSPLUGIN_H - -#include - - -class QtExtraComponentsPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - void registerTypes(const char *uri); -}; - -Q_EXPORT_PLUGIN(QtExtraComponentsPlugin); - -#endif diff --git a/plasma/runners/CMakeLists.txt b/plasma/runners/CMakeLists.txt index 05aeccc6..e2ad3627 100644 --- a/plasma/runners/CMakeLists.txt +++ b/plasma/runners/CMakeLists.txt @@ -1,8 +1,6 @@ add_subdirectory(bookmarks) -add_subdirectory(calculator) add_subdirectory(locations) add_subdirectory(places) -add_subdirectory(plasma-desktop) add_subdirectory(services) add_subdirectory(recentdocuments) add_subdirectory(shell) @@ -13,3 +11,7 @@ add_subdirectory(powerdevil) add_subdirectory(sessions) add_subdirectory(windows) add_subdirectory(kill) + +if (QALCULATE_FOUND) + add_subdirectory(calculator) +endif() \ No newline at end of file diff --git a/plasma/runners/bookmarks/CMakeLists.txt b/plasma/runners/bookmarks/CMakeLists.txt index 3dc97541..401b3305 100644 --- a/plasma/runners/bookmarks/CMakeLists.txt +++ b/plasma/runners/bookmarks/CMakeLists.txt @@ -14,7 +14,6 @@ kde4_add_plugin(krunner_bookmarksrunner ${krunner_bookmarksrunner_SRCS}) target_link_libraries(krunner_bookmarksrunner KDE4::kio KDE4::plasma - ${QT_QTSCRIPT_LIBRARY} ${QT_QTDBUS_LIBRARY} ) diff --git a/plasma/runners/calculator/CMakeLists.txt b/plasma/runners/calculator/CMakeLists.txt index d8ba4d1d..cf3f76cb 100644 --- a/plasma/runners/calculator/CMakeLists.txt +++ b/plasma/runners/calculator/CMakeLists.txt @@ -1,38 +1,32 @@ +include_directories(${QALCULATE_INCLUDE_DIR}) + ########### next target ############### set(krunner_calculatorrunner_SRCS calculatorrunner.cpp + qalculate_engine.cpp ) -if ( QALCULATE_FOUND ) - include_directories(${QALCULATE_INCLUDE_DIR}) - add_definitions(-DENABLE_QALCULATE) - - set(krunner_calculatorrunner_SRCS - ${krunner_calculatorrunner_SRCS} - qalculate_engine.cpp - ) - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") -endif( QALCULATE_FOUND ) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") kde4_add_plugin(krunner_calculatorrunner ${krunner_calculatorrunner_SRCS}) target_link_libraries(krunner_calculatorrunner KDE4::kdeui KDE4::plasma - ${QT_QTSCRIPT_LIBRARY} + KDE4::solid + KDE4::kio + ${QALCULATE_LIBRARIES} ) -if ( QALCULATE_FOUND ) - target_link_libraries(krunner_calculatorrunner - KDE4::solid - KDE4::kio - ${QALCULATE_LIBRARIES} - ) -endif ( QALCULATE_FOUND ) - -install(TARGETS krunner_calculatorrunner DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) +install( + TARGETS krunner_calculatorrunner + DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} +) ########### install files ############### -install(FILES plasma-runner-calculator.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) + +install( + FILES plasma-runner-calculator.desktop + DESTINATION ${KDE4_SERVICES_INSTALL_DIR} +) diff --git a/plasma/runners/calculator/calculatorrunner.cpp b/plasma/runners/calculator/calculatorrunner.cpp index d96430ec..c1522637 100644 --- a/plasma/runners/calculator/calculatorrunner.cpp +++ b/plasma/runners/calculator/calculatorrunner.cpp @@ -20,12 +20,7 @@ */ #include "calculatorrunner.h" - -#ifdef ENABLE_QALCULATE #include "qalculate_engine.h" -#else -#include -#endif #include #include @@ -35,12 +30,8 @@ CalculatorRunner::CalculatorRunner( QObject* parent, const QVariantList &args ) : Plasma::AbstractRunner(parent, args) { - Q_UNUSED(args) - -#ifdef ENABLE_QALCULATE m_engine = new QalculateEngine(); setSpeed(SlowSpeed); -#endif setObjectName( QLatin1String("Calculator" )); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | @@ -56,9 +47,7 @@ CalculatorRunner::CalculatorRunner( QObject* parent, const QVariantList &args ) CalculatorRunner::~CalculatorRunner() { -#ifdef ENABLE_QALCULATE delete m_engine; -#endif } void CalculatorRunner::powSubstitutions(QString& cmd) @@ -177,24 +166,8 @@ void CalculatorRunner::userFriendlySubstitutions(QString& cmd) { const QChar decimalSymbol = KGlobal::locale()->toLocale().decimalPoint(); if (cmd.contains(decimalSymbol, Qt::CaseInsensitive)) { - cmd=cmd.replace(decimalSymbol, QChar('.'), Qt::CaseInsensitive); + cmd = cmd.replace(decimalSymbol, QChar('.'), Qt::CaseInsensitive); } - - // the following substitutions are not needed with libqalculate -#ifndef ENABLE_QALCULATE - hexSubstitutions(cmd); - powSubstitutions(cmd); - - if (cmd.contains(QRegExp("\\d+and\\d+"))) { - cmd = cmd.replace(QRegExp("(\\d+)and(\\d+)"), "\\1&\\2"); - } - if (cmd.contains(QRegExp("\\d+or\\d+"))) { - cmd = cmd.replace(QRegExp("(\\d+)or(\\d+)"), "\\1|\\2"); - } - if (cmd.contains(QRegExp("\\d+xor\\d+"))) { - cmd = cmd.replace(QRegExp("(\\d+)xor(\\d+)"), "\\1^\\2"); - } -#endif } @@ -239,9 +212,6 @@ void CalculatorRunner::match(Plasma::RunnerContext &context) } userFriendlySubstitutions(cmd); -#ifndef ENABLE_QALCULATE - cmd.replace(QRegExp("([a-zA-Z]+)"), "Math.\\1"); //needed for accessing math functions like sin(),.... -#endif QString result = calculate(cmd); if (!result.isEmpty() && result != cmd) { @@ -262,37 +232,8 @@ void CalculatorRunner::match(Plasma::RunnerContext &context) QString CalculatorRunner::calculate(const QString& term) { const QChar decimalSymbol = KGlobal::locale()->toLocale().decimalPoint(); -#ifdef ENABLE_QALCULATE QString result = m_engine->evaluate(term); return result.replace('.', decimalSymbol, Qt::CaseInsensitive); -#else - //kDebug() << "calculating" << term; - QScriptEngine eng; - QScriptValue result = eng.evaluate(" var result ="+term+"; result"); - - if (result.isError()) { - return QString(); - } - - const QString resultString = result.toString(); - if (resultString.isEmpty()) { - return QString(); - } - - if (!resultString.contains('.')) { - return resultString; - } - - //ECMAScript has issues with the last digit in simple rational computations - //This script rounds off the last digit; see bug 167986 - QString roundedResultString = eng.evaluate("var exponent = 14-(1+Math.floor(Math.log(Math.abs(result))/Math.log(10)));\ - var order=Math.pow(10,exponent);\ - (order > 0? Math.round(result*order)/order : 0)").toString(); - - roundedResultString.replace('.', decimalSymbol, Qt::CaseInsensitive); - - return roundedResultString; -#endif // ENABLE_QALCULATE } QMimeData * CalculatorRunner::mimeDataForMatch(const Plasma::QueryMatch *match) diff --git a/plasma/runners/calculator/calculatorrunner.h b/plasma/runners/calculator/calculatorrunner.h index cfebfb96..cfcc553c 100644 --- a/plasma/runners/calculator/calculatorrunner.h +++ b/plasma/runners/calculator/calculatorrunner.h @@ -21,13 +21,10 @@ #define CALCULATORRUNNER_H #include - -#ifdef ENABLE_QALCULATE -class QalculateEngine; -#endif - #include +class QalculateEngine; + /** * This class evaluates the basic expressions given in the interface. */ @@ -50,9 +47,7 @@ class CalculatorRunner : public Plasma::AbstractRunner void powSubstitutions(QString& cmd); void hexSubstitutions(QString& cmd); -#ifdef ENABLE_QALCULATE QalculateEngine* m_engine; -#endif }; K_EXPORT_PLASMA_RUNNER(calculatorrunner, CalculatorRunner) diff --git a/plasma/runners/plasma-desktop/CMakeLists.txt b/plasma/runners/plasma-desktop/CMakeLists.txt deleted file mode 100644 index c55de660..00000000 --- a/plasma/runners/plasma-desktop/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -set(krunner_plasma-desktop_SRCS - plasma-desktop-runner.cpp -) - -kde4_add_plugin(krunner_plasma-desktop ${krunner_plasma-desktop_SRCS}) -target_link_libraries(krunner_plasma-desktop KDE4::kio KDE4::plasma) - -install(TARGETS krunner_plasma-desktop DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) -install(FILES plasma-runner-plasma-desktop.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) - diff --git a/plasma/runners/plasma-desktop/Messages.sh b/plasma/runners/plasma-desktop/Messages.sh deleted file mode 100755 index 22b131e0..00000000 --- a/plasma/runners/plasma-desktop/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/plasma_runner_plasma-desktop.pot -rm -f rc.cpp diff --git a/plasma/runners/plasma-desktop/plasma-desktop-runner.cpp b/plasma/runners/plasma-desktop/plasma-desktop-runner.cpp deleted file mode 100644 index 78c1e83a..00000000 --- a/plasma/runners/plasma-desktop/plasma-desktop-runner.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2009 Aaron Seigo - * - * This program 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 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 Library 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 "plasma-desktop-runner.h" - -#include -#include -#include - -#include -#include -#include -#include - -#include - -static const QString s_plasmaService = "org.kde.plasma-desktop"; -static const char* s_desktopConsole = "desktop console"; - -PlasmaDesktopRunner::PlasmaDesktopRunner(QObject *parent, const QVariantList &args) - : Plasma::AbstractRunner(parent, args), - m_desktopConsoleKeyword(i18nc("Note this is a KRunner keyword", s_desktopConsole)), - m_enabled(false) -{ - setObjectName( QLatin1String("Plasma-Desktop" )); - setIgnoredTypes(Plasma::RunnerContext::FileSystem | - Plasma::RunnerContext::NetworkLocation | - Plasma::RunnerContext::Help); - QDBusServiceWatcher *watcher = new QDBusServiceWatcher(s_plasmaService, QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForOwnerChange, this); - connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(checkAvailability(QString,QString,QString))); - checkAvailability(QString(), QString(), QString()); -} - -PlasmaDesktopRunner::~PlasmaDesktopRunner() -{ -} - -void PlasmaDesktopRunner::match(Plasma::RunnerContext &context) -{ - const QString query = context.query(); - bool matches = query.startsWith(m_desktopConsoleKeyword, Qt::CaseInsensitive); - if (!matches) { - matches = query.startsWith(QLatin1String(s_desktopConsole), Qt::CaseInsensitive); - } - if (m_enabled && matches) { - Plasma::QueryMatch match(this); - match.setId("plasma-desktop-console"); - match.setType(Plasma::QueryMatch::ExactMatch); - match.setIcon(KIcon("plasma")); - match.setText(i18n("Open Plasma desktop interactive console")); - match.setRelevance(1.0); - context.addMatch(context.query(), match); - } -} - -void PlasmaDesktopRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) -{ - Q_UNUSED(match) - - if (m_enabled) { - QDBusMessage message; - - QString query = context.query(); - if (query.compare(m_desktopConsoleKeyword, Qt::CaseInsensitive) == 0 - || query.compare(QLatin1String(s_desktopConsole), Qt::CaseInsensitive) == 0) { - message = QDBusMessage::createMethodCall(s_plasmaService, "/MainApplication", - QString(), "showInteractiveConsole"); - } else if (query.startsWith(m_desktopConsoleKeyword)) { - message = QDBusMessage::createMethodCall(s_plasmaService, "/MainApplication", - QString(), "loadScriptInInteractiveConsole"); - query.replace(m_desktopConsoleKeyword, QString(), Qt::CaseInsensitive); - QList args; - args << query; - message.setArguments(args); - } - - QDBusConnection::sessionBus().asyncCall(message); - } -} - -void PlasmaDesktopRunner::checkAvailability(const QString &name, const QString &oldOwner, const QString &newOwner) -{ - Q_UNUSED(oldOwner) - - bool enabled = false; - if (name.isEmpty()) { - enabled = QDBusConnection::sessionBus().interface()->isServiceRegistered(s_plasmaService).value(); - } else { - enabled = !newOwner.isEmpty(); - } - - if (m_enabled != enabled) { - m_enabled = enabled; - - if (m_enabled) { - addSyntax(Plasma::RunnerSyntax(m_desktopConsoleKeyword, - i18n("Opens the Plasma desktop interactive console " - "with a file path to a script on disk."))); - addSyntax(Plasma::RunnerSyntax(i18nc("Note this is a KRunner keyword", "desktop console :q:"), - i18n("Opens the Plasma desktop interactive console " - "with a file path to a script on disk."))); - } else { - setSyntaxes(QList()); - } - } -} - - -#include "moc_plasma-desktop-runner.cpp" diff --git a/plasma/runners/plasma-desktop/plasma-desktop-runner.h b/plasma/runners/plasma-desktop/plasma-desktop-runner.h deleted file mode 100644 index 227748de..00000000 --- a/plasma/runners/plasma-desktop/plasma-desktop-runner.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Aaron Seigo - * - * This program 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 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 Library 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 PLASMADESKTOPRUNNER_H -#define PLASMADESKTOPRUNNER_H - -#include - - -/** - * This class runs programs using the literal name of the binary, much as one - * would use at a shell prompt. - */ -class PlasmaDesktopRunner : public Plasma::AbstractRunner -{ - Q_OBJECT - - public: - PlasmaDesktopRunner(QObject *parent, const QVariantList &args); - ~PlasmaDesktopRunner(); - - void match(Plasma::RunnerContext &context); - void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action); - - private slots: - void checkAvailability(const QString &name, const QString &oldOwner, const QString &newOwner); - - private: - const QString m_desktopConsoleKeyword; - bool m_enabled; -}; - -K_EXPORT_PLASMA_RUNNER(plasma-desktop, PlasmaDesktopRunner) - -#endif diff --git a/plasma/runners/plasma-desktop/plasma-runner-plasma-desktop.desktop b/plasma/runners/plasma-desktop/plasma-runner-plasma-desktop.desktop deleted file mode 100644 index 6b852cac..00000000 --- a/plasma/runners/plasma-desktop/plasma-runner-plasma-desktop.desktop +++ /dev/null @@ -1,139 +0,0 @@ -[Desktop Entry] -Name=Plasma Desktop Shell -Name[ar]=قشرة سطح المكتب بلازما -Name[ast]=Shell d'escritoriu Plasma -Name[bg]=Настолна обвивка Plasma -Name[bs]=Plazma školjka površi -Name[ca]=Intèrpret d'ordres de l'escriptori Plasma -Name[ca@valencia]=Intèrpret d'ordes de l'escriptori Plasma -Name[cs]=Pracovní plocha Plasma -Name[da]=Plasma Desktop Shell -Name[de]=Plasma-Umgebung -Name[el]=Κέλυφος επιφάνειας εργασίας Plasma -Name[en_GB]=Plasma Desktop Shell -Name[eo]=Plasma Labortabla ŝelo -Name[es]=Shell de escritorio Plasma -Name[et]=Plasma töölauakest -Name[eu]=Plasma mahaigainaren shell-a -Name[fi]=Plasma-työpöytäkuori -Name[fr]=Shell du bureau Plasma -Name[fy]=Plasma buroblêdflues -Name[ga]=Blaosc dheisce Plasma -Name[gl]=Shell de escritorio Plasma -Name[gu]=પ્લાઝમા ડેસ્કટોપ શેલ -Name[he]=מעטפת שולחן העבודה של Plasma -Name[hi]=प्लाज्मा डेस्कटॉप शेल -Name[hr]=Plasma ljuska radne površine -Name[hu]=Plazma asztali héj -Name[ia]=Shell de scriptorio de Plasma -Name[id]=Shell Desktop Plasma -Name[is]=Plasma skjáborðsskel -Name[it]=Shell del desktop di Plasma -Name[ja]=Plasma デスクトップシェル -Name[kk]=Plasma үстел ортасы -Name[km]=សែល​ផ្ទៃតុ​ប្លាស្មា -Name[kn]=ಪ್ಲಾಸ್ಮಾ ಗಣಕತೆರೆ ಶೆಲ್ -Name[ko]=Plasma 데스크톱 셸 -Name[lt]=Plasma darbastalio erdvė -Name[lv]=Plasma darbvirsmas čaula -Name[ml]=പ്ലാസ്മ പണിയിട ആവരണം -Name[mr]=प्लाज्मा डेस्कटॉप शेल -Name[nb]=Plasma skrivebordsskall -Name[nds]=Plasma-Schriefdischkonsool -Name[nl]=Plasma Bureaublad-shell -Name[nn]=Skrivebordsskal for Plasma -Name[pa]=ਪਲਾਜ਼ਮਾ ਡੈਸਕਟਾਪ ਸ਼ੈੱਲ -Name[pl]=Powłoka pulpitu Plazmy -Name[pt]=Consola de Ecrã do Plasma -Name[pt_BR]=Shell do Plasma Desktop -Name[ro]=Învelișul de birou Plasma -Name[ru]=Консоль сценариев Plasma -Name[si]=ප්ලාස්මා වැඩතල ශෙලය -Name[sk]=Shell plochy Plasma -Name[sl]=Namizna lupina Plasma -Name[sr]=Плазма шкољка површи -Name[sr@ijekavian]=Плазма шкољка површи -Name[sr@ijekavianlatin]=Plasma školjka površi -Name[sr@latin]=Plasma školjka površi -Name[sv]=Plasma skrivbordskal -Name[tg]=Пустаи мизи кории Plasma -Name[th]=เชลล์พื้นที่ทำงานแบบพลาสมา -Name[tr]=Plasma Masaüstü Kabuğu -Name[ug]=پلازما ئۈستەلئۈستى Shell ئى -Name[uk]=Оболонка стільниці Плазми -Name[wa]=Shell do scribanne Plasma -Name[x-test]=xxPlasma Desktop Shellxx -Name[zh_CN]=Plasma 桌面外壳 -Name[zh_TW]=Plasma 桌面 shell -Comment=Interact with the Plasma desktop shell -Comment[ar]=تفاعل مع قشرة سطح المكتب بلازما -Comment[ast]=Interactuar cola interface del escritoriu Plasma -Comment[bs]=Pozabavite se plazma školjkom površi -Comment[ca]=Interactua amb l'intèrpret d'ordres de l'escriptori Plasma -Comment[ca@valencia]=Interactua amb l'intèrpret d'ordes de l'escriptori Plasma -Comment[cs]=Interakce se shellem pracovní plochy plasmy -Comment[da]=Interaktion med Plasma desktop-skal -Comment[de]=Interaktion mit der Plasma-Shell -Comment[el]=Αλληλεπίδραση με το κέλυφος επιφάνειας εργασίας Plasma -Comment[en_GB]=Interact with the Plasma desktop shell -Comment[es]=Interactuar con la interfaz del escritorio Plasma -Comment[et]=Suhtlus Plasma töölauakestaga -Comment[eu]=Elkarreraginean jardun Plasma mahaigainaren shell-arekin -Comment[fi]=Ole vuorovaikutuksessa Plasma-työpöytäkuoren kanssa -Comment[fr]=Interagit avec le shell du bureau Plasma -Comment[fy]=Ynteraksje mei de Plasma buroblêd flues -Comment[ga]=Bain úsáid as blaosc dheisce Plasma -Comment[gl]=Interactúa coa shell de escritorio Plasma -Comment[he]=אינטראקציה עם מעטפת שולחן העבודה של Plasma -Comment[hr]=Interakcija s Plasma ljuskom radne površine -Comment[hu]=Interakció a Plasma asztali héjjal -Comment[ia]=Interage con le shell de scriptorio de Plasma -Comment[id]=Interaksi dengan shell desktop Plasma -Comment[is]=Gagnvirkni með Plasma skjáborðsskelinni -Comment[it]=Interagisci con la shell del desktop di Plasma -Comment[ja]=Plasma デスクトップシェルと対話 -Comment[kk]=Plasma үстел қоршау-ортасымен әркеттесу -Comment[km]=មាន​ទំនាក់ទំនង​ជា​មួយ​នឹង​សែល​ផ្ទៃតុ​​ប្លាស្មា -Comment[kn]=ಪ್ಲಾಸ್ಮಾ ಗಣಕತೆರೆ ಶೆಲ್‌ನೊಂದಿಗೆ ವ್ಯವಹರಿಸು -Comment[ko]=Plasma 데스크톱 셸 사용하기 -Comment[lt]=Interakcija su Plasma darbastalio erdve -Comment[lv]=Iedarboties uz Plasma darbvirsmas čaulu -Comment[ml]=പ്ലാസ്മ പണിയിട ഷെല്ലുമായി പരസ്പരവിനിമയം നടത്തുക -Comment[mr]=प्लाज्मा डेस्कटॉप शेल बरोबर संवाद -Comment[nb]=Arbeid med Plasma skrivebordsskallet -Comment[nds]=Mit den Plasma-Schriefdischkieker snacken -Comment[nl]=Interactie met de Plasma bureaublad-shell -Comment[nn]=Bruk Plasma-skrivebordsskalet -Comment[pa]=ਪਲਾਜ਼ਮਾ ਡੈਸਕਟਾਪ ਸ਼ੈੱਲ ਨਾਲ ਕੰਮ -Comment[pl]=Współdziałanie z powłoką pulpitu Plazmy -Comment[pt]=Interagir com a consola do ambiente de trabalho Plasma -Comment[pt_BR]=Interage com a shell do Plasma Desktop -Comment[ro]=Interacționați cu învelișul de birou Plasma -Comment[ru]=Инструмент взаимодействия с оболочкой Plasma -Comment[si]=ප්ලාස්මා වැඩතල ශෙලය සමඟ අන්තර්ක්‍රියාකාරී -Comment[sk]=Interakcia so shellom plochy Plasma -Comment[sl]=Uporabljajte Namizno lupino Plasma -Comment[sr]=Позабавите се плазма шкољком површи -Comment[sr@ijekavian]=Позабавите се плазма шкољком површи -Comment[sr@ijekavianlatin]=Pozabavite se plasma školjkom površi -Comment[sr@latin]=Pozabavite se plasma školjkom površi -Comment[sv]=Interaktion med Plasma skrivbordsskal -Comment[th]=ใช้งานผ่านทางเชลล์พื้นที่ทำงานแบบพลาสมา -Comment[tr]=Plasma Masaüstü Kabuğu ile etkileş -Comment[ug]=پلازما ئۈستەلئۈستى بىلەن مۇناسىۋەتلىشىدۇ -Comment[uk]=Взаємодія з оболонкою стільниці Плазма -Comment[vi]=Tương tác với vỏ Plasma -Comment[wa]=Ovrer d' façon interactive avou l' shell do scribanne Plasma -Comment[x-test]=xxInteract with the Plasma desktop shellxx -Comment[zh_CN]=和 Plasma 桌面外壳进行交互 -Comment[zh_TW]=與 Plasma 桌面 shell 互動 -X-KDE-ServiceTypes=Plasma/Runner -Type=Service -Icon=plasma -X-KDE-Library=krunner_plasma-desktop -X-KDE-PluginInfo-Author=Plasma Team -X-KDE-PluginInfo-Email=plasma-devel@kde.org -X-KDE-PluginInfo-Name=plasma-desktop -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/plasma/scriptengine/CMakeLists.txt b/plasma/scriptengine/CMakeLists.txt deleted file mode 100644 index 77741e94..00000000 --- a/plasma/scriptengine/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -#DECLARATIVE APPLET -set(declarative_appletscript_SRCS - common/extension_launchapp.cpp - common/extension_io.cpp - common/scriptenv.cpp - declarative/toolboxproxy.cpp - declarative/appletcontainer.cpp - declarative/declarativeitemcontainer.cpp - plasmoid/abstractjsappletscript.cpp - plasmoid/appletinterface.cpp - plasmoid/declarativeappletscript.cpp - plasmoid/themedsvg.cpp - simplebindings/bytearrayclass.cpp - simplebindings/bytearrayprototype.cpp - simplebindings/dataengine.cpp - simplebindings/dataenginereceiver.cpp - simplebindings/filedialogproxy.cpp - simplebindings/qscriptbookkeeping.cpp - simplebindings/url.cpp - simplebindings/point.cpp -) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common) - -set_source_files_properties( - ${CMAKE_CURRENT_SOURCE_DIR}/common/extension_launchapp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/simplebindings/qscriptbookkeeping.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/simplebindings/bytearrayprototype.cpp - PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE -) - -kde4_add_plugin(plasma_appletscript_declarative ${declarative_appletscript_SRCS}) -target_link_libraries(plasma_appletscript_declarative - KDE4::plasma - KDE4::kio - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTUITOOLS_LIBRARY} - -) - - -install(TARGETS plasma_appletscript_declarative DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) -install(FILES data/plasma-scriptengine-applet-declarative.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) - - diff --git a/plasma/scriptengine/Messages.sh b/plasma/scriptengine/Messages.sh deleted file mode 100644 index 8f090c9e..00000000 --- a/plasma/scriptengine/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT common/*.cpp plasmoid/*.cpp simplebindings/*.cpp -o $podir/plasma_scriptengine_qscript.pot diff --git a/plasma/scriptengine/common/extension_io.cpp b/plasma/scriptengine/common/extension_io.cpp deleted file mode 100644 index d6e23039..00000000 --- a/plasma/scriptengine/common/extension_io.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2011 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "scriptenv.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include - -QScriptValue ScriptEnv::openUrl(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - QScriptValue v = context->argument(0); - KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast(v); - - if (!url.isValid()) { - return false; - } - - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - if (!env) { - return false; - } - - new KRun(url, 0); - return true; -} - -// TODO these should throw an exception -QScriptValue ScriptEnv::getUrl(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return engine->undefinedValue(); - } - - QScriptValue v = context->argument(0); - KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast(v); - - if (!url.isValid()) { - return engine->undefinedValue(); - } - - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - if (!env) { - //kDebug() << "findScriptEnv failed"; - return engine->undefinedValue(); - } - - KIO::Job *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo); - return engine->newQObject(job); -} - -QScriptValue ScriptEnv::download(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return engine->undefinedValue(); - } - - QScriptValue v = context->argument(0); - KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast(v); - - if (!url.isValid()) { - return engine->undefinedValue(); - } - - QString requestedFileName; - if (context->argumentCount() > 1) { - requestedFileName = context->argument(1).toString(); - } - - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - if (!env) { - //kDebug() << "findScriptEnv failed"; - return engine->undefinedValue(); - } - - QStringList protocols; - protocols << "http" << "https" << "ftp" << "ftps"; - if (!protocols.contains(url.protocol())) { - return engine->undefinedValue(); - } - - QScriptContext *c = engine->currentContext(); - QString destination; - while (c) { - QScriptValue v = c->activationObject().property("__plasma_package"); - if (v.isVariant()) { - KDesktopFile config(v.toVariant().value().path() + "/metadata.desktop"); - KConfigGroup cg = config.desktopGroup(); - const QString pluginName = cg.readEntry("X-KDE-PluginInfo-Name", QString()); - destination = KGlobalSettings::downloadPath() + "Plasma/" + pluginName + '/'; - break; - } - - c = c->parentContext(); - } - - if (destination.isEmpty()) { - return engine->undefinedValue(); - } - - requestedFileName.prepend(destination); - QDir dir(requestedFileName); - dir.mkpath(destination); - if (!dir.absolutePath().startsWith(destination)) { - requestedFileName = destination; - } - - //TODO: allow showing desktop progress info? - KIO::CopyJob *job = KIO::copy(url, KUrl(requestedFileName), KIO::HideProgressInfo); - return engine->newQObject(job); -} - -QScriptValue ScriptEnv::userDataPath(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return QDir::homePath(); - } - - const QString type = context->argument(0).toString(); - if (type.isEmpty()) { - return QDir::homePath(); - } - - if (context->argumentCount() > 1) { - const QString filename = context->argument(1).toString(); - return KStandardDirs::locateLocal(type.toLatin1(), filename); - } - - if (type.compare("desktop", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::desktopPath(); - } else if (type.compare("documents", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::documentPath(); - } else if (type.compare("music", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::musicPath(); - } else if (type.compare("video", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::videosPath(); - } else if (type.compare("downloads", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::downloadPath(); - } else if (type.compare("pictures", Qt::CaseInsensitive) == 0) { - return KGlobalSettings::picturesPath(); - } - - return QString(); -} - -void ScriptEnv::registerGetUrl(QScriptValue &obj) -{ - QScriptValue get = obj.property("getUrl"); - if (!get.isValid()) { - obj.setProperty("getUrl", m_engine->newFunction(ScriptEnv::getUrl)); - } -} - -void ScriptEnv::registerOpenUrl(QScriptValue &obj) -{ - QScriptValue value = obj.property("openUrl"); - if (!value.isValid()) { - obj.setProperty("openUrl", m_engine->newFunction(ScriptEnv::openUrl)); - } -} - - diff --git a/plasma/scriptengine/common/extension_launchapp.cpp b/plasma/scriptengine/common/extension_launchapp.cpp deleted file mode 100644 index 03c636e1..00000000 --- a/plasma/scriptengine/common/extension_launchapp.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2011 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "scriptenv.h" - -#include -#include -#include -#include -#include - -QScriptValue ScriptEnv::runApplication(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - KUrl::List urls; - if (context->argumentCount() > 1) { - urls = qscriptvalue_cast(context->argument(1)); - } - - const QString app = context->argument(0).toString(); - - const QString exec = KGlobal::dirs()->findExe(app); - if (!exec.isEmpty()) { - return KRun::run(exec, urls, 0); - } - - KService::Ptr service = KService::serviceByStorageId(app); - if (service) { - return KRun::run(*service, urls, 0); - } - - return false; -} - -QScriptValue ScriptEnv::runCommand(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine); - - if (context->argumentCount() == 0) { - return false; - } - - const QString exec = KGlobal::dirs()->findExe(context->argument(0).toString()); - if (!exec.isEmpty()) { - QString args; - if (context->argumentCount() > 1) { - const QStringList argList = qscriptvalue_cast(context->argument(1)); - if (!argList.isEmpty()) { - args = ' ' + KShell::joinArgs(argList); - } - } - - return KRun::runCommand(exec + args, 0); - } - - return false; -} - -QScriptValue ScriptEnv::applicationExists(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - const QString application = context->argument(0).toString(); - if (application.isEmpty()) { - return false; - } - - // first, check for it in $PATH - if (!KStandardDirs::findExe(application).isEmpty()) { - return true; - } - - if (KService::serviceByStorageId(application)) { - return true; - } - - if (application.contains("'")) { - // apostrophes just screw up the trader lookups below, so check for it - return false; - } - - // next, consult ksycoca for an app by that name - if (!KServiceTypeTrader::self()->query("Application", QString("Name =~ '%1'").arg(application)).isEmpty()) { - return true; - } - - // next, consult ksycoca for an app by that generic name - if (!KServiceTypeTrader::self()->query("Application", QString("GenericName =~ '%1'").arg(application)).isEmpty()) { - return true; - } - - return false; -} - -QScriptValue ScriptEnv::applicationPath(QScriptContext *context, QScriptEngine *engine) -{ - Q_UNUSED(engine) - if (context->argumentCount() == 0) { - return false; - } - - const QString application = context->argument(0).toString(); - if (application.isEmpty()) { - return false; - } - - // first, check for it in $PATH - const QString path = KStandardDirs::findExe(application); - if (!path.isEmpty()) { - return path; - } - - if (KService::Ptr service = KService::serviceByStorageId(application)) { - return KStandardDirs::locate("apps", service->entryPath()); - } - - if (application.contains("'")) { - // apostrophes just screw up the trader lookups below, so check for it - return QString(); - } - - // next, consult ksycoca for an app by that name - KService::List offers = KServiceTypeTrader::self()->query("Application", QString("Name =~ '%1'").arg(application)); - if (offers.isEmpty()) { - // next, consult ksycoca for an app by that generic name - offers = KServiceTypeTrader::self()->query("Application", QString("GenericName =~ '%1'").arg(application)); - } - - if (!offers.isEmpty()) { - KService::Ptr offer = offers.first(); - return KStandardDirs::locate("apps", offer->entryPath()); - } - - return QString(); -} - diff --git a/plasma/scriptengine/common/scriptenv.cpp b/plasma/scriptengine/common/scriptenv.cpp deleted file mode 100644 index 85cb976a..00000000 --- a/plasma/scriptengine/common/scriptenv.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright 2007-2008 Richard J. Moore - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 "scriptenv.h" - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "simplebindings/filedialogproxy.h" - -Q_DECLARE_METATYPE(ScriptEnv*) - -ScriptEnv::ScriptEnv(QObject *parent, QScriptEngine *engine) - : QObject(parent), - m_engine(engine) -{ - connect(m_engine, SIGNAL(signalHandlerException(QScriptValue)), this, SLOT(signalException())); - - setupGlobalObject(); -} - -ScriptEnv::~ScriptEnv() -{ -} - -void ScriptEnv::setupGlobalObject() -{ - QScriptValue global = m_engine->globalObject(); - - // Add an accessor so we can find the scriptenv given only the engine. The - // property is hidden from scripts. - global.setProperty("__plasma_scriptenv", m_engine->newQObject(this), - QScriptValue::ReadOnly|QScriptValue::Undeletable|QScriptValue::SkipInEnumeration); - // Add utility functions - global.setProperty("debug", m_engine->newFunction(ScriptEnv::debug)); -} - -void ScriptEnv::addMainObjectProperties(QScriptValue &value) -{ - value.setProperty("addEventListener", m_engine->newFunction(ScriptEnv::addEventListener)); - value.setProperty("removeEventListener", m_engine->newFunction(ScriptEnv::removeEventListener)); -} - -QScriptEngine *ScriptEnv::engine() const -{ - return m_engine; -} - -ScriptEnv *ScriptEnv::findScriptEnv(QScriptEngine *engine) -{ - QScriptValue global = engine->globalObject(); - return qscriptvalue_cast(global.property("__plasma_scriptenv")); -} - -void ScriptEnv::signalException() -{ - checkForErrors(false); -} - -void ScriptEnv::registerEnums(QScriptValue &scriptValue, const QMetaObject &meta) -{ - //manually create enum values. ugh - QScriptEngine *engine = scriptValue.engine(); - for (int i = 0; i < meta.enumeratorCount(); ++i) { - QMetaEnum e = meta.enumerator(i); - //kDebug() << e.name(); - for (int i=0; i < e.keyCount(); ++i) { - //kDebug() << e.key(i) << e.value(i); - scriptValue.setProperty(e.key(i), QScriptValue(engine, e.value(i))); - } - } -} - -bool ScriptEnv::include(const QString &path) -{ - QFile file(path); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - kWarning() << i18n("Unable to load script file: %1", path); - return false; - } - - QString script = file.readAll(); - //kDebug() << "Script says" << script; - - // change the context to the parent context so that the include is actually - // executed in the same context as the caller; seems to be what javascript - // coders expect :) - QScriptContext *ctx = m_engine->currentContext(); - if (ctx && ctx->parentContext()) { - ctx->setActivationObject(ctx->parentContext()->activationObject()); - ctx->setThisObject(ctx->parentContext()->thisObject()); - } - - m_engine->evaluate(script, path); - - return !checkForErrors(true); -} - -bool ScriptEnv::checkForErrors(bool fatal) -{ - if (m_engine->hasUncaughtException()) { - emit reportError(this, fatal); - if (!fatal) { - m_engine->clearExceptions(); - } - return true; - } - - return false; -} - -QScriptValue ScriptEnv::debug(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() != 1) { - return throwNonFatalError(i18n("debug takes one argument"), context, engine); - } - - kDebug() << context->argument(0).toString(); - return engine->undefinedValue(); -} - -QScriptValue ScriptEnv::throwNonFatalError(const QString &msg, QScriptContext *context, QScriptEngine *engine) -{ - QScriptValue rv = context->throwError(msg); - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - if (env) { - env->checkForErrors(false); - } - return rv; -} - -QString ScriptEnv::filePathFromScriptContext(const char *type, const QString &file) const -{ - //kDebug() << type << file; - QScriptContext *c = m_engine->currentContext(); - while (c) { - QScriptValue v = c->activationObject().property("__plasma_package"); - //kDebug() << "variant in parent context?" << v.isVariant(); - if (v.isVariant()) { - const QString path = v.toVariant().value().filePath(type, file); - if (!path.isEmpty()) { - return path; - } - } - - c = c->parentContext(); - } - - //kDebug() << "fail"; - return QString(); -} - -QScriptValue ScriptEnv::addEventListener(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() < 2) { - return false; - } - - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - if (!env) { - return false; - } - - return env->addEventListener(context->argument(0).toString(), context->argument(1)); -} - -QScriptValue ScriptEnv::removeEventListener(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() < 2) { - return false; - } - - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - if (!env) { - return false; - } - - return env->removeEventListener(context->argument(0).toString(), context->argument(1)); -} - -QScriptValue ScriptEnv::callFunction(QScriptValue &func, const QScriptValueList &args, const QScriptValue &activator) -{ - if (!func.isFunction()) { - return m_engine->undefinedValue(); - } - - QScriptContext *ctx = m_engine->pushContext(); - ctx->setActivationObject(activator); - QScriptValue rv = func.call(activator, args); - m_engine->popContext(); - - if (m_engine->hasUncaughtException()) { - emit reportError(this, false); - m_engine->clearExceptions(); - return m_engine->undefinedValue(); - } - - return rv; -} - -bool ScriptEnv::hasEventListeners(const QString &event) const -{ - return m_eventListeners.contains(event); -} - -bool ScriptEnv::callEventListeners(const QString &event, const QScriptValueList &args) -{ - if (!m_eventListeners.contains(event.toLower())) { - return false; - } - - QScriptValueList funcs = m_eventListeners.value(event.toLower()); - QMutableListIterator it(funcs); - while (it.hasNext()) { - callFunction(it.next(), args); - } - - return true; -} - -bool ScriptEnv::addEventListener(const QString &event, const QScriptValue &func) -{ - if (func.isFunction() && !event.isEmpty()) { - m_eventListeners[event.toLower()].append(func); - return true; - } - - return false; -} - -bool ScriptEnv::removeEventListener(const QString &event, const QScriptValue &func) -{ - bool found = false; - - if (func.isFunction()) { - QScriptValueList funcs = m_eventListeners.value(event); - QMutableListIterator it(funcs); - while (it.hasNext()) { - if (it.next().equals(func)) { - it.remove(); - found = true; - } - } - - if (funcs.isEmpty()) { - m_eventListeners.remove(event.toLower()); - } else { - m_eventListeners.insert(event.toLower(), funcs); - } - } - - return found; -} - -#include "moc_scriptenv.cpp" diff --git a/plasma/scriptengine/common/scriptenv.h b/plasma/scriptengine/common/scriptenv.h deleted file mode 100644 index caf5118b..00000000 --- a/plasma/scriptengine/common/scriptenv.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2007-2008 Richard J. Moore - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 SCRIPTENV_H -#define SCRIPTENV_H - -#include -#include - -#include - -namespace Plasma -{ - class Package; -} // namespace Plasma - -class ScriptEnv : public QObject -{ - Q_OBJECT -public: - enum AllowedUrl { NoUrls = 0, - HttpUrls = 1, - NetworkUrls = 2, - LocalUrls = 4, - AppLaunching = 8}; - Q_DECLARE_FLAGS(AllowedUrls, AllowedUrl) - - ScriptEnv(QObject *parent, QScriptEngine *engine); - ~ScriptEnv(); - - /** - * Adds common properties (e.g. registerEventFilter) - * for a 'main' object (e.g. plasmoid, engine, runner) - */ - void addMainObjectProperties(QScriptValue &value); - - /** Returns the QScriptEngine in use. */ - QScriptEngine *engine() const; - - /** Returns the ScriptEnv in use for a given QScriptEngine or 0. */ - static ScriptEnv *findScriptEnv(QScriptEngine *engine); - - static void registerEnums(QScriptValue &scriptValue, const QMetaObject &meta); - bool include(const QString &path); - - bool checkForErrors(bool fatal); - - bool addEventListener(const QString &event, const QScriptValue &func); - bool removeEventListener(const QString &event, const QScriptValue &func); - - QScriptValue callFunction(QScriptValue &func, const QScriptValueList &args = QScriptValueList(), const QScriptValue &activator = QScriptValue()); - bool callEventListeners(const QString &event, const QScriptValueList &args = QScriptValueList()); - bool hasEventListeners(const QString &event) const; - - QString filePathFromScriptContext(const char *type, const QString &file) const; - -Q_SIGNALS: - void reportError(ScriptEnv *engine, bool fatal); - -private: - void registerGetUrl(QScriptValue &obj); - void registerOpenUrl(QScriptValue &obj); - - static QScriptValue debug(QScriptContext *context, QScriptEngine *engine); - static QScriptValue runApplication(QScriptContext *context, QScriptEngine *engine); - static QScriptValue runCommand(QScriptContext *context, QScriptEngine *engine); - static QScriptValue applicationPath(QScriptContext *context, QScriptEngine *engine); - static QScriptValue applicationExists(QScriptContext *context, QScriptEngine *engine); - static QScriptValue openUrl(QScriptContext *context, QScriptEngine *engine); - static QScriptValue getUrl(QScriptContext *context, QScriptEngine *engine); - static QScriptValue download(QScriptContext *context, QScriptEngine *engine); - static QScriptValue userDataPath(QScriptContext *context, QScriptEngine *engine); - static QScriptValue addEventListener(QScriptContext *context, QScriptEngine *engine); - static QScriptValue removeEventListener(QScriptContext *context, QScriptEngine *engine); - static QScriptValue throwNonFatalError(const QString &msg, QScriptContext *context, QScriptEngine *engine); - -private Q_SLOTS: - void signalException(); - -private: - /** Call to set common properties on the global object **/ - void setupGlobalObject(); - - QScriptEngine *m_engine; - QHash m_eventListeners; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(ScriptEnv::AllowedUrls) - -#endif - diff --git a/plasma/scriptengine/data/plasma-scriptengine-applet-declarative.desktop b/plasma/scriptengine/data/plasma-scriptengine-applet-declarative.desktop deleted file mode 100644 index 75b815df..00000000 --- a/plasma/scriptengine/data/plasma-scriptengine-applet-declarative.desktop +++ /dev/null @@ -1,145 +0,0 @@ -[Desktop Entry] -Name=Declarative widget -Name[ar]=ودجة بيانية -Name[ast]=Elementu gráficu declarativu -Name[bg]=Декларативна джаджа -Name[bs]=Deklarativna grafička kontrola -Name[ca]=Estri declaratiu -Name[ca@valencia]=Estri declaratiu -Name[cs]=Deklarativní widget -Name[da]=Erklærende widget -Name[de]=Deklaratives Bedienelement -Name[el]=Δηλωτικό συστατικό -Name[en_GB]=Declarative widget -Name[eo]=Deklarema fenestraĵo -Name[es]=Elemento gráfico declarativo -Name[et]=Deklaratiivne vidin -Name[eu]=Trepeta deklaratiboa -Name[fi]=Deklaratiivinen sovelma -Name[fr]=Composant graphique « Declarative » -Name[ga]=Giuirléid fhógrach -Name[gl]=Widget declarativo -Name[gu]=ડિકલેરેટિવ વિજેટ -Name[he]=ווידג׳ט מוצהר -Name[hi]=वर्णनात्मक विजेट -Name[hr]=Deklarativni widget -Name[hu]=Deklaratív widget -Name[ia]=Widget declarative -Name[id]=Widget deklaratif -Name[is]=Skilgreiningagræja -Name[it]=Oggetto dichiarativo -Name[kk]=Мәлімдеме виджеті -Name[km]=ធាតុ​ក្រាហ្វិក​ដែល​ប្រកាស -Name[ko]=Declarative 위젯 -Name[lt]=Deklaratyvus valdiklis -Name[lv]=Deklaratīvais sīkrīks -Name[mr]=वर्णनात्मक विजेट -Name[nb]=Deklarativt skjermelement -Name[nds]=Stüerelement för Verkloren -Name[nl]=Widget voor declaratie -Name[nn]=Deklarativt skjermelement -Name[pa]=ਡਿਕਲਰੇਟਿਵ ਵਿਦਜੈੱਟ -Name[pl]=Deklaratywny element interfejsu -Name[pt]=Item declarativo -Name[pt_BR]=Widget declarativo -Name[ro]=Control declarativ -Name[ru]=Декларативный виджет -Name[si]=ප්‍රකාශන විජෙට්ටටුව -Name[sk]=Deklaratívny widget -Name[sl]=Deklarativni gradnik -Name[sr]=Декларативни виџет -Name[sr@ijekavian]=Декларативни виџет -Name[sr@ijekavianlatin]=Deklarativni vidžet -Name[sr@latin]=Deklarativni vidžet -Name[sv]=Deklarativ grafisk komponent -Name[tg]=Видҷети эълонкунӣ -Name[tr]=Bildirim parçacığı -Name[ug]=ئېنىقلىما ۋىجېت -Name[uk]=Декларативний віджет -Name[vi]=Widget khai báo -Name[wa]=Ahesse di gåyotaedje -Name[x-test]=xxDeclarative widgetxx -Name[zh_CN]=描述部件 -Name[zh_TW]=宣告元件 -Comment=Native Plasma widget written in QML and JavaScript -Comment[ar]=ودجة بلازما أصلية كتبت بواسطة QML وجافا سكربت -Comment[ast]=Elementu gráficu nativu de Plasma escritu en QML y JavaScript -Comment[bg]=Оригинална джаджа за Plasma, написана наQML и JavaScript -Comment[bs]=Samosvojni plazma grafičkih kontrola napisana u QML‑u i javaskriptu -Comment[ca]=Estri nadiu del Plasma escrit en QML i JavaScript -Comment[ca@valencia]=Estri nadiu del Plasma escrit en QML i JavaScript -Comment[cs]=Nativní Plasma widget napsaný v QML a JavaScriptu -Comment[da]=Hjemmehørende Plasma-widget skrevet i QML og JavaScript -Comment[de]=Echtes Plasma-Programm, geschrieben in QML und JavaScript -Comment[el]=Εγγενές συστατικό Plasma γραμμένο σε QML και JavaScript -Comment[en_GB]=Native Plasma widget written in QML and JavaScript -Comment[eo]=Indiĝena fenestraĵo de Plasmo programita per QML kaj Ĝavaskripto -Comment[es]=Elemento gráfico nativo de Plasma escrito en QML y JavaScript -Comment[et]=QML-is ja JavaScriptis kirjutatud Plasma vidin -Comment[eu]=Jatorrizko Plasma trepeta, QML eta JavaScript lengoaian idatzia -Comment[fi]=Natiivi, QML-pohjainen Plasma-sovelma -Comment[fr]=Composant graphique natif de Plasma écrit en QML et JavaScript -Comment[ga]=Giuirléid dhúchasach Plasma, scríofa in QML agus JavaScript -Comment[gl]=Widget nativo de Plasma escrito en QML e JavaScript -Comment[gu]=QML અને જાવાસ્ક્રિપ્ટમાં લખાયેલ સ્થાનિક પ્લાઝમા વિજેટ -Comment[he]=ווידג׳טים של Plasma הנכתבים ב־QML וב־JavaScript -Comment[hi]=QML और जावास्क्रिप्ट में लिखा गया नेटिव प्लाज्मा विजेट -Comment[hr]=Izvorni Plasma widget napisan u QML-u i JavaScriptu -Comment[hu]=QML-ben és JavaScriptben írt natív Plazma-widget -Comment[ia]=Widget native de Plasma scribite in QLM e JavaScript -Comment[id]=Widget Plasma asli yang ditulis dalam QML dan JavaScript -Comment[is]=Upprunabundin Plasma græja skrifuð í QML og JavaScript -Comment[it]=Oggetto nativo di Plasma scritto in QML e JavaScript -Comment[ja]=QML と JavaScript で書かれた Plasma のネイティブウィジェット -Comment[kk]=QML мен JavaScript-те жазылған Plasma тума виджеті -Comment[km]=ធាតុ​ក្រាហ្វិក​ប្លា​ស្មា​ដើម ដែល​សរសេរ​ក្នុង JavaScript​ -Comment[kn]=QML ಹಾಗು ಜಾವಾ ಸ್ಕ್ರಿಪ್ಟ್ ನಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ವಾಭಾವಿಕ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್) -Comment[ko]=QML과 자바스크립트로 작성된 Plasma 위젯 -Comment[lt]=Nuosavas Plasma valdiklis parašytas QML ir JavaScript kalba -Comment[lv]=Plasma sīkrīks, rakstīts QML un JavaScript valodās -Comment[mr]=जावास्क्रिप्ट व QML अंतर्गत लिहीले गेलेले मूळ प्लाज्मा विजेट -Comment[nb]=Plasmaelement for dette systemet, skrevet i QML og JavaScript -Comment[nds]=En orginaal Plasma-Lüttprogramm, schreven in QML un JavaScript -Comment[nl]=Hier thuishorend Plasma-widget geschreven in QML en JavaScript -Comment[nn]=Plasma-element skriven i QML og JavaScript -Comment[pa]=QML ਤੇ ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਵਿੱਚ ਲਿਖੇ ਨੇਟਿਵ ਪਲਾਜ਼ਮਾ ਵਿਦਜੈੱਟ -Comment[pl]=Element interfejsu Plazmy napisany w QML lub JavaScript -Comment[pt]=Elemento nativo do Plasma feito em QML e JavaScript -Comment[pt_BR]=Widget do Plasma nativo escrito em QML e JavaScript -Comment[ro]=Miniaplicație Plasma nativă scrisă în QML și JavaScript -Comment[ru]=Виджет Plasma, написанный на языках QML и JavaScript -Comment[si]=ජාවා ස්ක්‍රිප්ට හා QML මගින් ලියූ ප්ලාස්මා විජෙට්ටු -Comment[sk]=Natívny plasma widget napísaný v QML a JavaScripte -Comment[sl]=Pravi gradnik za Plasmo, ki je napisan v QML-u in JavaScriptu -Comment[sr]=Самосвојни плазма виџет написан у КуМЛ‑у и јаваскрипту -Comment[sr@ijekavian]=Самосвојни плазма виџет написан у КуМЛ‑у и јаваскрипту -Comment[sr@ijekavianlatin]=Samosvojni plasma vidžet napisan u QML‑u i JavaScriptu -Comment[sr@latin]=Samosvojni plasma vidžet napisan u QML‑u i JavaScriptu -Comment[sv]=Inbyggd grafisk Plasma-komponent skriven i QML och Javascript -Comment[tg]=Ин модули Plasma дар QML ва JavaScript навишта шуд -Comment[th]=วิดเจ็ตพลาสมาแบบดั้งเดิมที่เขียนด้วย QML และจาวาสคริปต์ -Comment[tr]=JavaScript ve QML ile yazılmış gerçek Plasma gereci -Comment[ug]=QML ۋە JavaScript بىلەن يېزىلغان ئەسلى Plasma ۋىجېتى -Comment[uk]=Віджет Плазми, написаний на QML та JavaScript -Comment[vi]=Widget Plasma viết bởi QML và JavaScript -Comment[wa]=Ahesse askepieye po Plasma eyet scrîte e QML eyet JavaScript -Comment[x-test]=xxNative Plasma widget written in QML and JavaScriptxx -Comment[zh_CN]=使用 QML 和 JavaScript 编写的原生 Plasma 部件 -Comment[zh_TW]=用 QML 與 JavaScript 寫的原始 Plasma 元件 -Type=Service -Icon=text-x-script - -X-KDE-ServiceTypes=Plasma/ScriptEngine -X-KDE-Library=plasma_appletscript_declarative -X-EngineName=declarativeappletscript -X-Plasma-API=declarativeappletscript -X-Plasma-ComponentTypes=Applet - -X-KDE-PluginInfo-Author=Alexis Menard -X-KDE-PluginInfo-Email=menard@kde.org -X-KDE-PluginInfo-Name=qmlscript -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Category=Examples -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/plasma/scriptengine/declarative/appletcontainer.cpp b/plasma/scriptengine/declarative/appletcontainer.cpp deleted file mode 100644 index 49b780e3..00000000 --- a/plasma/scriptengine/declarative/appletcontainer.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - Copyright 2011 Marco Martin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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. -*/ - -#include "appletcontainer.h" - -#include - -#include - -#include - -AppletContainer::AppletContainer(QDeclarativeItem *parent) - : QDeclarativeItem(parent) -{ - setFlag(QGraphicsItem::ItemHasNoContents, true); - - //the virtual geometryChanged is *NOT* called in case of change by the anchors - connect(this, SIGNAL(widthChanged()), this, SLOT(afterWidthChanged()), Qt::QueuedConnection); - connect(this, SIGNAL(heightChanged()), this, SLOT(afterHeightChanged()), Qt::QueuedConnection); -} - -AppletContainer::~AppletContainer() -{ -} - -QGraphicsWidget *AppletContainer::applet() const -{ - return m_applet.data(); -} - -void AppletContainer::setApplet(QGraphicsWidget *widget) -{ - Plasma::Applet *applet = qobject_cast(widget); - if (!applet || applet == m_applet.data()) { - return; - } - - if (m_applet) { - disconnect(m_applet.data(), 0, this, 0); - m_applet.data()->setParentItem(parentItem()); - } - - m_applet = applet; - - connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(sizeHintChanged(Qt::SizeHint))); - connect(applet, SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged())); - - applet->setParentItem(this); - applet->setGeometry(0, 0, qMax((qreal)16, width()), qMax((qreal)16, height())); - applet->setFlag(QGraphicsItem::ItemIsMovable, false); - - emit appletChanged(widget); - emit statusChanged(); -} - -void AppletContainer::sizeHintChanged(Qt::SizeHint which) -{ - switch (which) { - case Qt::MinimumSize: - emit minimumWidthChanged(minimumWidth()); - emit minimumHeightChanged(minimumHeight()); - break; - case Qt::PreferredSize: - emit preferredWidthChanged(preferredWidth()); - emit preferredHeightChanged(preferredHeight()); - break; - case Qt::MaximumSize: - emit maximumWidthChanged(maximumWidth()); - emit maximumHeightChanged(maximumHeight()); - break; - default: - break; - } -} - -int AppletContainer::minimumWidth() const -{ - if (!m_applet) { - return -1; - } - - return m_applet.data()->effectiveSizeHint(Qt::MinimumSize).width(); -} - -int AppletContainer::minimumHeight() const -{ - if (!m_applet) { - return -1; - } - - return m_applet.data()->effectiveSizeHint(Qt::MinimumSize).height(); -} - - -int AppletContainer::preferredWidth() const -{ - if (!m_applet) { - return -1; - } - - return m_applet.data()->effectiveSizeHint(Qt::PreferredSize).width(); -} - -int AppletContainer::preferredHeight() const -{ - if (!m_applet) { - return -1; - } - - return m_applet.data()->effectiveSizeHint(Qt::PreferredSize).height(); -} - - -int AppletContainer::maximumWidth() const -{ - if (!m_applet) { - return -1; - } - - return m_applet.data()->effectiveSizeHint(Qt::MaximumSize).width(); -} - -int AppletContainer::maximumHeight() const -{ - if (!m_applet) { - return -1; - } - - return m_applet.data()->effectiveSizeHint(Qt::MaximumSize).height(); -} - -void AppletContainer::setStatus(const AppletContainer::ItemStatus status) -{ - if (!m_applet) { - return; - } - - m_applet.data()->setStatus((Plasma::ItemStatus)status); -} - -AppletContainer::ItemStatus AppletContainer::status() const -{ - if (!m_applet) { - return UnknownStatus; - } - - return (AppletContainer::ItemStatus)((int)(m_applet.data()->status())); -} - -void AppletContainer::afterWidthChanged() -{ - if (!m_applet) { - return; - } - - m_applet.data()->resize(width(), height()); - m_applet.data()->setPos(width()/2 - m_applet.data()->size().width()/2, - height()/2 - m_applet.data()->size().height()/2); - emit minimumWidthChanged(minimumWidth()); - emit preferredWidthChanged(preferredWidth()); - emit maximumWidthChanged(maximumWidth()); - - emit minimumHeightChanged(minimumHeight()); - emit preferredHeightChanged(preferredHeight()); - emit maximumHeightChanged(maximumHeight()); -} - -void AppletContainer::afterHeightChanged() -{ - if (!m_applet) { - return; - } - - m_applet.data()->resize(width(), height()); - m_applet.data()->setPos(width()/2 - m_applet.data()->size().width()/2, - height()/2 - m_applet.data()->size().height()/2); - - emit minimumWidthChanged(minimumWidth()); - emit preferredWidthChanged(preferredWidth()); - emit maximumWidthChanged(maximumWidth()); - - emit minimumHeightChanged(minimumHeight()); - emit preferredHeightChanged(preferredHeight()); - emit maximumHeightChanged(maximumHeight()); -} - - -#include "moc_appletcontainer.cpp" diff --git a/plasma/scriptengine/declarative/appletcontainer.h b/plasma/scriptengine/declarative/appletcontainer.h deleted file mode 100644 index a877585a..00000000 --- a/plasma/scriptengine/declarative/appletcontainer.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright 2011 Marco Martin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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. -*/ - -#ifndef APPLETCONTAINER_H -#define APPLETCONTAINER_H - -#include - -namespace Plasma { - class Applet; -} - -class AppletContainer : public QDeclarativeItem -{ - Q_OBJECT - Q_PROPERTY(QGraphicsWidget *applet READ applet WRITE setApplet NOTIFY appletChanged) - - Q_PROPERTY(int minimumWidth READ minimumWidth NOTIFY minimumWidthChanged) - Q_PROPERTY(int minimumHeight READ minimumHeight NOTIFY minimumHeightChanged) - - Q_PROPERTY(int preferredWidth READ preferredWidth NOTIFY preferredWidthChanged) - Q_PROPERTY(int preferredHeight READ preferredHeight NOTIFY preferredHeightChanged) - - Q_PROPERTY(int maximumWidth READ maximumWidth NOTIFY maximumWidthChanged) - Q_PROPERTY(int maximumHeight READ maximumHeight NOTIFY maximumHeightChanged) - - Q_PROPERTY(ItemStatus status READ status WRITE setStatus NOTIFY statusChanged) - Q_ENUMS(ItemStatus) - -public: - enum ItemStatus { - UnknownStatus = 0, /**< The status is unknown **/ - PassiveStatus = 1, /**< The Item is passive **/ - ActiveStatus = 2, /**< The Item is active **/ - NeedsAttentionStatus = 3, /**< The Item needs attention **/ - AcceptingInputStatus = 4 /**< The Item is accepting input **/ - }; - - AppletContainer(QDeclarativeItem *parent = 0); - ~AppletContainer(); - - QGraphicsWidget *applet() const; - void setApplet(QGraphicsWidget *applet); - - int minimumWidth() const; - int minimumHeight() const; - - int preferredWidth() const; - int preferredHeight() const; - - int maximumWidth() const; - int maximumHeight() const; - - void setStatus(const ItemStatus status); - ItemStatus status() const; - -Q_SIGNALS: - void appletChanged(QGraphicsWidget *applet); - - void minimumWidthChanged(int); - void minimumHeightChanged(int); - - void preferredWidthChanged(int); - void preferredHeightChanged(int); - - void maximumWidthChanged(int); - void maximumHeightChanged(int); - - void statusChanged(); - - -protected Q_SLOTS: - void sizeHintChanged(Qt::SizeHint which); - void afterWidthChanged(); - void afterHeightChanged(); - -private: - QWeakPointer m_applet; -}; - -#endif diff --git a/plasma/scriptengine/declarative/declarativeitemcontainer.cpp b/plasma/scriptengine/declarative/declarativeitemcontainer.cpp deleted file mode 100644 index 105bbf13..00000000 --- a/plasma/scriptengine/declarative/declarativeitemcontainer.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * * - * 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 "declarativeitemcontainer_p.h" - -#include - -DeclarativeItemContainer::DeclarativeItemContainer(QGraphicsItem *parent) - : QGraphicsWidget(parent) -{ -} - -DeclarativeItemContainer::~DeclarativeItemContainer() -{ -} - -void DeclarativeItemContainer::setDeclarativeItem(QDeclarativeItem *item, bool reparent) -{ - if (m_declarativeItem) { - disconnect(m_declarativeItem.data(), 0, this, 0); - } - m_declarativeItem = item; - if (reparent) { - static_cast(item)->setParentItem(this); - } - setMinimumWidth(item->implicitWidth()); - setMinimumHeight(item->implicitHeight()); - resize(item->width(), item->height()); - connect(m_declarativeItem.data(), SIGNAL(widthChanged()), this, SLOT(widthChanged())); - connect(m_declarativeItem.data(), SIGNAL(heightChanged()), this, SLOT(heightChanged())); - - if (m_declarativeItem.data()->metaObject()->indexOfProperty("minimumWidth") >= 0) { - QObject::connect(m_declarativeItem.data(), SIGNAL(minimumWidthChanged()), this, SLOT(minimumWidthChanged())); - } - - if (m_declarativeItem.data()->metaObject()->indexOfProperty("minimumHeight") >= 0) { - QObject::connect(m_declarativeItem.data(), SIGNAL(minimumHeightChanged()), this, SLOT(minimumHeightChanged())); - } - minimumWidthChanged(); - minimumHeightChanged(); -} - -QDeclarativeItem *DeclarativeItemContainer::declarativeItem() const -{ - return m_declarativeItem.data(); -} - -void DeclarativeItemContainer::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - if (m_declarativeItem) { - m_declarativeItem.data()->setProperty("width", event->newSize().width()); - m_declarativeItem.data()->setProperty("height", event->newSize().height()); - } -} - -void DeclarativeItemContainer::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - event->ignore(); -} - -void DeclarativeItemContainer::widthChanged() -{ - if (!m_declarativeItem) { - return; - } - - QSizeF newSize(size()); - newSize.setWidth(m_declarativeItem.data()->width()); - resize(newSize); -} - -void DeclarativeItemContainer::heightChanged() -{ - if (!m_declarativeItem) { - return; - } - - QSizeF newSize(size()); - newSize.setHeight(m_declarativeItem.data()->height()); - resize(newSize); -} - -void DeclarativeItemContainer::minimumWidthChanged() -{ - if (!m_declarativeItem) { - return; - } - - qreal minimumWidth = m_declarativeItem.data()->property("minimumWidth").toReal(); - setMinimumWidth(minimumWidth); -} - -void DeclarativeItemContainer::minimumHeightChanged() -{ - if (!m_declarativeItem) { - return; - } - - qreal minimumHeight = m_declarativeItem.data()->property("minimumHeight").toReal(); - setMinimumHeight(minimumHeight); -} - - -#include "moc_declarativeitemcontainer_p.cpp" diff --git a/plasma/scriptengine/declarative/declarativeitemcontainer_p.h b/plasma/scriptengine/declarative/declarativeitemcontainer_p.h deleted file mode 100644 index 66b7d89a..00000000 --- a/plasma/scriptengine/declarative/declarativeitemcontainer_p.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * * - * 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 DECLARATIVEITEMCONTAINER_P -#define DECLARATIVEITEMCONTAINER_P - -#include -#include -#include -#include - - -class DeclarativeItemContainer : public QGraphicsWidget -{ - Q_OBJECT - -public: - DeclarativeItemContainer(QGraphicsItem *parent = 0); - ~DeclarativeItemContainer(); - - void setDeclarativeItem(QDeclarativeItem *item, bool reparent = true); - QDeclarativeItem *declarativeItem() const; - -protected: - void resizeEvent(QGraphicsSceneResizeEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - -protected Q_SLOTS: - void widthChanged(); - void heightChanged(); - void minimumWidthChanged(); - void minimumHeightChanged(); - -private: - QWeakPointer m_declarativeItem; -}; - -#endif diff --git a/plasma/scriptengine/declarative/toolboxproxy.cpp b/plasma/scriptengine/declarative/toolboxproxy.cpp deleted file mode 100644 index e7d501aa..00000000 --- a/plasma/scriptengine/declarative/toolboxproxy.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 2007 by Aaron Seigo - * Copyright 2008 by Marco Martin - * Copyright 2012 by Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "toolboxproxy.h" -#include "../plasmoid/appletinterface.h" - -#include -#include -#include - -#include - -class ToolBoxProxyPrivate { -public: - bool showing; - Plasma::Containment *containment; - QList actions; - AppletInterface* appletInterface; - QAction* addPanelAction; - QAction* addWidgetsAction; - QAction* configureAction; -}; - -ToolBoxProxy::ToolBoxProxy(Plasma::Containment *parent, AppletInterface *appletInterface) - : AbstractToolBox(parent) -{ - d = new ToolBoxProxyPrivate; - d->containment = parent; - d->appletInterface = appletInterface; - init(); -} - -ToolBoxProxy::ToolBoxProxy(QObject *parent, const QVariantList &args) - : AbstractToolBox(parent, args) -{ - d = new ToolBoxProxyPrivate; - d->containment = qobject_cast(parent); - d->appletInterface = 0; - init(); -} - -ToolBoxProxy::~ToolBoxProxy() -{ - delete d; -} - -void ToolBoxProxy::init() -{ - d->showing = false; - d->addPanelAction = 0; - d->addWidgetsAction = 0; - d->configureAction = 0; - - if (d->containment) { - connect(d->containment, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), - this, SLOT(immutabilityChanged(Plasma::ImmutabilityType))); - connect(this, SIGNAL(configureRequested(Plasma::Containment*)), - d->containment, SIGNAL(configureRequested(Plasma::Containment*))); - connect(this, SIGNAL(showAddWidgetsInterface(const QPointF&)), - d->containment, SIGNAL(showAddWidgetsInterface(const QPointF&))); - } - loadActions(); -} - -void ToolBoxProxy::loadActions() -{ - d->actions.clear(); - if (d->containment) { - if (!d->configureAction) { - d->configureAction = new QAction(this); - d->configureAction->setText(i18n("%1 Settings", d->containment->name())); - d->configureAction->setIcon(KIcon("configure")); - d->configureAction->setObjectName("configure"); - connect(d->configureAction, SIGNAL(triggered()), this, SLOT(configureRequested())); - } - addTool(d->configureAction); - - if (d->appletInterface) { - foreach (QAction *action, d->appletInterface->contextualActions()) { - addTool(action); - } - } - foreach (QAction *action, d->containment->actions()) { - addTool(action); - } - foreach (QAction *action, d->containment->corona()->actions()) { - addTool(action); - } - if (!d->addWidgetsAction) { - d->addWidgetsAction = new QAction(this); - d->addWidgetsAction->setObjectName("add widgets"); - d->addWidgetsAction->setText(i18n("Add Widgets")); - d->addWidgetsAction->setIcon(KIcon("list-add")); - connect(d->addWidgetsAction, SIGNAL(triggered()), this, SLOT(addWidgetsRequested())); - } - if (d->appletInterface && !d->appletInterface->immutable()) { - addTool(d->addWidgetsAction); - } - } - emit actionsChanged(); -} - -QDeclarativeListProperty ToolBoxProxy::actions() -{ - return QDeclarativeListProperty(this, d->actions); -} - -void ToolBoxProxy::addTool(QAction *action) -{ - if (!action || d->actions.contains(action)) { - return; - } - if (d->appletInterface && d->appletInterface->immutable() && action->objectName() == "add panel") { - d->addPanelAction = action; - return; - } - connect(action, SIGNAL(destroyed(QObject*)), this, SLOT(actionDestroyed(QObject*)), Qt::UniqueConnection); - d->actions.append(action); -} - -void ToolBoxProxy::removeTool(QAction *action) -{ - disconnect(action, 0, this, 0); - d->actions.removeAll(action); - emit actionsChanged(); -} - -void ToolBoxProxy::actionDestroyed(QObject *object) -{ - d->actions.removeAll(static_cast(object)); -} - -void ToolBoxProxy::configureRequested() -{ - emit configureRequested(d->containment); -} - -void ToolBoxProxy::addWidgetsRequested() -{ - emit showAddWidgetsInterface(QPointF(0, 0)); -} - -bool ToolBoxProxy::isShowing() const -{ - return d->showing; -} - -void ToolBoxProxy::setShowing(const bool show) -{ - if (d->showing == show) { - return; - } - d->showing = show; -} - -void ToolBoxProxy::immutabilityChanged(Plasma::ImmutabilityType immutability) -{ - Q_UNUSED(immutability); - loadActions(); -} - -#include "moc_toolboxproxy.cpp" diff --git a/plasma/scriptengine/declarative/toolboxproxy.h b/plasma/scriptengine/declarative/toolboxproxy.h deleted file mode 100644 index d5dac88a..00000000 --- a/plasma/scriptengine/declarative/toolboxproxy.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2007 by Aaron Seigo - * Copyright 2008 by Marco Martin - * Copyright 2012 by Sebastian Kügler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 TOOLBOXPROXY_H -#define TOOLBOXPROXY_H - -#include -#include - -#include - -#include - -class ToolBoxProxyPrivate; -class AppletInterface; - -class ToolBoxProxy : public Plasma::AbstractToolBox -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty actions READ actions NOTIFY actionsChanged) - -public: - explicit ToolBoxProxy(Plasma::Containment *parent, AppletInterface *appletInterface); - explicit ToolBoxProxy(QObject *parent = 0, const QVariantList &args = QVariantList()); - ~ToolBoxProxy(); - - bool isShowing() const; // satisfy badly named API - void setShowing(const bool show); - - QDeclarativeListProperty actions(); - -public Q_SLOTS: - void configureRequested(); - void addWidgetsRequested(); - -Q_SIGNALS: - void actionsChanged(); - void immutableChanged(); - - void configureRequested(Plasma::Containment* containment); - void showAddWidgetsInterface(const QPointF& pos); - -private Q_SLOTS: - void actionDestroyed(QObject *object); - void immutabilityChanged(Plasma::ImmutabilityType immutability); - -private: - void init(); - void loadActions(); - /** - * create a toolbox tool from the given action - * @p action the action to associate hte tool with - */ - void addTool(QAction *action); - /** - * remove the tool associated with this action - */ - void removeTool(QAction *action); - - ToolBoxProxyPrivate* d; -}; - -#endif // TOOLBOXPROXY_H diff --git a/plasma/scriptengine/plasmoid/abstractjsappletscript.cpp b/plasma/scriptengine/plasmoid/abstractjsappletscript.cpp deleted file mode 100644 index 04cf6cda..00000000 --- a/plasma/scriptengine/plasmoid/abstractjsappletscript.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2010 Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "plasmoid/abstractjsappletscript.h" - - -AbstractJsAppletScript::AbstractJsAppletScript(QObject *parent, const QVariantList &args) - : Plasma::AppletScript(parent) -{ - Q_UNUSED(args); -} - -AbstractJsAppletScript::~AbstractJsAppletScript() -{ -} - diff --git a/plasma/scriptengine/plasmoid/abstractjsappletscript.h b/plasma/scriptengine/plasmoid/abstractjsappletscript.h deleted file mode 100644 index 2eb4dde1..00000000 --- a/plasma/scriptengine/plasmoid/abstractjsappletscript.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010 Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 ABSTRACTJS_APPLETSCRIPT_H -#define ABSTRACTJS_APPLETSCRIPT_H - -#include - -#include - -class AbstractJsAppletScript : public Plasma::AppletScript -{ -Q_OBJECT - -public: - AbstractJsAppletScript(QObject *parent, const QVariantList &args = QVariantList()); - ~AbstractJsAppletScript(); - - virtual QScriptEngine *engine() const = 0; - virtual bool include(const QString &path) = 0; - virtual QString filePath(const QString &type, const QString &file) const = 0; - virtual QScriptValue variantToScriptValue(QVariant var) = 0; -}; - -#endif diff --git a/plasma/scriptengine/plasmoid/appletinterface.cpp b/plasma/scriptengine/plasmoid/appletinterface.cpp deleted file mode 100644 index 736c7b8b..00000000 --- a/plasma/scriptengine/plasmoid/appletinterface.cpp +++ /dev/null @@ -1,693 +0,0 @@ -/* - * Copyright 2008 Chani Armitage - * Copyright 2008, 2009 Aaron Seigo - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "appletinterface.h" -#include "../declarative/appletcontainer.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -Q_DECLARE_METATYPE(AppletInterface*) - -AppletInterface::AppletInterface(AbstractJsAppletScript *parent) - : QObject(parent), - m_appletScriptEngine(parent), - m_actionSignals(0) -{ - connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus())); - connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving())); - connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged())); - connect(applet(), SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged())); - connect(m_appletScriptEngine, SIGNAL(formFactorChanged()), - this, SIGNAL(formFactorChanged())); - connect(m_appletScriptEngine, SIGNAL(locationChanged()), - this, SIGNAL(locationChanged())); -} - -AppletInterface::~AppletInterface() -{ -} - -AppletInterface *AppletInterface::extract(QScriptEngine *engine) -{ - QScriptValue appletValue = engine->globalObject().property("plasmoid"); - return qobject_cast(appletValue.toQObject()); -} - -Plasma::DataEngine* AppletInterface::dataEngine(const QString &name) -{ - return applet()->dataEngine(name); -} - -AppletInterface::FormFactor AppletInterface::formFactor() const -{ - return static_cast(applet()->formFactor()); -} - -AppletInterface::Location AppletInterface::location() const -{ - return static_cast(applet()->location()); -} - -AppletInterface::AspectRatioMode AppletInterface::aspectRatioMode() const -{ - return static_cast(applet()->aspectRatioMode()); -} - -void AppletInterface::setAspectRatioMode(AppletInterface::AspectRatioMode mode) -{ - applet()->setAspectRatioMode(static_cast(mode)); -} - -bool AppletInterface::shouldConserveResources() const -{ - return applet()->shouldConserveResources(); -} - -void AppletInterface::setFailedToLaunch(bool failed, const QString &reason) -{ - m_appletScriptEngine->setFailedToLaunch(failed, reason); -} - -bool AppletInterface::isBusy() const -{ - return applet()->isBusy(); -} - -void AppletInterface::setBusy(bool busy) -{ - applet()->setBusy(busy); -} - -AppletInterface::BackgroundHints AppletInterface::backgroundHints() const -{ - return static_cast(static_cast(applet()->backgroundHints())); -} - -void AppletInterface::setBackgroundHints(BackgroundHints hint) -{ - applet()->setBackgroundHints(Plasma::Applet::BackgroundHints(hint)); -} - -void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QString &reason) -{ - m_appletScriptEngine->setConfigurationRequired(needsConfiguring, reason); -} - -QString AppletInterface::activeConfig() const -{ - return m_currentConfig.isEmpty() ? "main" : m_currentConfig; -} - -void AppletInterface::setActiveConfig(const QString &name) -{ - if (name == "main") { - m_currentConfig.clear(); - return; - } - - Plasma::ConfigLoader *loader = m_configs.value(name, 0); - - if (!loader) { - QString path = m_appletScriptEngine->filePath("config", name + ".xml"); - if (path.isEmpty()) { - return; - } - - QFile f(path); - KConfigGroup cg = applet()->config(); - loader = new Plasma::ConfigLoader(&cg, &f, this); - m_configs.insert(name, loader); - } - - m_currentConfig = name; -} - -void AppletInterface::writeConfig(const QString &entry, const QVariant &value) -{ - Plasma::ConfigLoader *config = 0; - if (m_currentConfig.isEmpty()) { - config = applet()->configScheme(); - } else { - config = m_configs.value(m_currentConfig, 0); - } - - if (config) { - KConfigSkeletonItem *item = config->findItem(entry); - if (item) { - item->setProperty(value); - config->blockSignals(true); - config->writeConfig(); - config->blockSignals(false); - m_appletScriptEngine->configNeedsSaving(); - } - } else - kWarning() << "Couldn't find a configuration entry"; -} - -QScriptValue AppletInterface::readConfig(const QString &entry) const -{ - Plasma::ConfigLoader *config = 0; - QVariant result; - - if (m_currentConfig.isEmpty()) { - config = applet()->configScheme(); - } else { - config = m_configs.value(m_currentConfig, 0); - } - - if (config) { - result = config->property(entry); - } - - return m_appletScriptEngine->variantToScriptValue(result); -} - -QString AppletInterface::file(const QString &fileType) -{ - return m_appletScriptEngine->filePath(fileType, QString()); -} - -QString AppletInterface::file(const QString &fileType, const QString &filePath) -{ - return m_appletScriptEngine->filePath(fileType, filePath); -} - -QList AppletInterface::contextualActions() const -{ - QList actions; - Plasma::Applet *a = applet(); - if (a->hasFailedToLaunch()) { - return actions; - } - - foreach (const QString &name, m_actions) { - QAction *action = a->action(name); - - if (action) { - actions << action; - } - } - - return actions; -} - -QSizeF AppletInterface::size() const -{ - return applet()->size(); -} - -QRectF AppletInterface::rect() const -{ - return applet()->contentsRect(); -} - -void AppletInterface::setActionSeparator(const QString &name) -{ - Plasma::Applet *a = applet(); - QAction *action = a->action(name); - - if (action) { - action->setSeparator(true); - } else { - action = new QAction(this); - action->setSeparator(true); - a->addAction(name, action); - m_actions.append(name); - } -} - -void AppletInterface::setAction(const QString &name, const QString &text, const QString &icon, const QString &shortcut) -{ - Plasma::Applet *a = applet(); - QAction *action = a->action(name); - - if (action) { - action->setText(text); - } else { - action = new QAction(text, this); - a->addAction(name, action); - - Q_ASSERT(!m_actions.contains(name)); - m_actions.append(name); - - if (!m_actionSignals) { - m_actionSignals = new QSignalMapper(this); - connect(m_actionSignals, SIGNAL(mapped(QString)), - m_appletScriptEngine, SLOT(executeAction(QString))); - } - - connect(action, SIGNAL(triggered()), m_actionSignals, SLOT(map())); - m_actionSignals->setMapping(action, name); - } - - if (!icon.isEmpty()) { - action->setIcon(KIcon(icon)); - } - - if (!shortcut.isEmpty()) { - action->setShortcut(shortcut); - } - - action->setObjectName(name); -} - -void AppletInterface::removeAction(const QString &name) -{ - Plasma::Applet *a = applet(); - QAction *action = a->action(name); - - if (action) { - if (m_actionSignals) { - m_actionSignals->removeMappings(action); - } - - delete action; - } - - m_actions.removeAll(name); -} - -QAction *AppletInterface::action(QString name) const -{ - return applet()->action(name); -} - -void AppletInterface::resize(qreal w, qreal h) -{ - applet()->resize(w,h); -} - -void AppletInterface::setMinimumSize(qreal w, qreal h) -{ - applet()->setMinimumSize(w,h); -} - -void AppletInterface::setPreferredSize(qreal w, qreal h) -{ - applet()->setPreferredSize(w,h); -} - -bool AppletInterface::immutable() const -{ - return applet()->immutability() != Plasma::Mutable; -} - -bool AppletInterface::userConfiguring() const -{ - return applet()->isUserConfiguring(); -} - -bool AppletInterface::include(const QString &script) -{ - const QString path = m_appletScriptEngine->filePath("scripts", script); - - if (path.isEmpty()) { - return false; - } - - return m_appletScriptEngine->include(path); -} - -void AppletInterface::debug(const QString &msg) -{ - kDebug() << msg; -} - -QObject *AppletInterface::findChild(const QString &name) const -{ - if (name.isEmpty()) { - return 0; - } - - foreach (QGraphicsItem *item, applet()->childItems()) { - QGraphicsWidget *widget = dynamic_cast(item); - if (widget && widget->objectName() == name) { - return widget; - } - } - - return 0; -} - -Plasma::Extender *AppletInterface::extender() const -{ - return m_appletScriptEngine->extender(); -} - -void AppletInterface::setAssociatedApplication(const QString &string) -{ - applet()->setAssociatedApplication(string); -} - -QString AppletInterface::associatedApplication() const -{ - return applet()->associatedApplication(); -} - -void AppletInterface::setStatus(const AppletInterface::ItemStatus &status) -{ - applet()->setStatus((Plasma::ItemStatus)status); -} - -AppletInterface::ItemStatus AppletInterface::status() const -{ - return (AppletInterface::ItemStatus)((int)(applet()->status())); -} - -void AppletInterface::setHorizontalSizePolicy(QtSizePolicy horizPolicy) -{ - QSizePolicy policy = applet()->sizePolicy(); - policy.setHorizontalPolicy((QSizePolicy::Policy)horizPolicy); - applet()->setSizePolicy(policy); -} - -AppletInterface::QtSizePolicy AppletInterface::horizontalSizePolicy() const -{ - return (AppletInterface::QtSizePolicy)applet()->sizePolicy().horizontalPolicy(); -} - - -void AppletInterface::setVerticalSizePolicy(QtSizePolicy vertPolicy) -{ - QSizePolicy policy = applet()->sizePolicy(); - policy.setVerticalPolicy((QSizePolicy::Policy)vertPolicy); - applet()->setSizePolicy(policy); -} - -AppletInterface::QtSizePolicy AppletInterface::verticalSizePolicy() const -{ - return (AppletInterface::QtSizePolicy)applet()->sizePolicy().verticalPolicy(); -} - -/* -QString AppletInterface::downloadPath(const QString &file) -{ - KDesktopFile config(v.toVariant().value().path() + "/metadata.desktop"); - KConfigGroup cg = config.desktopGroup(); - const QString pluginName = cg.readEntry("X-KDE-PluginInfo-Name", QString()); - destination = KGlobalSettings::downloadPath() + "/Plasma/" + pluginName + '/'; -} -*/ - -QStringList AppletInterface::downloadedFiles() const -{ - const QString downloadDir = KGlobalSettings::downloadPath() + "/Plasma/" + applet()->pluginName(); - QDir dir(downloadDir); - return dir.entryList(QDir::Files | QDir::NoSymLinks | QDir::Readable); -} - -void AppletInterface::gc() -{ - QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage())); -} - - -PopupAppletInterface::PopupAppletInterface(AbstractJsAppletScript *parent) - : AppletInterface(parent) -{ - connect(m_appletScriptEngine, SIGNAL(popupEvent(bool)), this, SIGNAL(popupEvent(bool))); - connect(m_appletScriptEngine, SIGNAL(popupEvent(bool)), this, SLOT(sourceAppletPopupEvent(bool))); -} - -void PopupAppletInterface::setPopupIcon(const QIcon &icon) -{ - popupApplet()->setPopupIcon(icon); -} - -QIcon PopupAppletInterface::popupIcon() -{ - return popupApplet()->popupIcon(); -} - -void PopupAppletInterface::setPopupIconByName(const QString &name) -{ - return popupApplet()->setPopupIcon(name); -} - -void PopupAppletInterface::setPopupIconToolTip(const QVariantHash &data) -{ - if (data == m_rawToolTipData) { - return; - } else if (!data.contains("image") && !data.contains("mainText") && - !data.contains("subText")) { - m_rawToolTipData = QVariantHash(); - Plasma::ToolTipManager::self()->clearContent(popupApplet()); - Plasma::ToolTipManager::self()->unregisterWidget(popupApplet()); - emit popupIconToolTipChanged(); - return; - } - - Plasma::ToolTipContent content(data.value("mainText").toString(), data.value("subText").toString()); - - const QVariant image = data.value("image"); - if (image.canConvert()) { - content.setImage(image.value()); - } else if (image.canConvert()) { - content.setImage(image.value()); - } else if (image.canConvert()) { - content.setImage(QPixmap::fromImage(image.value())); - } else if (image.canConvert()) { - content.setImage(KIcon(image.toString())); - } - - Plasma::ToolTipManager::self()->registerWidget(popupApplet()); - Plasma::ToolTipManager::self()->setContent(popupApplet(), content); - m_rawToolTipData = data; - m_toolTipData = content; - emit popupIconToolTipChanged(); -} - -QVariantHash PopupAppletInterface::popupIconToolTip() const -{ - return m_rawToolTipData; -} - -void PopupAppletInterface::setPassivePopup(bool passive) -{ - popupApplet()->setPassivePopup(passive); -} - -bool PopupAppletInterface::isPassivePopup() const -{ - return popupApplet()->isPassivePopup(); -} - -bool PopupAppletInterface::isPopupShowing() const -{ - return popupApplet()->isPopupShowing(); -} - -void PopupAppletInterface::setPopupShowing(bool show) -{ - show ? popupApplet()->showPopup() : popupApplet()->hidePopup(); -} - -void PopupAppletInterface::togglePopup() -{ - popupApplet()->togglePopup(); -} - -void PopupAppletInterface::hidePopup() -{ - popupApplet()->hidePopup(); -} - -void PopupAppletInterface::showPopup() -{ - popupApplet()->showPopup(); -} - -void PopupAppletInterface::showPopup(int timeout) -{ - popupApplet()->showPopup(timeout); -} - -void PopupAppletInterface::setPopupWidget(QGraphicsWidget *widget) -{ - popupApplet()->setGraphicsWidget(widget); -} - -QGraphicsWidget *PopupAppletInterface::popupWidget() -{ - return popupApplet()->graphicsWidget(); -} - -void PopupAppletInterface::sourceAppletPopupEvent(bool show) -{ - if (show) { - Plasma::ToolTipManager::self()->clearContent(popupApplet()); - } else { - Plasma::ToolTipManager::self()->registerWidget(popupApplet()); - Plasma::ToolTipManager::self()->setContent(popupApplet(), m_toolTipData); - } -} - - -///////////// ContainmentInterface - -ContainmentInterface::ContainmentInterface(AbstractJsAppletScript *parent) - : AppletInterface(parent), - m_movableApplets(true), - m_toolBox(0) -{ - connect(containment(), SIGNAL(appletRemoved(Plasma::Applet *)), this, SLOT(appletRemovedForward(Plasma::Applet *))); - - connect(containment(), SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), this, SLOT(appletAddedForward(Plasma::Applet *, const QPointF &))); - - connect(containment(), SIGNAL(screenChanged(int, int, Plasma::Containment*)), this, SIGNAL(screenChanged())); - - if (containment()->corona()) { - connect(containment()->corona(), SIGNAL(availableScreenRegionChanged()), - this, SIGNAL(availableScreenRegionChanged())); - } - - qmlRegisterType("org.kde.plasma.containments", 0, 1, "AppletContainer"); - qmlRegisterType(); -} - -QScriptValue ContainmentInterface::applets() -{ - QScriptValue list = m_appletScriptEngine->engine()->newArray(containment()->applets().size()); - int i = 0; - foreach (Plasma::Applet *applet, containment()->applets()) { - list.setProperty(i, m_appletScriptEngine->engine()->newQObject(applet)); - ++i; - } - return list; -} - -void ContainmentInterface::setDrawWallpaper(bool drawWallpaper) -{ - m_appletScriptEngine->setDrawWallpaper(drawWallpaper); -} - -bool ContainmentInterface::drawWallpaper() -{ - return m_appletScriptEngine->drawWallpaper(); -} - -ContainmentInterface::Type ContainmentInterface::containmentType() const -{ - return (ContainmentInterface::Type)m_appletScriptEngine->containmentType(); -} - -void ContainmentInterface::setContainmentType(ContainmentInterface::Type type) -{ - m_appletScriptEngine->setContainmentType((Plasma::Containment::Type)type); -} - -int ContainmentInterface::screen() const -{ - return containment()->screen(); -} - -QScriptValue ContainmentInterface::screenGeometry(int id) const -{ - QRectF rect; - if (containment()->corona()) { - rect = QRectF(containment()->corona()->screenGeometry(id)); - } - - QScriptValue val = m_appletScriptEngine->engine()->newObject(); - val.setProperty("x", rect.x()); - val.setProperty("y", rect.y()); - val.setProperty("width", rect.width()); - val.setProperty("height", rect.height()); - return val; -} - -QScriptValue ContainmentInterface::availableScreenRegion(int id) const -{ - QRegion reg; - if (containment()->corona()) { - reg = containment()->corona()->availableScreenRegion(id); - } - - QScriptValue regVal = m_appletScriptEngine->engine()->newArray(reg.rects().size()); - int i = 0; - foreach (QRect rect, reg.rects()) { - QScriptValue val = m_appletScriptEngine->engine()->newObject(); - val.setProperty("x", rect.x()); - val.setProperty("y", rect.y()); - val.setProperty("width", rect.width()); - val.setProperty("height", rect.height()); - regVal.setProperty(i++, val); - } - return regVal; -} - -void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPointF &pos) -{ - applet->setFlag(QGraphicsItem::ItemIsMovable, m_movableApplets); - emit appletAdded(applet, pos); -} - -void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet) -{ - applet->setFlag(QGraphicsItem::ItemIsMovable, true); - emit appletRemoved(applet); -} - -void ContainmentInterface::setMovableApplets(bool movable) -{ - if (m_movableApplets == movable) { - return; - } - - m_movableApplets = movable; - - foreach (Plasma::Applet *applet, containment()->applets()) { - applet->setFlag(QGraphicsItem::ItemIsMovable, movable); - } -} - -bool ContainmentInterface::hasMovableApplets() const -{ - return m_movableApplets; -} - -ToolBoxProxy* ContainmentInterface::toolBox() -{ - if (!m_toolBox) { - m_toolBox = new ToolBoxProxy(containment(), this); - //m_appletScriptEngine->setToolBox(m_toolBox); // setToolBox() is protected :/ - } - return m_toolBox; -} - -#include "moc_appletinterface.cpp" diff --git a/plasma/scriptengine/plasmoid/appletinterface.h b/plasma/scriptengine/plasmoid/appletinterface.h deleted file mode 100644 index f99db9ad..00000000 --- a/plasma/scriptengine/plasmoid/appletinterface.h +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright 2008 Chani Armitage - * Copyright 2008, 2009 Aaron Seigo - * Copyright 2010 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 APPLETINTERFACE_H -#define APPLETINTERFACE_H - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "abstractjsappletscript.h" -#include "../declarative/toolboxproxy.h" - -#include -class QmlAppletScript; -#include -#include - - -namespace Plasma -{ - class ConfigLoader; - class Extender; -} // namespace Plasa - -class AppletInterface : public QObject -{ - Q_OBJECT - Q_ENUMS(FormFactor) - Q_ENUMS(Location) - Q_ENUMS(AspectRatioMode) - Q_ENUMS(BackgroundHints) - Q_ENUMS(QtOrientation) - Q_ENUMS(QtModifiers) - Q_ENUMS(QtAnchorPoint) - Q_ENUMS(QtCorner) - Q_ENUMS(QtSizePolicy) - Q_ENUMS(QtAlignment) - Q_ENUMS(QtMouseButton) - Q_ENUMS(AnimationDirection) - Q_ENUMS(IntervalAlignment) - Q_ENUMS(ThemeColors) - Q_ENUMS(ItemStatus) - Q_PROPERTY(AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode) - Q_PROPERTY(FormFactor formFactor READ formFactor NOTIFY formFactorChanged) - Q_PROPERTY(Location location READ location NOTIFY locationChanged) - Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources) - Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig) - Q_PROPERTY(bool busy WRITE setBusy READ isBusy) - Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints) - Q_PROPERTY(bool immutable READ immutable NOTIFY immutableChanged) - Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5 - Q_PROPERTY(ItemStatus status READ status WRITE setStatus NOTIFY statusChanged) - Q_PROPERTY(QRectF rect READ rect) - Q_PROPERTY(QSizeF size READ size) - Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication) - Q_PROPERTY(QtSizePolicy horizontalSizePolicy READ horizontalSizePolicy WRITE setHorizontalSizePolicy) - Q_PROPERTY(QtSizePolicy verticalSizePolicy READ verticalSizePolicy WRITE setVerticalSizePolicy) - -public: - AppletInterface(AbstractJsAppletScript *parent); - ~AppletInterface(); - -//------------------------------------------------------------------ -//enums copy&pasted from plasma.h because qtscript is evil - -enum FormFactor { - Planar = 0, /**< The applet lives in a plane and has two - degrees of freedom to grow. Optimize for - desktop, laptop or tablet usage: a high - resolution screen 1-3 feet distant from the - viewer. */ - MediaCenter, /**< As with Planar, the applet lives in a plane - but the interface should be optimized for - medium-to-high resolution screens that are - 5-15 feet distant from the viewer. Sometimes - referred to as a "ten foot interface".*/ - Horizontal, /**< The applet is constrained vertically, but - can expand horizontally. */ - Vertical, /**< The applet is constrained horizontally, but - can expand vertically. */ - Application /**< The Applet lives in a plane and should be optimized to look as a full application, - for the desktop or the particular device. */ -}; - -enum Location { - Floating = 0, /**< Free floating. Neither geometry or z-ordering - is described precisely by this value. */ - Desktop, /**< On the planar desktop layer, extending across - the full screen from edge to edge */ - FullScreen, /**< Full screen */ - TopEdge, /**< Along the top of the screen*/ - BottomEdge, /**< Along the bottom of the screen*/ - LeftEdge, /**< Along the left side of the screen */ - RightEdge /**< Along the right side of the screen */ -}; - -enum AspectRatioMode { - InvalidAspectRatioMode = -1, /**< Unsetted mode used for dev convenience - when there is a need to store the - aspectRatioMode somewhere */ - IgnoreAspectRatio = 0, /**< The applet can be freely resized */ - KeepAspectRatio = 1, /**< The applet keeps a fixed aspect ratio */ - Square = 2, /**< The applet is always a square */ - ConstrainedSquare = 3, /**< The applet is no wider (in horizontal - formfactors) or no higher (in vertical - ones) than a square */ - FixedSize = 4 /** The applet cannot be resized */ -}; - -enum ItemStatus { - UnknownStatus = 0, /**< The status is unknown **/ - PassiveStatus = 1, /**< The Item is passive **/ - ActiveStatus = 2, /**< The Item is active **/ - NeedsAttentionStatus = 3, /**< The Item needs attention **/ - AcceptingInputStatus = 4 /**< The Item is accepting input **/ -}; - -//From Qt namespace -enum QtModifiers { - QtNoModifier = Qt::NoModifier, - QtShiftModifier = Qt::ShiftModifier, - QtControlModifier = Qt::ControlModifier, - QtAltModifier = Qt::AltModifier, - QtMetaModifier = Qt::MetaModifier -}; - -enum QtOrientation { - QtHorizontal= Qt::Horizontal, - QtVertical = Qt::Vertical -}; - -enum QtAnchorPoint { - QtAnchorLeft = Qt::AnchorLeft, - QtAnchorRight = Qt::AnchorRight, - QtAnchorBottom = Qt::AnchorBottom, - QtAnchorTop = Qt::AnchorTop, - QtAnchorHorizontalCenter = Qt::AnchorHorizontalCenter, - QtAnchorVerticalCenter = Qt::AnchorVerticalCenter -}; - -enum QtCorner { - QtTopLeftCorner = Qt::TopLeftCorner, - QtTopRightCorner = Qt::TopRightCorner, - QtBottomLeftCorner = Qt::BottomLeftCorner, - QtBottomRightCorner = Qt::BottomRightCorner -}; - -enum QtSizePolicy { - QSizePolicyFixed = QSizePolicy::Fixed, - QSizePolicyMinimum = QSizePolicy::Minimum, - QSizePolicyMaximum = QSizePolicy::Maximum, - QSizePolicyPreferred = QSizePolicy::Preferred, - QSizePolicyExpanding = QSizePolicy::Expanding, - QSizePolicyMinimumExpanding = QSizePolicy::MinimumExpanding, - QSizePolicyIgnored = QSizePolicy::Ignored -}; - -enum BackgroundHints { - NoBackground = Plasma::Applet::NoBackground, - StandardBackground = Plasma::Applet::StandardBackground, - TranslucentBackground = Plasma::Applet::TranslucentBackground, - DefaultBackground = Plasma::Applet::DefaultBackground -}; - -enum ThemeColors { - TextColor = Plasma::Theme::TextColor, - HighlightColor = Plasma::Theme::HighlightColor, - BackgroundColor = Plasma::Theme::BackgroundColor, - ButtonTextColor = Plasma::Theme::ButtonTextColor, - ButtonBackgroundColor = Plasma::Theme::ButtonBackgroundColor, - LinkColor = Plasma::Theme::LinkColor, - VisitedLinkColor = Plasma::Theme::VisitedLinkColor -}; - -enum QtAlignment { - QtAlignLeft = 0x0001, - QtAlignRight = 0x0002, - QtAlignHCenter = 0x0004, - QtAlignJustify = 0x0005, - QtAlignTop = 0x0020, - QtAlignBottom = 0x0020, - QtAlignVCenter = 0x0080 -}; - -enum QtMouseButton { - QtNoButton = Qt::NoButton, - QtLeftButton = Qt::LeftButton, - QtRightButton = Qt::RightButton, - QtMidButton = Qt::MiddleButton -}; - -enum QtScrollBarPolicy { - QtScrollBarAsNeeded = Qt::ScrollBarAsNeeded, - QtScrollBarAlwaysOff = Qt::ScrollBarAlwaysOff, - QtScrollBarAlwaysOn = Qt::ScrollBarAlwaysOn -}; - -enum AnimationDirection { - AnimationForward = QAbstractAnimation::Forward, - AnimationBackward = QAbstractAnimation::Backward -}; - -enum IntervalAlignment { - NoAlignment = 0, - AlignToMinute, - AlignToHour -}; - -//------------------------------------------------------------------- - - Q_INVOKABLE void gc(); - Q_INVOKABLE FormFactor formFactor() const; - - Location location() const; - bool shouldConserveResources() const; - - Q_INVOKABLE AspectRatioMode aspectRatioMode() const; - Q_INVOKABLE void setAspectRatioMode(AspectRatioMode mode); - - Q_INVOKABLE void setFailedToLaunch(bool failed, const QString &reason = QString()); - - Q_INVOKABLE bool isBusy() const; - Q_INVOKABLE void setBusy(bool busy); - - Q_INVOKABLE BackgroundHints backgroundHints() const; - Q_INVOKABLE void setBackgroundHints(BackgroundHints hint); - - Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString()); - - Q_INVOKABLE QSizeF size() const; - Q_INVOKABLE QRectF rect() const; - - Q_INVOKABLE void setActionSeparator(const QString &name); - Q_INVOKABLE void setAction(const QString &name, const QString &text, - const QString &icon = QString(), const QString &shortcut = QString()); - - Q_INVOKABLE void removeAction(const QString &name); - - Q_INVOKABLE QAction *action(QString name) const; - - Q_INVOKABLE void resize(qreal w, qreal h); - - Q_INVOKABLE void setMinimumSize(qreal w, qreal h); - - Q_INVOKABLE void setPreferredSize(qreal w, qreal h); - - Q_INVOKABLE QString activeConfig() const; - - Q_INVOKABLE void setActiveConfig(const QString &name); - - Q_INVOKABLE QScriptValue readConfig(const QString &entry) const; - - Q_INVOKABLE void writeConfig(const QString &entry, const QVariant &value); - - Q_INVOKABLE QString file(const QString &fileType); - Q_INVOKABLE QString file(const QString &fileType, const QString &filePath); - - Q_INVOKABLE bool include(const QString &script); - - Q_INVOKABLE void debug(const QString &msg); - Q_INVOKABLE QObject *findChild(const QString &name) const; - - Q_INVOKABLE Plasma::Extender *extender() const; - - Plasma::DataEngine *dataEngine(const QString &name); - - QList contextualActions() const; - bool immutable() const; - bool userConfiguring() const; - - static AppletInterface *extract(QScriptEngine *engine); - inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); } - - void setAssociatedApplication(const QString &string); - QString associatedApplication() const; - - void setStatus(const ItemStatus &status); - ItemStatus status() const; - - void setHorizontalSizePolicy(QtSizePolicy policy); - QtSizePolicy horizontalSizePolicy() const; - - void setVerticalSizePolicy(QtSizePolicy policy); - QtSizePolicy verticalSizePolicy() const; - -// Q_INVOKABLE QString downloadPath(const QString &file); - Q_INVOKABLE QStringList downloadedFiles() const; - -Q_SIGNALS: - void releaseVisualFocus(); - void configNeedsSaving(); - - void formFactorChanged(); - void locationChanged(); - void immutableChanged(); - void statusChanged(); - -protected: - AbstractJsAppletScript *m_appletScriptEngine; - -private: - QStringList m_actions; - QSignalMapper *m_actionSignals; - QString m_currentConfig; - QMap m_configs; -}; - -class PopupAppletInterface : public AppletInterface -{ - Q_OBJECT - Q_PROPERTY(QIcon popupIcon READ popupIcon WRITE setPopupIcon) - Q_PROPERTY(bool passivePopup READ isPassivePopup WRITE setPassivePopup) - Q_PROPERTY(QGraphicsWidget *popupWidget READ popupWidget WRITE setPopupWidget) - Q_PROPERTY(QVariantHash popupIconToolTip READ popupIconToolTip WRITE setPopupIconToolTip NOTIFY popupIconToolTipChanged) - Q_PROPERTY(bool popupShowing READ isPopupShowing WRITE setPopupShowing NOTIFY popupEvent) - -public: - PopupAppletInterface(AbstractJsAppletScript *parent); - - void setPopupIcon(const QIcon &icon); - QIcon popupIcon(); - - void setPopupIconToolTip(const QVariantHash &data); - QVariantHash popupIconToolTip() const; - - inline Plasma::PopupApplet *popupApplet() const { return static_cast(m_appletScriptEngine->applet()); } - - void setPassivePopup(bool passive); - bool isPassivePopup() const; - - bool isPopupShowing() const; - void setPopupShowing(bool show); - - void setPopupWidget(QGraphicsWidget *widget); - QGraphicsWidget *popupWidget(); - -Q_SIGNALS: - void popupEvent(bool popupShowing); - void popupIconToolTipChanged(); - -public Q_SLOTS: - void setPopupIconByName(const QString &name); - void togglePopup(); - void hidePopup(); - void showPopup(); - void showPopup(int timeout); - -private Q_SLOTS: - void sourceAppletPopupEvent(bool show); - -private: - QVariantHash m_rawToolTipData; - Plasma::ToolTipContent m_toolTipData; -}; - - -class ContainmentInterface : public AppletInterface -{ - Q_OBJECT - Q_PROPERTY(QScriptValue applets READ applets) - Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper) - Q_PROPERTY(Type containmentType READ containmentType WRITE setContainmentType) - Q_PROPERTY(int screen READ screen NOTIFY screenChanged) - Q_PROPERTY(bool movableApplets READ hasMovableApplets WRITE setMovableApplets) - Q_PROPERTY(ToolBoxProxy* toolBox READ toolBox CONSTANT) - Q_ENUMS(Type) - -public: - enum Type { - NoContainmentType = -1, /**< @internal */ - DesktopContainment = 0, /**< A desktop containment */ - PanelContainment, /**< A desktop panel */ - CustomContainment = 127, /**< A containment that is neither a desktop nor a panel - but something application specific */ - CustomPanelContainment = 128 /**< A customized desktop panel */ - }; - ContainmentInterface(AbstractJsAppletScript *parent); - - inline Plasma::Containment *containment() const { return static_cast(m_appletScriptEngine->applet()); } - - QScriptValue applets(); - - void setDrawWallpaper(bool drawWallpaper); - bool drawWallpaper(); - Type containmentType() const; - void setContainmentType(Type type); - int screen() const; - - void setMovableApplets(bool movable); - bool hasMovableApplets() const; - - ToolBoxProxy* toolBox(); - - Q_INVOKABLE QScriptValue screenGeometry(int id) const; - Q_INVOKABLE QScriptValue availableScreenRegion(int id) const; - -Q_SIGNALS: - void appletAdded(QGraphicsWidget *applet, const QPointF &pos); - void appletRemoved(QGraphicsWidget *applet); - void screenChanged(); - void availableScreenRegionChanged(); - -protected Q_SLOTS: - void appletAddedForward(Plasma::Applet *applet, const QPointF &pos); - void appletRemovedForward(Plasma::Applet *applet); - -private: - bool m_movableApplets; - ToolBoxProxy* m_toolBox; -}; - -#endif diff --git a/plasma/scriptengine/plasmoid/declarativeappletscript.cpp b/plasma/scriptengine/plasmoid/declarativeappletscript.cpp deleted file mode 100644 index 3bc29662..00000000 --- a/plasma/scriptengine/plasmoid/declarativeappletscript.cpp +++ /dev/null @@ -1,545 +0,0 @@ -/* - * Copyright 2009 by Alan Alpert - * Copyright 2010 by Ménard Alexis - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "plasmoid/declarativeappletscript.h" - -#include "plasmoid/appletinterface.h" -#include "plasmoid/themedsvg.h" - -#include "common/scriptenv.h" -#include "declarative/declarativeitemcontainer_p.h" -#include "simplebindings/bytearrayclass.h" -#include "simplebindings/dataengine.h" -#include "simplebindings/dataenginereceiver.h" - - -K_EXPORT_PLASMA_APPLETSCRIPTENGINE(declarativeappletscript, DeclarativeAppletScript) - - -QScriptValue constructIconClass(QScriptEngine *engine); -QScriptValue constructKUrlClass(QScriptEngine *engine); -QScriptValue constructQPointClass(QScriptEngine *engine); -void registerSimpleAppletMetaTypes(QScriptEngine *engine); -DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariantList &args) - : AbstractJsAppletScript(parent, args), - m_declarativeWidget(0), - m_toolBoxWidget(0), - m_interface(0), - m_engine(0), - m_env(0) -{ - Q_UNUSED(args); -} - -DeclarativeAppletScript::~DeclarativeAppletScript() -{ -} - -bool DeclarativeAppletScript::init() -{ - m_declarativeWidget = new Plasma::DeclarativeWidget(applet()); - m_declarativeWidget->setInitializationDelayed(true); - connect(m_declarativeWidget, SIGNAL(finished()), this, SLOT(qmlCreationFinished())); - KGlobal::locale()->insertCatalog("plasma_applet_" + description().pluginName()); - - //make possible to import extensions from the package - //FIXME: probably to be removed, would make possible to use native code from within the package :/ - //m_declarativeWidget->engine()->addImportPath(package()->path()+"/contents/imports"); - m_declarativeWidget->setQmlPath(mainScript()); - - if (!m_declarativeWidget->engine() || !m_declarativeWidget->engine()->rootContext() || !m_declarativeWidget->engine()->rootContext()->isValid() || m_declarativeWidget->mainComponent()->isError()) { - QString reason; - foreach (QDeclarativeError error, m_declarativeWidget->mainComponent()->errors()) { - reason += error.toString()+'\n'; - } - setFailedToLaunch(true, reason); - return false; - } - - Plasma::Applet *a = applet(); - Plasma::PopupApplet *pa = qobject_cast(a); - Plasma::Containment *cont = qobject_cast(a); - - if (pa) { - pa->setPopupIcon(a->icon()); - pa->setGraphicsWidget(m_declarativeWidget); - } else { - QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(a); - lay->setContentsMargins(0, 0, 0, 0); - lay->addItem(m_declarativeWidget); - } - - if (pa) { - m_interface = new PopupAppletInterface(this); - } else if (cont) { - m_interface = new ContainmentInterface(this); - //fail? so it's a normal Applet - } else { - m_interface = new AppletInterface(this); - } - - connect(applet(), SIGNAL(extenderItemRestored(Plasma::ExtenderItem*)), - this, SLOT(extenderItemRestored(Plasma::ExtenderItem*))); - connect(applet(), SIGNAL(activate()), - this, SLOT(activate())); - - setupObjects(); - - return true; -} - -void DeclarativeAppletScript::qmlCreationFinished() -{ - //If it's a popupapplet and the root object has a "compactRepresentation" component, use that instead of the icon - Plasma::Applet *a = applet(); - Plasma::PopupApplet *pa = qobject_cast(a); - m_self.setProperty("rootItem", m_engine->newQObject(m_declarativeWidget->rootObject())); - - if (pa) { - QDeclarativeComponent *iconComponent = m_declarativeWidget->rootObject()->property("compactRepresentation").value(); - if (iconComponent) { - QDeclarativeItem *declarativeIcon = qobject_cast(iconComponent->create(iconComponent->creationContext())); - if (declarativeIcon) { - pa->setPopupIcon(QIcon()); - QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(a); - lay->setContentsMargins(0, 0, 0, 0); - DeclarativeItemContainer *declarativeItemContainer = new DeclarativeItemContainer(a); - lay->addItem(declarativeItemContainer); - declarativeItemContainer->setDeclarativeItem(declarativeIcon, true); - } else { - pa->setPopupIcon(a->icon()); - } - } else { - pa->setPopupIcon(a->icon()); - } - } - - Plasma::Containment *pc = qobject_cast(a); - if (pc) { - Plasma::PackageStructure::Ptr structure = Plasma::PackageStructure::load("Plasma/Generic"); - Plasma::Package pkg = Plasma::Package(QString(), "org.kde.toolbox", structure); - if (pkg.isValid()) { - const QString qmlPath = pkg.filePath("mainscript"); - - m_toolBoxWidget = new Plasma::DeclarativeWidget(pc); - m_toolBoxWidget->setInitializationDelayed(true); - m_toolBoxWidget->setQmlPath(qmlPath); - - QGraphicsLinearLayout *toolBoxScreenLayout = new QGraphicsLinearLayout(m_declarativeWidget); - toolBoxScreenLayout->addItem(m_toolBoxWidget); - toolBoxScreenLayout->setContentsMargins(0, 0, 0, 0); - - QScriptEngine *engine = m_toolBoxWidget->scriptEngine(); - if (!engine) { - return; - } - QScriptValue global = engine->globalObject(); - m_self = engine->newQObject(m_interface); - global.setProperty("plasmoid", m_self); - } else { - kWarning() << "Could not load org.kde.toolbox package."; - } - } -} - -void DeclarativeAppletScript::collectGarbage() -{ - if (!m_engine) { - return; - } - m_engine->collectGarbage(); -} - -QString DeclarativeAppletScript::filePath(const QString &type, const QString &file) const -{ - const QString path = m_env->filePathFromScriptContext(type.toLocal8Bit().constData(), file); - - if (!path.isEmpty()) { - return path; - } - - return package()->filePath(type.toLocal8Bit().constData(), file); -} - -void DeclarativeAppletScript::configChanged() -{ - if (!m_env) { - return; - } - - m_env->callEventListeners("configchanged"); -} - -QScriptValue DeclarativeAppletScript::loadui(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() != 1) { - return context->throwError(i18n("loadui() takes one argument")); - } - - QString filename = context->argument(0).toString(); - QFile f(filename); - if (!f.open(QIODevice::ReadOnly)) { - return context->throwError(i18n("Unable to open '%1'",filename)); - } - - QUiLoader loader; - QWidget *w = loader.load(&f); - f.close(); - - return engine->newQObject(w, QScriptEngine::AutoOwnership); -} - -QScriptValue DeclarativeAppletScript::newPlasmaSvg(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return context->throwError(i18n("Constructor takes at least 1 argument")); - } - - const QString filename = context->argument(0).toString(); - Plasma::Svg *svg = new ThemedSvg(0); - svg->setImagePath(ThemedSvg::findSvg(engine, filename)); - - QScriptValue obj = engine->newQObject(svg); - ScriptEnv::registerEnums(obj, *svg->metaObject()); - - return obj; -} - -QScriptValue DeclarativeAppletScript::variantToScriptValue(QVariant var) -{ - if (!m_engine) { - return QScriptValue(); - } - return m_engine->newVariant(var); -} - -QScriptValue DeclarativeAppletScript::newPlasmaFrameSvg(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() == 0) { - return context->throwError(i18n("Constructor takes at least 1 argument")); - } - - QString filename = context->argument(0).toString(); - - bool parentedToApplet = false; - QGraphicsWidget *parent = extractParent(context, engine, 1, &parentedToApplet); - Plasma::FrameSvg *frameSvg = new ThemedFrameSvg(parent); - frameSvg->setImagePath(ThemedSvg::findSvg(engine, filename)); - - QScriptValue obj = engine->newQObject(frameSvg); - ScriptEnv::registerEnums(obj, *frameSvg->metaObject()); - - return obj; -} - -QScriptValue DeclarativeAppletScript::newPlasmaExtenderItem(QScriptContext *context, QScriptEngine *engine) -{ - Plasma::Extender *extender = 0; - if (context->argumentCount() > 0) { - extender = qobject_cast(context->argument(0).toQObject()); - } - - if (!extender) { - AppletInterface *interface = AppletInterface::extract(engine); - if (!interface) { - return engine->undefinedValue(); - } - - extender = interface->extender(); - } - - Plasma::ExtenderItem *extenderItem = new Plasma::ExtenderItem(extender); - QScriptValue fun = engine->newQObject(extenderItem); - ScriptEnv::registerEnums(fun, *extenderItem->metaObject()); - return fun; -} - -QGraphicsWidget *DeclarativeAppletScript::extractParent(QScriptContext *context, QScriptEngine *engine, - int argIndex, bool *parentedToApplet) -{ - if (parentedToApplet) { - *parentedToApplet = false; - } - - QGraphicsWidget *parent = 0; - if (context->argumentCount() >= argIndex) { - parent = qobject_cast(context->argument(argIndex).toQObject()); - } - - if (!parent) { - AppletInterface *interface = AppletInterface::extract(engine); - if (!interface) { - return 0; - } - - //kDebug() << "got the applet!"; - parent = interface->applet(); - - if (parentedToApplet) { - *parentedToApplet = true; - } - } - - return parent; -} - -void DeclarativeAppletScript::callPlasmoidFunction(const QString &functionName, const QScriptValueList &args, ScriptEnv *env) -{ - if (!m_env) { - m_env = ScriptEnv::findScriptEnv(m_engine); - } - - if (env) { - QScriptValue func = m_self.property(functionName); - m_env->callFunction(func, args, m_self); - } -} - -void DeclarativeAppletScript::constraintsEvent(Plasma::Constraints constraints) -{ - if (constraints & Plasma::FormFactorConstraint) { - emit formFactorChanged(); - } - - if (constraints & Plasma::LocationConstraint) { - emit locationChanged(); - } - - if (constraints & Plasma::ContextConstraint) { - emit contextChanged(); - } -} - -void DeclarativeAppletScript::popupEvent(bool popped) -{ - if (!m_env) { - return; - } - - QScriptValueList args; - args << popped; - - m_env->callEventListeners("popupEvent", args); -} - -void DeclarativeAppletScript::dataUpdated(const QString &name, const Plasma::DataEngine::Data &data) -{ - if (!m_engine) { - return; - } - QScriptValueList args; - args << m_engine->toScriptValue(name) << m_engine->toScriptValue(data); - - m_env->callEventListeners("dataUpdated", args); -} - -void DeclarativeAppletScript::extenderItemRestored(Plasma::ExtenderItem* item) -{ - if (!m_env) { - return; - } - if (!m_engine) { - return; - } - - QScriptValueList args; - args << m_engine->newQObject(item, QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); - - m_env->callEventListeners("initExtenderItem", args); -} - -void DeclarativeAppletScript::activate() -{ - if (!m_env) { - return; - } - - m_env->callEventListeners("activate"); -} - -void DeclarativeAppletScript::executeAction(const QString &name) -{ - if (!m_env) { - return; - } - - if (m_declarativeWidget->rootObject()) { - QMetaObject::invokeMethod(m_declarativeWidget->rootObject(), QString("action_" + name).toLatin1(), Qt::DirectConnection); - } -} - -bool DeclarativeAppletScript::include(const QString &path) -{ - return m_env->include(path); -} - -ScriptEnv *DeclarativeAppletScript::scriptEnv() -{ - return m_env; -} - -void DeclarativeAppletScript::setupObjects() -{ - m_engine = m_declarativeWidget->scriptEngine(); - if (!m_engine) { - return; - } - - connect(m_engine, SIGNAL(signalHandlerException(const QScriptValue &)), - this, SLOT(signalHandlerException(const QScriptValue &))); - - delete m_env; - m_env = new ScriptEnv(this, m_engine); - - QScriptValue global = m_engine->globalObject(); - - QScriptValue v = m_engine->newVariant(QVariant::fromValue(*applet()->package())); - global.setProperty("__plasma_package", v, - QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration); - - m_self = m_engine->newQObject(m_interface); - global.setProperty("plasmoid", m_self); - m_env->addMainObjectProperties(m_self); - - QScriptValue args = m_engine->newArray(); - int i = 0; - foreach (const QVariant &arg, applet()->startupArguments()) { - args.setProperty(i, m_engine->newVariant(arg)); - ++i; - } - global.setProperty("startupArguments", args); - - // Add a global loadui method for ui files - QScriptValue fun = m_engine->newFunction(DeclarativeAppletScript::loadui); - global.setProperty("loadui", fun); - - ScriptEnv::registerEnums(global, AppletInterface::staticMetaObject); - //Make enum values accessible also as plasmoid.Planar etc - ScriptEnv::registerEnums(m_self, AppletInterface::staticMetaObject); - - global.setProperty("dataEngine", m_engine->newFunction(DeclarativeAppletScript::dataEngine)); - global.setProperty("service", m_engine->newFunction(DeclarativeAppletScript::service)); - - //Add stuff from Qt - //TODO: move to libkdeclarative? - ByteArrayClass *baClass = new ByteArrayClass(m_engine); - global.setProperty("ByteArray", baClass->constructor()); - global.setProperty("QPoint", constructQPointClass(m_engine)); - - // Add stuff from KDE libs - qScriptRegisterSequenceMetaType(m_engine); - global.setProperty("Url", constructKUrlClass(m_engine)); - - // Add stuff from Plasma - global.setProperty("Svg", m_engine->newFunction(DeclarativeAppletScript::newPlasmaSvg)); - global.setProperty("FrameSvg", m_engine->newFunction(DeclarativeAppletScript::newPlasmaFrameSvg)); - global.setProperty("ExtenderItem", m_engine->newFunction(DeclarativeAppletScript::newPlasmaExtenderItem)); - - registerSimpleAppletMetaTypes(m_engine); - QTimer::singleShot(0, this, SLOT(configChanged())); -} - -QScriptValue DeclarativeAppletScript::dataEngine(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() != 1) { - return context->throwError(i18n("dataEngine() takes one argument")); - } - - AppletInterface *interface = AppletInterface::extract(engine); - if (!interface) { - return context->throwError(i18n("Could not extract the Applet")); - } - - const QString dataEngineName = context->argument(0).toString(); - Plasma::DataEngine *dataEngine = interface->dataEngine(dataEngineName); - QScriptValue v = engine->newQObject(dataEngine, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject); - v.setProperty("connectSource", engine->newFunction(DataEngineReceiver::connectSource)); - v.setProperty("connectAllSources", engine->newFunction(DataEngineReceiver::connectAllSources)); - v.setProperty("disconnectSource", engine->newFunction(DataEngineReceiver::disconnectSource)); - return v; -} - -QScriptValue DeclarativeAppletScript::service(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() != 2) { - return context->throwError(i18n("service() takes two arguments")); - } - - QString dataEngine = context->argument(0).toString(); - - AppletInterface *interface = AppletInterface::extract(engine); - if (!interface) { - return context->throwError(i18n("Could not extract the Applet")); - } - - Plasma::DataEngine *data = interface->dataEngine(dataEngine); - QString source = context->argument(1).toString(); - Plasma::Service *service = data->serviceForSource(source); - //kDebug( )<< "lets try to get" << source << "from" << dataEngine; - return engine->newQObject(service, QScriptEngine::AutoOwnership); -} - -QList DeclarativeAppletScript::contextualActions() -{ - if (!m_interface) { - return QList(); - } - - return m_interface->contextualActions(); -} - -QScriptEngine *DeclarativeAppletScript::engine() const -{ - return m_engine; -} - -void DeclarativeAppletScript::signalHandlerException(const QScriptValue &exception) -{ - kWarning()<<"Exception caught: "< - * Copyright 2010 by Ménard Alexis - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 DECLARATIVE_APPLETSCRIPT_H -#define DECLARATIVE_APPLETSCRIPT_H - -#include -#include - -#include "abstractjsappletscript.h" -#include - -class AppletInterface; - -namespace Plasma -{ - class DeclarativeWidget; - class ExtenderItem; -} - -class ScriptEnv; - -class DeclarativeAppletScript : public AbstractJsAppletScript -{ - Q_OBJECT - -public: - DeclarativeAppletScript(QObject *parent, const QVariantList &args); - ~DeclarativeAppletScript(); - - QString filePath(const QString &type, const QString &file) const; - - QList contextualActions(); - - void constraintsEvent(Plasma::Constraints constraints); - - bool include(const QString &path); - - ScriptEnv *scriptEnv(); - - QScriptEngine *engine() const; - - QScriptValue variantToScriptValue(QVariant var); - - static QScriptValue loadui(QScriptContext *context, QScriptEngine *engine); - static QScriptValue newPlasmaSvg(QScriptContext *context, QScriptEngine *engine); - static QScriptValue newPlasmaFrameSvg(QScriptContext *context, QScriptEngine *engine); - static QScriptValue newPlasmaExtenderItem(QScriptContext *context, QScriptEngine *engine); - static QScriptValue dataEngine(QScriptContext *context, QScriptEngine *engine); - static QScriptValue service(QScriptContext *context, QScriptEngine *engine); - -public Q_SLOTS: - void executeAction(const QString &name); - void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data); - void signalHandlerException(const QScriptValue &exception); - void popupEvent(bool popped); - void activate(); - void extenderItemRestored(Plasma::ExtenderItem* item); - void collectGarbage(); - void configChanged(); - void qmlCreationFinished(); - -protected: - bool init(); - void setupObjects(); - static QGraphicsWidget *extractParent(QScriptContext *context, - QScriptEngine *engine, - int parentIndex = 0, - bool *parentedToApplet = 0); - -Q_SIGNALS: - void formFactorChanged(); - void locationChanged(); - void contextChanged(); - -private: - void callPlasmoidFunction(const QString &functionName, const QScriptValueList &args, ScriptEnv *env); - Plasma::DeclarativeWidget *m_declarativeWidget; - Plasma::DeclarativeWidget *m_toolBoxWidget; - AppletInterface *m_interface; - QScriptEngine *m_engine; - QScriptValue m_self; - ScriptEnv *m_env; -}; - -#endif diff --git a/plasma/scriptengine/plasmoid/themedsvg.cpp b/plasma/scriptengine/plasmoid/themedsvg.cpp deleted file mode 100644 index 3ffbc037..00000000 --- a/plasma/scriptengine/plasmoid/themedsvg.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2007-2008,2010 Richard J. Moore - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 "themedsvg.h" - -#include - -#include "appletinterface.h" - -ThemedSvg::ThemedSvg(QObject *parent) - : Plasma::Svg(parent) -{ -} - -void ThemedSvg::setThemedImagePath(const QString &path) -{ - setImagePath(findSvg(engine(), path)); -} - -static QString findLocalSvgFile(AppletInterface *interface, const QString &dir, const QString &file) -{ - QString path = interface->file(dir, file + QLatin1String(".svg")); - if (path.isEmpty()) { - path = interface->file(dir, file + QLatin1String(".svgz")); - } - return path; -} - -QString ThemedSvg::findSvg(QScriptEngine *engine, const QString &file) -{ - AppletInterface *interface = AppletInterface::extract(engine); - if (!interface) { - return QString(); - } - - QString path = findLocalSvgFile(interface, "images", file); - if (!path.isEmpty()) { - return path; - } - - path = Plasma::Theme::defaultTheme()->imagePath(file); - if (!path.isEmpty()) { - return path; - } - - // FIXME: this isn't particularly helpful, as we can't look in the fallback themes - QString themeName = Plasma::Theme::defaultTheme()->themeName(); - path = findLocalSvgFile(interface, "theme", themeName + QLatin1Char('/') + file); - if (!path.isEmpty()) { - return path; - } - - path = findLocalSvgFile(interface, "theme", file); - return path; -} - -ThemedFrameSvg::ThemedFrameSvg(QObject *parent) - : Plasma::FrameSvg(parent) -{ -} - -void ThemedFrameSvg::setThemedImagePath(const QString &path) -{ - setImagePath(ThemedSvg::findSvg(engine(), path)); -} - -#include "moc_themedsvg.cpp" - diff --git a/plasma/scriptengine/plasmoid/themedsvg.h b/plasma/scriptengine/plasmoid/themedsvg.h deleted file mode 100644 index a2a08a3d..00000000 --- a/plasma/scriptengine/plasmoid/themedsvg.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2007-2008,2010 Richard J. Moore - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 THEMEDSVG_H -#define THEMEDSVG_H - -#include - -#include -#include - -class ThemedSvg : public Plasma::Svg, public QScriptable -{ - Q_OBJECT - Q_PROPERTY(QString imagePath READ imagePath WRITE setThemedImagePath) - -public: - ThemedSvg(QObject *parent = 0); - - void setThemedImagePath(const QString &path); - - static QString findSvg(QScriptEngine *engine, const QString &file); -}; - -class ThemedFrameSvg : public Plasma::FrameSvg, public QScriptable -{ - Q_OBJECT - Q_PROPERTY(QString imagePath READ imagePath WRITE setThemedImagePath) - -public: - ThemedFrameSvg(QObject *parent = 0); - - void setThemedImagePath(const QString &path); -}; - -#endif - diff --git a/plasma/scriptengine/simplebindings/backportglobal.h b/plasma/scriptengine/simplebindings/backportglobal.h deleted file mode 100644 index a21a0eab..00000000 --- a/plasma/scriptengine/simplebindings/backportglobal.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** This file is part of the Qt Script Generator. -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation info@qt.nokia.com -** -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation -** and appearing in the file LICENSE.LGPL included in the packaging of -** this file. Please review the following information to ensure the GNU -** Lesser General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** Copyright (C) 2011 Nokia. All rights reserved -****************************************************************************/ - -#ifndef QTSCRIPTEXTENSIONS_GLOBAL_H -#define QTSCRIPTEXTENSIONS_GLOBAL_H - -#include -#include -#include -#include - -Q_DECLARE_METATYPE(QPixmap*) -Q_DECLARE_METATYPE(QPixmap) - -#define DECLARE_SELF(Class, __fn__) \ - Class* self = qscriptvalue_cast(ctx->thisObject()); \ - if (!self) { \ - return ctx->throwError(QScriptContext::TypeError, \ - QString::fromLatin1("%0.prototype.%1: this object is not a %0") \ - .arg(#Class).arg(#__fn__)); \ - } - -#define ADD_ENUM_VALUE(__c__, __ns__, __v__) \ - __c__.setProperty(#__v__, QScriptValue(__c__.engine(), __ns__::__v__)) - -#endif // QTSCRIPTEXTENSIONS_GLOBAL_H diff --git a/plasma/scriptengine/simplebindings/bytearrayclass.cpp b/plasma/scriptengine/simplebindings/bytearrayclass.cpp deleted file mode 100644 index c3113e15..00000000 --- a/plasma/scriptengine/simplebindings/bytearrayclass.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "bytearrayclass.h" - -#include -#include - -#include "bytearrayprototype.h" - -#include - -Q_DECLARE_METATYPE(QByteArray*) -Q_DECLARE_METATYPE(ByteArrayClass*) - -class ByteArrayClassPropertyIterator : public QScriptClassPropertyIterator -{ -public: - ByteArrayClassPropertyIterator(const QScriptValue &object); - ~ByteArrayClassPropertyIterator(); - - bool hasNext() const; - void next(); - - bool hasPrevious() const; - void previous(); - - void toFront(); - void toBack(); - - QScriptString name() const; - uint id() const; - -private: - int m_index; - int m_last; -}; - -//! [0] -ByteArrayClass::ByteArrayClass(QScriptEngine *engine) - : QObject(engine), QScriptClass(engine) -{ - qScriptRegisterMetaType(engine, toScriptValue, fromScriptValue); - - length = engine->toStringHandle(QLatin1String("length")); - - proto = engine->newQObject(new ByteArrayPrototype(this), - QScriptEngine::QtOwnership, - QScriptEngine::SkipMethodsInEnumeration - | QScriptEngine::ExcludeSuperClassMethods - | QScriptEngine::ExcludeSuperClassProperties); - QScriptValue global = engine->globalObject(); - proto.setPrototype(global.property("Object").property("prototype")); - - ctor = engine->newFunction(construct, proto); - ctor.setData(qScriptValueFromValue(engine, this)); -} -//! [0] - -ByteArrayClass::~ByteArrayClass() -{ -} - -//! [3] -QScriptClass::QueryFlags ByteArrayClass::queryProperty(const QScriptValue &object, - const QScriptString &name, - QueryFlags flags, uint *id) -{ - QByteArray *ba = qscriptvalue_cast(object.data()); - if (!ba) - return 0; - if (name == length) { - return flags; - } else { - bool isArrayIndex; - qint32 pos = name.toArrayIndex(&isArrayIndex); - if (!isArrayIndex) - return 0; - *id = pos; - if ((flags & HandlesReadAccess) && (pos >= ba->size())) - flags &= ~HandlesReadAccess; - return flags; - } -} -//! [3] - -//! [4] -QScriptValue ByteArrayClass::property(const QScriptValue &object, - const QScriptString &name, uint id) -{ - QByteArray *ba = qscriptvalue_cast(object.data()); - if (!ba) - return QScriptValue(); - if (name == length) { - return ba->length(); - } else { - qint32 pos = id; - if ((pos < 0) || (pos >= ba->size())) - return QScriptValue(); - return uint(ba->at(pos)) & 255; - } - return QScriptValue(); -} -//! [4] - -//! [5] -void ByteArrayClass::setProperty(QScriptValue &object, - const QScriptString &name, - uint id, const QScriptValue &value) -{ - QByteArray *ba = qscriptvalue_cast(object.data()); - if (!ba) - return; - if (name == length) { - ba->resize(value.toInt32()); - } else { - qint32 pos = id; - if (pos < 0) - return; - if (ba->size() <= pos) - ba->resize(pos + 1); - (*ba)[pos] = char(value.toInt32()); - } -} -//! [5] - -//! [6] -QScriptValue::PropertyFlags ByteArrayClass::propertyFlags( - const QScriptValue &/*object*/, const QScriptString &name, uint /*id*/) -{ - if (name == length) { - return QScriptValue::Undeletable - | QScriptValue::SkipInEnumeration; - } - return QScriptValue::Undeletable; -} -//! [6] - -//! [7] -QScriptClassPropertyIterator *ByteArrayClass::newIterator(const QScriptValue &object) -{ - return new ByteArrayClassPropertyIterator(object); -} -//! [7] - -QString ByteArrayClass::name() const -{ - return QLatin1String("ByteArray"); -} - -QScriptValue ByteArrayClass::prototype() const -{ - return proto; -} - -QScriptValue ByteArrayClass::constructor() -{ - return ctor; -} - -QScriptValue ByteArrayClass::newInstance(int size) -{ - return newInstance(QByteArray(size, /*ch=*/0)); -} - -//! [1] -QScriptValue ByteArrayClass::newInstance(const QByteArray &ba) -{ - QScriptValue data = engine()->newVariant(qVariantFromValue(ba)); - return engine()->newObject(this, data); -} -//! [1] - -//! [2] -QScriptValue ByteArrayClass::construct(QScriptContext *ctx, QScriptEngine *) -{ - ByteArrayClass *cls = qscriptvalue_cast(ctx->callee().data()); - if (!cls) - return QScriptValue(); - QScriptValue arg = ctx->argument(0); - if (arg.instanceOf(ctx->callee())) - return cls->newInstance(qscriptvalue_cast(arg)); - int size = arg.toInt32(); - return cls->newInstance(size); -} -//! [2] - -QScriptValue ByteArrayClass::toScriptValue(QScriptEngine *eng, const QByteArray &ba) -{ - QScriptValue ctor = eng->globalObject().property("ByteArray"); - ByteArrayClass *cls = qscriptvalue_cast(ctor.data()); - if (!cls) - return eng->newVariant(qVariantFromValue(ba)); - return cls->newInstance(ba); -} - -void ByteArrayClass::fromScriptValue(const QScriptValue &obj, QByteArray &ba) -{ - ba = obj.toVariant().toByteArray(); -} - - - -ByteArrayClassPropertyIterator::ByteArrayClassPropertyIterator(const QScriptValue &object) - : QScriptClassPropertyIterator(object) -{ - toFront(); -} - -ByteArrayClassPropertyIterator::~ByteArrayClassPropertyIterator() -{ -} - -//! [8] -bool ByteArrayClassPropertyIterator::hasNext() const -{ - QByteArray *ba = qscriptvalue_cast(object().data()); - return m_index < ba->size(); -} - -void ByteArrayClassPropertyIterator::next() -{ - m_last = m_index; - ++m_index; -} - -bool ByteArrayClassPropertyIterator::hasPrevious() const -{ - return (m_index > 0); -} - -void ByteArrayClassPropertyIterator::previous() -{ - --m_index; - m_last = m_index; -} - -void ByteArrayClassPropertyIterator::toFront() -{ - m_index = 0; - m_last = -1; -} - -void ByteArrayClassPropertyIterator::toBack() -{ - QByteArray *ba = qscriptvalue_cast(object().data()); - m_index = ba->size(); - m_last = -1; -} - -QScriptString ByteArrayClassPropertyIterator::name() const -{ - return object().engine()->toStringHandle(QString::number(m_last)); -} - -uint ByteArrayClassPropertyIterator::id() const -{ - return m_last; -} -//! [8] diff --git a/plasma/scriptengine/simplebindings/bytearrayclass.h b/plasma/scriptengine/simplebindings/bytearrayclass.h deleted file mode 100644 index 12612713..00000000 --- a/plasma/scriptengine/simplebindings/bytearrayclass.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BYTEARRAYCLASS_H -#define BYTEARRAYCLASS_H - -#include -#include -#include -#include - -class ByteArrayClass : public QObject, public QScriptClass -{ -public: - ByteArrayClass(QScriptEngine *engine); - ~ByteArrayClass(); - - QScriptValue constructor(); - - QScriptValue newInstance(int size = 0); - QScriptValue newInstance(const QByteArray &ba); - - QueryFlags queryProperty(const QScriptValue &object, - const QScriptString &name, - QueryFlags flags, uint *id); - - QScriptValue property(const QScriptValue &object, - const QScriptString &name, uint id); - - void setProperty(QScriptValue &object, const QScriptString &name, - uint id, const QScriptValue &value); - - QScriptValue::PropertyFlags propertyFlags( - const QScriptValue &object, const QScriptString &name, uint id); - - QScriptClassPropertyIterator *newIterator(const QScriptValue &object); - - QString name() const; - - QScriptValue prototype() const; - -private: - static QScriptValue construct(QScriptContext *ctx, QScriptEngine *eng); - - static QScriptValue toScriptValue(QScriptEngine *eng, const QByteArray &ba); - static void fromScriptValue(const QScriptValue &obj, QByteArray &ba); - - QScriptString length; - QScriptValue proto; - QScriptValue ctor; -}; - -#endif diff --git a/plasma/scriptengine/simplebindings/bytearrayprototype.cpp b/plasma/scriptengine/simplebindings/bytearrayprototype.cpp deleted file mode 100644 index 2bb5f99e..00000000 --- a/plasma/scriptengine/simplebindings/bytearrayprototype.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "bytearrayprototype.h" -#include - -Q_DECLARE_METATYPE(QByteArray*) - -ByteArrayPrototype::ByteArrayPrototype(QObject *parent) - : QObject(parent) -{ -} - -ByteArrayPrototype::~ByteArrayPrototype() -{ -} - -//! [0] -QByteArray *ByteArrayPrototype::thisByteArray() const -{ - return qscriptvalue_cast(thisObject().data()); -} -//! [0] - -void ByteArrayPrototype::chop(int n) -{ - thisByteArray()->chop(n); -} - -bool ByteArrayPrototype::equals(const QByteArray &other) -{ - return *thisByteArray() == other; -} - -QByteArray ByteArrayPrototype::left(int len) const -{ - return thisByteArray()->left(len); -} - -//! [1] -QByteArray ByteArrayPrototype::mid(int pos, int len) const -{ - return thisByteArray()->mid(pos, len); -} - -QScriptValue ByteArrayPrototype::remove(int pos, int len) -{ - thisByteArray()->remove(pos, len); - return thisObject(); -} -//! [1] - -QByteArray ByteArrayPrototype::right(int len) const -{ - return thisByteArray()->right(len); -} - -QByteArray ByteArrayPrototype::simplified() const -{ - return thisByteArray()->simplified(); -} - -QByteArray ByteArrayPrototype::toBase64() const -{ - return thisByteArray()->toBase64(); -} - -QByteArray ByteArrayPrototype::toLower() const -{ - return thisByteArray()->toLower(); -} - -QByteArray ByteArrayPrototype::toUpper() const -{ - return thisByteArray()->toUpper(); -} - -QByteArray ByteArrayPrototype::trimmed() const -{ - return thisByteArray()->trimmed(); -} - -void ByteArrayPrototype::truncate(int pos) -{ - thisByteArray()->truncate(pos); -} - -QString ByteArrayPrototype::toLatin1String() const -{ - return QString::fromLatin1(*thisByteArray()); -} - -QString ByteArrayPrototype::toUtf8() const -{ - return QString::fromUtf8(*thisByteArray()); -} - -//! [2] -QScriptValue ByteArrayPrototype::valueOf() const -{ - return thisObject().data(); -} -//! [2] diff --git a/plasma/scriptengine/simplebindings/bytearrayprototype.h b/plasma/scriptengine/simplebindings/bytearrayprototype.h deleted file mode 100644 index d2a3c8e8..00000000 --- a/plasma/scriptengine/simplebindings/bytearrayprototype.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BYTEARRAYPROTOTYPE_H -#define BYTEARRAYPROTOTYPE_H - -#include -#include -#include -#include - -//! [0] -class ByteArrayPrototype : public QObject, public QScriptable -{ -Q_OBJECT -public: - ByteArrayPrototype(QObject *parent = 0); - ~ByteArrayPrototype(); - -public slots: - void chop(int n); - bool equals(const QByteArray &other); - QByteArray left(int len) const; - QByteArray mid(int pos, int len = -1) const; - QScriptValue remove(int pos, int len); - QByteArray right(int len) const; - QByteArray simplified() const; - QByteArray toBase64() const; - QByteArray toLower() const; - QByteArray toUpper() const; - QByteArray trimmed() const; - void truncate(int pos); - QString toLatin1String() const; - QString toUtf8() const; - QScriptValue valueOf() const; - -private: - QByteArray *thisByteArray() const; -}; -//! [0] - - -#endif diff --git a/plasma/scriptengine/simplebindings/dataengine.cpp b/plasma/scriptengine/simplebindings/dataengine.cpp deleted file mode 100644 index 299e00c2..00000000 --- a/plasma/scriptengine/simplebindings/dataengine.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Richard J. Moore - * - * This program 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 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 Library 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 "dataengine.h" - -typedef Plasma::Service *ServicePtr; -QScriptValue qScriptValueFromService(QScriptEngine *engine, const ServicePtr &service) -{ - return engine->newQObject(const_cast(service), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void serviceFromQScriptValue(const QScriptValue &scriptValue, ServicePtr &service) -{ - QObject *obj = scriptValue.toQObject(); - service = static_cast(obj); -} - -typedef Plasma::DataEngine *DataEnginePtr; -QScriptValue qScriptValueFromDataEngine(QScriptEngine *engine, const DataEnginePtr &dataEngine) -{ - return engine->newQObject(const_cast(dataEngine), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void dataEngineFromQScriptValue(const QScriptValue &scriptValue, DataEnginePtr &dataEngine) -{ - QObject *obj = scriptValue.toQObject(); - dataEngine = static_cast(obj); -} - -typedef Plasma::ServiceJob *ServiceJobPtr; -QScriptValue qScriptValueFromServiceJob(QScriptEngine *engine, const ServiceJobPtr &serviceJob) -{ - return engine->newQObject(const_cast(serviceJob), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void serviceJobFromQScriptValue(const QScriptValue &scriptValue, ServiceJobPtr &serviceJob) -{ - QObject *obj = scriptValue.toQObject(); - serviceJob = static_cast(obj); -} - -typedef QMap< QString, QString > StringStringMap; -Q_DECLARE_METATYPE(StringStringMap) - -void registerDataEngineMetaTypes(QScriptEngine *engine) -{ - qRegisterMetaType("Plasma::DataEngine::Data"); - qRegisterMetaType("DataEngine::Data"); - qScriptRegisterVariantMapMetaType(engine); - qScriptRegisterMapMetaType(engine); - qScriptRegisterMetaType(engine, qScriptValueFromService, serviceFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromDataEngine, dataEngineFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromServiceJob, serviceJobFromQScriptValue); - qRegisterMetaType("Service*"); - qRegisterMetaType("ServiceJob*"); -} - diff --git a/plasma/scriptengine/simplebindings/dataengine.h b/plasma/scriptengine/simplebindings/dataengine.h deleted file mode 100644 index 8fa401a4..00000000 --- a/plasma/scriptengine/simplebindings/dataengine.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2007 Richard J. Moore - * - * This program 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 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 Library 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 DATAENGINE_H -#define DATAENGINE_H - -#include -#include -#include -#include - -#include -#include -#include - -using namespace Plasma; - -Q_DECLARE_METATYPE(DataEngine::Dict) -Q_DECLARE_METATYPE(DataEngine::Data) - -template -QScriptValue qScriptValueFromMap(QScriptEngine *eng, const M &map) -{ - //kDebug() << "qScriptValueFromMap called"; - QScriptValue obj = eng->newObject(); - typename M::const_iterator begin = map.constBegin(); - typename M::const_iterator end = map.constEnd(); - typename M::const_iterator it; - for (it = begin; it != end; ++it) { - obj.setProperty(it.key(), qScriptValueFromValue(eng, it.value())); - } - - return obj; -} - -template -QScriptValue qScriptValueFromVariantMap(QScriptEngine *eng, const M &map) -{ - //kDebug() << "qScriptValueFromMap called"; - QScriptValue obj = eng->newObject(); - typename M::const_iterator begin = map.constBegin(); - typename M::const_iterator end = map.constEnd(); - typename M::const_iterator it; - for (it = begin; it != end; ++it) { - if (it.value().type() == QVariant::Hash) { - obj.setProperty(it.key(), qScriptValueFromMap(eng, it.value().toHash())); - } else if (it.value().type() == QVariant::Map) { - obj.setProperty(it.key(), qScriptValueFromMap(eng, it.value().toMap())); - } else { - obj.setProperty(it.key(), qScriptValueFromValue(eng, it.value())); - } - } - - return obj; -} - -template -void qScriptValueToMap(const QScriptValue &value, M &map) -{ - //kDebug() << "qScriptValueToMap called"; - QScriptValueIterator it(value); - while (it.hasNext()) { - it.next(); - map[it.name()] = qscriptvalue_cast(it.value()); - } -} - -template -int qScriptRegisterVariantMapMetaType( - QScriptEngine *engine, - const QScriptValue &prototype = QScriptValue() -#ifndef qdoc - , T * /* dummy */ = 0 -#endif -) -{ - return qScriptRegisterMetaType(engine, qScriptValueFromVariantMap, qScriptValueToMap, prototype); -} - -template -int qScriptRegisterMapMetaType( - QScriptEngine *engine, - const QScriptValue &prototype = QScriptValue() -#ifndef qdoc - , T * /* dummy */ = 0 -#endif -) -{ - return qScriptRegisterMetaType(engine, qScriptValueFromMap, qScriptValueToMap, prototype); -} - -void registerDataEngineMetaTypes(QScriptEngine *engine); - -#endif // DATAENGINE_H - diff --git a/plasma/scriptengine/simplebindings/dataenginereceiver.cpp b/plasma/scriptengine/simplebindings/dataenginereceiver.cpp deleted file mode 100644 index b3d9b95c..00000000 --- a/plasma/scriptengine/simplebindings/dataenginereceiver.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2010 Aaron J. Seigo - * - * This program 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 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 Library 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 "dataenginereceiver.h" - -#include - -#include "dataengine.h" -#include "scriptenv.h" - -QSet DataEngineReceiver::s_receivers; - -DataEngineReceiver::DataEngineReceiver(const Plasma::DataEngine *engine, const QString &source, const QScriptValue &func, QObject *parent) - : QObject(parent), - m_engine(engine), - m_source(source), - m_func(func), - m_obj(m_func) -{ - s_receivers.insert(this); - if (!m_func.isFunction()) { - QScriptValue func = m_func.property("dataUpdated"); - if (func.isFunction()) { - m_func = func; - } else { - m_obj = QScriptValue(); - } - } -} - -DataEngineReceiver::~DataEngineReceiver() -{ - s_receivers.remove(this); - //kDebug() << s_receivers.count(); -} - -bool DataEngineReceiver::isValid() const -{ - return m_obj.isValid(); -} - -bool DataEngineReceiver::matches(const Plasma::DataEngine *engine, const QString &source, const QScriptValue &v) -{ - return engine == m_engine && m_source == source && v.equals(m_obj); -} - -void DataEngineReceiver::dataUpdated(const QString &source, const Plasma::DataEngine::Data &data) -{ - QScriptEngine *engine = m_func.engine(); -// QScriptValue appletValue = engine->globalObject().property("plasmoid"); - QScriptValueList args; - args << source; - args << qScriptValueFromMap(engine, data); - - m_func.call(m_obj, args); - - if (engine->hasUncaughtException()) { - ScriptEnv *env = ScriptEnv::findScriptEnv(engine); - env->checkForErrors(false); - } -} - -DataEngineReceiver *DataEngineReceiver::getReceiver(Plasma::DataEngine *dataEngine, const QString &source, const QScriptValue &v) -{ - foreach (DataEngineReceiver *receiver, DataEngineReceiver::s_receivers) { - if (receiver->matches(dataEngine, source, v)) { - return receiver; - } - } - - return 0; -} - -QObject *DataEngineReceiver::extractTargetQObject(QScriptEngine *engine, const QString &source, const QScriptValue &v, Plasma::DataEngine *dataEngine) -{ - QObject *obj = 0; - - // if it's a function we get, then use that directly - // next see if it is a qobject with a good slot; if it is then use that directly - // otherwise, try to use the object with a dataUpdated method call - if (v.isFunction()) { - obj = getReceiver(dataEngine, source, v); - if (!obj) { - obj = new DataEngineReceiver(dataEngine, source, v, ScriptEnv::findScriptEnv(engine)); - } - } else if (v.isObject()) { - obj = v.toQObject(); - if (!obj || obj->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") == -1) { - obj = getReceiver(dataEngine, source, v); - if (!obj) { - DataEngineReceiver *receiver = new DataEngineReceiver(dataEngine, source, v, ScriptEnv::findScriptEnv(engine)); - if (receiver->isValid()) { - obj = receiver; - } else { - delete receiver; - } - } - } - } - - return obj; -} - -QScriptValue DataEngineReceiver::connectAllSources(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() < 1) { - return engine->undefinedValue(); - } - - DataEngine *dataEngine = qobject_cast(context->thisObject().toQObject()); - if (!dataEngine) { - return engine->undefinedValue(); - } - - int pollingInterval = 0; - Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment; - if (context->argumentCount() > 1) { - pollingInterval = context->argument(2).toInt32(); - - if (context->argumentCount() > 2) { - intervalAlignment = static_cast(context->argument(4).toInt32()); - } - } - - QObject *obj = extractTargetQObject(engine, QString(), context->argument(0), dataEngine); - if (!obj) { - return engine->undefinedValue(); - } - - dataEngine->connectAllSources(obj, pollingInterval, intervalAlignment); - return true; -} - -QScriptValue DataEngineReceiver::connectSource(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() < 2) { - return engine->undefinedValue(); - } - - DataEngine *dataEngine = qobject_cast(context->thisObject().toQObject()); - if (!dataEngine) { - return engine->undefinedValue(); - } - - const QString source = context->argument(0).toString(); - if (source.isEmpty()) { - return engine->undefinedValue(); - } - - QObject *obj = extractTargetQObject(engine, source, context->argument(1), dataEngine); - if (!obj) { - return engine->undefinedValue(); - } - - int pollingInterval = 0; - Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment; - if (context->argumentCount() > 2) { - pollingInterval = context->argument(2).toInt32(); - - if (context->argumentCount() > 3) { - intervalAlignment = static_cast(context->argument(4).toInt32()); - } - } - - dataEngine->connectSource(source, obj, pollingInterval, intervalAlignment); - return true; -} - -QScriptValue DataEngineReceiver::disconnectSource(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() < 2) { - return engine->undefinedValue(); - } - - DataEngine *dataEngine = qobject_cast(context->thisObject().toQObject()); - if (!dataEngine) { - //kDebug() << "no engine!"; - return engine->undefinedValue(); - } - - const QString source = context->argument(0).toString(); - if (source.isEmpty()) { - //kDebug() << "no source!"; - return engine->undefinedValue(); - } - - QObject *obj = 0; - QScriptValue v = context->argument(1); - if (v.isQObject()) { - obj = v.toQObject(); - } else if (v.isObject() || v.isFunction()) { - foreach (DataEngineReceiver *receiver, DataEngineReceiver::s_receivers) { - if (receiver->matches(dataEngine, source, v)) { - obj = receiver; - receiver->deleteLater(); - break; - } - } - } - - if (!obj) { - //kDebug() << "no object!"; - return engine->undefinedValue(); - } - - dataEngine->disconnectSource(source, obj); - return true; -} - -#include "moc_dataenginereceiver.cpp" - diff --git a/plasma/scriptengine/simplebindings/dataenginereceiver.h b/plasma/scriptengine/simplebindings/dataenginereceiver.h deleted file mode 100644 index db3af2ec..00000000 --- a/plasma/scriptengine/simplebindings/dataenginereceiver.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010 Aaron Seigo - * - * This program 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 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 Library 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 DATAENGINERECEIVER_H -#define DATAENGINERECEIVER_H - -#include - -#include - -#include -#include - -class DataEngineReceiver : public QObject -{ - Q_OBJECT -public: - DataEngineReceiver(const Plasma::DataEngine *engine, const QString &source, const QScriptValue &func, QObject *parent); - ~DataEngineReceiver(); - - bool isValid() const; - - static QScriptValue connectSource(QScriptContext *context, QScriptEngine *engine); - static QScriptValue connectAllSources(QScriptContext *context, QScriptEngine *engine); - static QScriptValue disconnectSource(QScriptContext *context, QScriptEngine *engine); - static QSet s_receivers; - - bool matches(const Plasma::DataEngine *engine, const QString &source, const QScriptValue &v); - -public Q_SLOTS: - void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data); - -private: - static DataEngineReceiver *getReceiver(Plasma::DataEngine *dataEngine, const QString &source, const QScriptValue &v); - static QObject *extractTargetQObject(QScriptEngine *engine, const QString &source, const QScriptValue &v, Plasma::DataEngine *dataEngine); - - const Plasma::DataEngine *m_engine; - const QString m_source; - QScriptValue m_func; - QScriptValue m_obj; -}; - -#endif // DATAENGINERECEIVER_H - diff --git a/plasma/scriptengine/simplebindings/filedialogproxy.cpp b/plasma/scriptengine/simplebindings/filedialogproxy.cpp deleted file mode 100644 index b1435996..00000000 --- a/plasma/scriptengine/simplebindings/filedialogproxy.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 "filedialogproxy.h" - -#include - -#include - -FileDialogProxy::FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent) - : QObject(parent), - m_dialog(new KFileDialog(KUrl("~"), QString(), 0)) -{ - m_dialog->setOperationMode(mode); - connect(m_dialog, SIGNAL(finished()), this, SLOT(dialogFinished())); -} - -FileDialogProxy::~FileDialogProxy() -{ - delete m_dialog; -} - -KUrl FileDialogProxy::selectedUrl() const -{ - return m_dialog->selectedUrl(); -} - -void FileDialogProxy::setUrl(const KUrl &url) -{ - m_dialog->setUrl(url); -} - -KUrl::List FileDialogProxy::selectedUrls() const -{ - return m_dialog->selectedUrls(); -} - -KUrl FileDialogProxy::baseUrl() const -{ - return m_dialog->baseUrl(); -} - -QString FileDialogProxy::selectedFile() const -{ - return m_dialog->selectedFile(); -} - -QStringList FileDialogProxy::selectedFiles() const -{ - return m_dialog->selectedFiles(); -} - -QString FileDialogProxy::filter() const -{ - return m_dialog->currentFilter(); -} - -void FileDialogProxy::setFilter(const QString &filter) -{ - m_dialog->setFilter(filter); -} - -bool FileDialogProxy::localOnly() const -{ - return m_dialog->mode() & KFile::LocalOnly; -} - -void FileDialogProxy::setLocalOnly(bool localOnly) -{ - if (localOnly) { - m_dialog->setMode(m_dialog->mode() ^ KFile::LocalOnly); - } else { - m_dialog->setMode(m_dialog->mode() | KFile::LocalOnly); - } -} - -bool FileDialogProxy::directoriesOnly() const -{ - return m_dialog->mode() & KFile::Directory; -} - -void FileDialogProxy::setDirectoriesOnly(bool directoriesOnly) -{ - if (directoriesOnly) { - m_dialog->setMode(m_dialog->mode() ^ KFile::Directory); - } else { - m_dialog->setMode(m_dialog->mode() | KFile::Directory); - } -} - -bool FileDialogProxy::existingOnly() const -{ - return m_dialog->mode() & KFile::ExistingOnly; -} - -void FileDialogProxy::setExistingOnly(bool existingOnly) -{ - if (existingOnly) { - m_dialog->setMode(m_dialog->mode() ^ KFile::ExistingOnly); - } else { - m_dialog->setMode(m_dialog->mode() | KFile::ExistingOnly); - } -} - -void FileDialogProxy::show() -{ - m_dialog->show(); -} - -void FileDialogProxy::dialogFinished() -{ - if (m_dialog->result() == QDialog::Accepted) { - emit accepted(this); - } - emit finished(this); -} - -Q_DECLARE_METATYPE(FileDialogProxy *) -typedef FileDialogProxy* FileDialogProxyPtr; -QScriptValue qScriptValueFromFileDialogProxy(QScriptEngine *engine, const FileDialogProxyPtr &fd) -{ - return engine->newQObject(const_cast(fd), QScriptEngine::AutoOwnership, - QScriptEngine::PreferExistingWrapperObject | QScriptEngine::ExcludeSuperClassContents); -} - -void fileDialogProxyFromQScriptValue(const QScriptValue &scriptValue, FileDialogProxyPtr &fd) -{ - QObject *obj = scriptValue.toQObject(); - fd = static_cast(obj); -} - -void FileDialogProxy::registerWithRuntime(QScriptEngine *engine) -{ - QScriptValue global = engine->globalObject(); - qScriptRegisterMetaType(engine, qScriptValueFromFileDialogProxy, fileDialogProxyFromQScriptValue); - global.setProperty("OpenFileDialog", engine->newFunction(FileDialogProxy::fileDialogOpen)); - global.setProperty("SaveFileDialog", engine->newFunction(FileDialogProxy::fileDialogSave)); -} - -QScriptValue FileDialogProxy::fileDialogSave(QScriptContext *context, QScriptEngine *engine) -{ - QObject *parent = 0; - if (context->argumentCount()) { - parent = context->argument(0).toQObject(); - } - - FileDialogProxy *fd = new FileDialogProxy(KFileDialog::Saving, parent); - return engine->newQObject(fd, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents); -} - -QScriptValue FileDialogProxy::fileDialogOpen(QScriptContext *context, QScriptEngine *engine) -{ - QObject *parent = 0; - if (context->argumentCount()) { - parent = context->argument(0).toQObject(); - } - - FileDialogProxy *fd = new FileDialogProxy(KFileDialog::Opening, parent); - return engine->newQObject(fd, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents); -} - -#include "moc_filedialogproxy.cpp" - diff --git a/plasma/scriptengine/simplebindings/filedialogproxy.h b/plasma/scriptengine/simplebindings/filedialogproxy.h deleted file mode 100644 index 6bdc6ce8..00000000 --- a/plasma/scriptengine/simplebindings/filedialogproxy.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 FILEDIALOGPROXY_H -#define FILEDIALOGPROXY_H - -#include -#include - -#include - -#include -#include - -class FileDialogProxy : public QObject -{ - Q_OBJECT - Q_PROPERTY(KUrl url READ selectedUrl WRITE setUrl) - Q_PROPERTY(KUrl::List urls READ selectedUrls) - Q_PROPERTY(KUrl baseUrl READ baseUrl) - Q_PROPERTY(QString file READ selectedFile) - Q_PROPERTY(QStringList files READ selectedFiles) - Q_PROPERTY(QString filter READ filter WRITE setFilter) - Q_PROPERTY(bool localOnly READ localOnly WRITE setLocalOnly) - Q_PROPERTY(bool directoriesOnly READ directoriesOnly WRITE setDirectoriesOnly) - Q_PROPERTY(bool existingOnly READ existingOnly WRITE setExistingOnly) - -public: - FileDialogProxy(KFileDialog::OperationMode mode, QObject *parent = 0); - ~FileDialogProxy(); - - KUrl selectedUrl() const; - void setUrl(const KUrl &url); - - KUrl::List selectedUrls() const; - KUrl baseUrl() const; - QString selectedFile() const; - QStringList selectedFiles() const; - - QString filter() const; - void setFilter(const QString &filter); - - bool localOnly() const; - void setLocalOnly(bool localOnly); - - bool directoriesOnly() const; - void setDirectoriesOnly(bool directoriesOnly); - - bool existingOnly() const; - void setExistingOnly(bool existingOnly); - - static void registerWithRuntime(QScriptEngine *global); - static QScriptValue fileDialogSave(QScriptContext *context, QScriptEngine *engine); - static QScriptValue fileDialogOpen(QScriptContext *context, QScriptEngine *engine); - -public Q_SLOTS: - void show(); - -Q_SIGNALS: - void accepted(FileDialogProxy *); - void finished(FileDialogProxy *); - -private Q_SLOTS: - void dialogFinished(); - -private: - KFileDialog *m_dialog; -}; - -#endif diff --git a/plasma/scriptengine/simplebindings/point.cpp b/plasma/scriptengine/simplebindings/point.cpp deleted file mode 100644 index 3d37f357..00000000 --- a/plasma/scriptengine/simplebindings/point.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2007 Richard J. Moore - * - * This program 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 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 Library 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 -#include -#include -#include -#include "backportglobal.h" - -Q_DECLARE_METATYPE(QPoint*) -Q_DECLARE_METATYPE(QPoint) - -static QScriptValue pointCtor(QScriptContext *ctx, QScriptEngine *eng) -{ - if (ctx->argumentCount() == 2) - { - int x = ctx->argument(0).toInt32(); - int y = ctx->argument(1).toInt32(); - return qScriptValueFromValue(eng, QPoint(x, y)); - } - - return qScriptValueFromValue(eng, QPoint()); -} - -static QScriptValue pointNull(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QPoint, null); - return QScriptValue(eng, self->isNull()); -} - -static QScriptValue pointManhattanLength(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QPoint, manhattanLength); - return QScriptValue(eng, self->manhattanLength()); -} - -static QScriptValue pointX(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QPoint, x); - - if (ctx->argumentCount() > 0) { - int x = ctx->argument(0).toInt32(); - self->setX(x); - } - - return QScriptValue(eng, self->x()); -} - -static QScriptValue pointY(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(QPoint, y); - - if (ctx->argumentCount() > 0) { - int y = ctx->argument(0).toInt32(); - self->setY(y); - } - - return QScriptValue(eng, self->y()); -} - -QScriptValue constructQPointClass(QScriptEngine *eng) -{ - QScriptValue proto = qScriptValueFromValue(eng, QPoint()); - QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter; - QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter; - - proto.setProperty("null", eng->newFunction(pointNull), getter); - proto.setProperty("manhattanLength", eng->newFunction(pointManhattanLength), getter); - proto.setProperty("x", eng->newFunction(pointX), getter | setter); - proto.setProperty("y", eng->newFunction(pointY), getter | setter); - - eng->setDefaultPrototype(qMetaTypeId(), proto); - eng->setDefaultPrototype(qMetaTypeId(), proto); - - return eng->newFunction(pointCtor, proto); -} diff --git a/plasma/scriptengine/simplebindings/qscriptbookkeeping.cpp b/plasma/scriptengine/simplebindings/qscriptbookkeeping.cpp deleted file mode 100644 index 9394d6c3..00000000 --- a/plasma/scriptengine/simplebindings/qscriptbookkeeping.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright 2007-2008 Richard J. Moore - * Copyright 2009 Aaron J. Seigo - * - * This program 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 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 Library 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 -#include - -#include -#include -#include - -#include -#include -#include - -#include "dataengine.h" - -Q_DECLARE_METATYPE(KConfigGroup) -Q_DECLARE_METATYPE(KJob *) -Q_DECLARE_METATYPE(KIO::Job *) - -Q_DECLARE_METATYPE(QGraphicsWidget*) -Q_DECLARE_METATYPE(QGraphicsLayout*) - -Q_DECLARE_METATYPE(Plasma::Animation*) -Q_DECLARE_METATYPE(Plasma::Applet*) -Q_DECLARE_METATYPE(Plasma::Extender*) -Q_DECLARE_METATYPE(Plasma::Svg*) -Q_DECLARE_METATYPE(Qt::MouseButton) -Q_DECLARE_METATYPE(QList) - -typedef KJob* KJobPtr; -QScriptValue qScriptValueFromKJob(QScriptEngine *engine, const KJobPtr &job) -{ - return engine->newQObject(const_cast(job), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void qKJobFromQScriptValue(const QScriptValue &scriptValue, KJobPtr &job) -{ - QObject *obj = scriptValue.toQObject(); - job = static_cast(obj); -} - -typedef KIO::Job* KioJobPtr; -QScriptValue qScriptValueFromKIOJob(QScriptEngine *engine, const KioJobPtr &job) -{ - return engine->newQObject(const_cast(job), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void qKIOJobFromQScriptValue(const QScriptValue &scriptValue, KioJobPtr &job) -{ - QObject *obj = scriptValue.toQObject(); - job = static_cast(obj); -} - -QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGroup &config) -{ - QScriptValue obj = engine->newObject(); - - if (!config.isValid()) { - return obj; - } - - QMap entryMap = config.entryMap(); - QMap::const_iterator it = entryMap.constBegin(); - QMap::const_iterator begin = it; - QMap::const_iterator end = entryMap.constEnd(); - - //setting the group name - obj.setProperty("__file", QScriptValue(engine, config.config()->name())); - obj.setProperty("__name", QScriptValue(engine, config.name())); - - //setting the key/value pairs - for (it = begin; it != end; ++it) { - //kDebug() << "setting" << it.key() << "to" << it.value(); - QString prop = it.key(); - prop.replace(' ', '_'); - obj.setProperty(prop, it.value()); - } - - return obj; -} - -void kConfigGroupFromScriptValue(const QScriptValue& obj, KConfigGroup &config) -{ - config = KConfigGroup(KSharedConfig::openConfig(obj.property("__file").toString()), obj.property("__name").toString()); - - QScriptValueIterator it(obj); - - while (it.hasNext()) { - it.next(); - //kDebug() << it.name() << "is" << it.value().toString(); - if (it.name() != "__name") { - config.writeEntry(it.name(), it.value().toString()); - } - } -} - -typedef Plasma::Animation* AnimationPtr; -QScriptValue qScriptValueFromAnimation(QScriptEngine *engine, const AnimationPtr &anim) -{ - return engine->newQObject(const_cast(anim), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void abstractAnimationFromQScriptValue(const QScriptValue &scriptValue, AnimationPtr &anim) -{ - QObject *obj = scriptValue.toQObject(); - anim = static_cast(obj); -} - -typedef QGraphicsWidget * QGraphicsWidgetPtr; -QScriptValue qScriptValueFromQGraphicsWidget(QScriptEngine *engine, const QGraphicsWidgetPtr &anim) -{ - return engine->newQObject(const_cast(anim), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void graphicsWidgetFromQScriptValue(const QScriptValue &scriptValue, QGraphicsWidgetPtr &anim) -{ - QObject *obj = scriptValue.toQObject(); - anim = static_cast(obj); -} - -typedef Plasma::Svg * SvgPtr; -QScriptValue qScriptValueFromSvg(QScriptEngine *engine, const SvgPtr &anim) -{ - return engine->newQObject(const_cast(anim), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void svgFromQScriptValue(const QScriptValue &scriptValue, SvgPtr &anim) -{ - QObject *obj = scriptValue.toQObject(); - anim = static_cast(obj); -} - -typedef Plasma::Extender *ExtenderPtr; -QScriptValue qScriptValueFromExtender(QScriptEngine *engine, const ExtenderPtr &extender) -{ - return engine->newQObject(const_cast(extender), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject); -} - -void extenderFromQScriptValue(const QScriptValue &scriptValue, ExtenderPtr &extender) -{ - QObject *obj = scriptValue.toQObject(); - extender = static_cast(obj); -} - -QScriptValue qScriptValueFromMouseButton(QScriptEngine *, const Qt::MouseButton &button) -{ - return int(button); -} - -void mouseButtonFromScriptValue(const QScriptValue &scriptValue, Qt::MouseButton &button) -{ - button = static_cast(scriptValue.toInt32()); -} - -void registerSimpleAppletMetaTypes(QScriptEngine *engine) -{ - qScriptRegisterMetaType(engine, qScriptValueFromKConfigGroup, kConfigGroupFromScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromKJob, qKJobFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromKIOJob, qKIOJobFromQScriptValue); - registerDataEngineMetaTypes(engine); - - qScriptRegisterMetaType(engine, qScriptValueFromQGraphicsWidget, graphicsWidgetFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromSvg, svgFromQScriptValue); - - qScriptRegisterSequenceMetaType >(engine); - qScriptRegisterMetaType(engine, qScriptValueFromAnimation, abstractAnimationFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromExtender, extenderFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromMouseButton, mouseButtonFromScriptValue); -} - - diff --git a/plasma/scriptengine/simplebindings/url.cpp b/plasma/scriptengine/simplebindings/url.cpp deleted file mode 100644 index b96cf27c..00000000 --- a/plasma/scriptengine/simplebindings/url.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2007 Richard J. Moore - * - * This program 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 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 Library 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 -#include -#include -#include -#include "backportglobal.h" - -Q_DECLARE_METATYPE(KUrl*) -//Q_DECLARE_METATYPE(KUrl) unneeded; found in kurl.h - -static QScriptValue urlCtor(QScriptContext *ctx, QScriptEngine *eng) -{ - if (ctx->argumentCount() == 1) - { - QString url = ctx->argument(0).toString(); - return qScriptValueFromValue(eng, KUrl(url)); - } - - return qScriptValueFromValue(eng, KUrl()); -} - -static QScriptValue urlToString(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(KUrl, toString); - return QScriptValue(eng, self->prettyUrl()); -} - -static QScriptValue urlProtocol(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(KUrl, protocol); - if (ctx->argumentCount()) { - QString v = ctx->argument(0).toString(); - self->setScheme(v); - } - - return QScriptValue(eng, self->protocol()); -} - -static QScriptValue urlHost(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(KUrl, protocol); - if (ctx->argumentCount()) { - QString v = ctx->argument(0).toString(); - self->setHost(v); - } - - return QScriptValue(eng, self->host()); -} - -static QScriptValue urlPath(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(KUrl, path); - if (ctx->argumentCount()) { - QString v = ctx->argument(0).toString(); - self->setPath(v); - } - - return QScriptValue(eng, self->path()); -} - -static QScriptValue urlUser(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(KUrl, user); - if (ctx->argumentCount()) { - QString v = ctx->argument(0).toString(); - self->setUserName(v); - } - - return QScriptValue(eng, self->userName()); -} - -static QScriptValue urlPassword(QScriptContext *ctx, QScriptEngine *eng) -{ - DECLARE_SELF(KUrl, password); - if (ctx->argumentCount()) { - QString v = ctx->argument(0).toString(); - self->setPassword(v); - } - - return QScriptValue(eng, self->password()); -} - -QScriptValue constructKUrlClass(QScriptEngine *eng) -{ - QScriptValue proto = qScriptValueFromValue(eng, KUrl()); - QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter; - QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter; - - proto.setProperty("toString", eng->newFunction(urlToString), getter); - proto.setProperty("protocol", eng->newFunction(urlProtocol), getter | setter); - proto.setProperty("host", eng->newFunction(urlHost), getter | setter); - proto.setProperty("path", eng->newFunction(urlPath), getter | setter); - proto.setProperty("user", eng->newFunction(urlUser), getter | setter); - proto.setProperty("password", eng->newFunction(urlPassword), getter | setter); - - eng->setDefaultPrototype(qMetaTypeId(), proto); - eng->setDefaultPrototype(qMetaTypeId(), proto); - - return eng->newFunction(urlCtor, proto); -} diff --git a/plasma/shells/plasma-desktop/CMakeLists.txt b/plasma/shells/plasma-desktop/CMakeLists.txt index 069c1e17..8e018736 100644 --- a/plasma/shells/plasma-desktop/CMakeLists.txt +++ b/plasma/shells/plasma-desktop/CMakeLists.txt @@ -1,17 +1,13 @@ include_directories( ${CMAKE_SOURCE_DIR}/libs ${CMAKE_SOURCE_DIR}/libs/plasmagenericshell - ${CMAKE_SOURCE_DIR}/plasma/desktop/shell/scripting ) set(plasma_SRCS - scripting/desktopscriptengine.cpp - scripting/panel.cpp controllerwindow.cpp desktopcorona.cpp desktopview.cpp desktoptracker.cpp - interactiveconsole.cpp main.cpp panelcontroller.cpp panelview.cpp @@ -32,8 +28,6 @@ target_link_libraries(plasma-desktop KDE4::kfile KDE4::ktexteditor KDE4::kidletime - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} ${X11_LIBRARIES} kworkspace plasmagenericshell @@ -49,11 +43,6 @@ install( DESTINATION ${KDE4_AUTOSTART_INSTALL_DIR} ) -install( - FILES data/plasma-desktop-js.xml - DESTINATION ${KDE4_DATA_INSTALL_DIR}/katepart/syntax/ -) - install( FILES data/plasma-desktoprc DESTINATION ${KDE4_CONFIG_INSTALL_DIR} diff --git a/plasma/shells/plasma-desktop/data/plasma-desktop-js.xml b/plasma/shells/plasma-desktop/data/plasma-desktop-js.xml deleted file mode 100644 index ee8a7780..00000000 --- a/plasma/shells/plasma-desktop/data/plasma-desktop-js.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/plasma/shells/plasma-desktop/dbus/org.kde.plasma.App.xml b/plasma/shells/plasma-desktop/dbus/org.kde.plasma.App.xml index bf44dff6..3259408b 100644 --- a/plasma/shells/plasma-desktop/dbus/org.kde.plasma.App.xml +++ b/plasma/shells/plasma-desktop/dbus/org.kde.plasma.App.xml @@ -1,11 +1,6 @@ - - - - - diff --git a/plasma/shells/plasma-desktop/interactiveconsole.cpp b/plasma/shells/plasma-desktop/interactiveconsole.cpp deleted file mode 100644 index 96acbb00..00000000 --- a/plasma/shells/plasma-desktop/interactiveconsole.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "interactiveconsole.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 "plasmaapp.h" -#include "scripting/desktopscriptengine.h" - -// TODO: interative help? -static const QString s_autosaveFileName("interactiveconsoleautosave.js"); - -InteractiveConsole::InteractiveConsole(Plasma::Corona *corona, QWidget *parent) - : KDialog(parent), - m_corona(corona), - m_splitter(new QSplitter(Qt::Vertical, this)), - m_docEditor(0), - m_editor(0), - m_loadAction(KStandardAction::open(this, SLOT(openScriptFile()), this)), - m_saveAction(KStandardAction::saveAs(this, SLOT(saveScript()), this)), - m_clearAction(KStandardAction::clear(this, SLOT(clearEditor()), this)), - m_executeAction(new KAction(KIcon("system-run"), i18n("&Execute"), this)), - m_fileDialog(0) -{ - addAction(KStandardAction::close(this, SLOT(close()), this)); - addAction(m_saveAction); - addAction(m_clearAction); - - setWindowTitle(KDialog::makeStandardCaption(i18n("Desktop Shell Scripting Console"))); - setAttribute(Qt::WA_DeleteOnClose); - setButtons(KDialog::None); - - QWidget *widget = new QWidget(m_splitter); - QVBoxLayout *editorLayout = new QVBoxLayout(widget); - - QLabel *label = new QLabel(i18n("Editor"), widget); - QFont f = label->font(); - f.setBold(true); - label->setFont(f); - editorLayout->addWidget(label); - - KToolBar *toolBar = new KToolBar(this, true, false); - toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - toolBar->addAction(m_loadAction); - toolBar->addAction(m_saveAction); - toolBar->addAction(m_clearAction); - toolBar->addAction(m_executeAction); - - editorLayout->addWidget(toolBar); - - m_docEditor = KTextEditor::EditorChooser::editor()->createDocument(widget); - if (m_docEditor) { - m_docEditor->setHighlightingMode("JavaScript/PlasmaDesktop"); - - KTextEditor::View * view = m_docEditor->createView(widget); - view->setContextMenu(view->defaultContextMenu()); - - KTextEditor::ConfigInterface *config = qobject_cast(view); - if (config) { - config->setConfigValue("line-numbers", true); - config->setConfigValue("dynamic-word-wrap", true); - } - - editorLayout->addWidget(view); - connect(m_docEditor, SIGNAL(textChanged(KTextEditor::Document*)), - this, SLOT(scriptTextChanged())); - } - - if (!m_docEditor) { - m_editor = new KTextEdit(widget); - editorLayout->addWidget(m_editor); - connect(m_editor, SIGNAL(textChanged()), this, SLOT(scriptTextChanged())); - } - - m_splitter->addWidget(widget); - - widget = new QWidget(m_splitter); - QVBoxLayout *outputLayout = new QVBoxLayout(widget); - - label = new QLabel(i18n("Output"), widget); - f = label->font(); - f.setBold(true); - label->setFont(f); - outputLayout->addWidget(label); - - KToolBar *outputToolBar = new KToolBar(widget, true, false); - outputToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - QAction *clearOutputAction = KStandardAction::clear(this, SLOT(clearOutput()), this); - outputToolBar->addAction(clearOutputAction); - outputLayout->addWidget(outputToolBar); - - m_output = new QTextBrowser(widget); - outputLayout->addWidget(m_output); - m_splitter->addWidget(widget); - - setMainWidget(m_splitter); - - setInitialSize(QSize(700, 500)); - KConfigGroup cg(KGlobal::config(), "InteractiveConsole"); - restoreDialogSize(cg); - - m_splitter->setStretchFactor(0, 10); - m_splitter->restoreState(cg.readEntry("SplitterState", QByteArray())); - - scriptTextChanged(); - - connect(m_executeAction, SIGNAL(triggered()), this, SLOT(evaluateScript())); - m_executeAction->setShortcut(Qt::CTRL + Qt::Key_E); - - const QString autosave = KStandardDirs::locateLocal("appdata", s_autosaveFileName); - if (QFile::exists(autosave)) { - loadScript(autosave); - } -} - -InteractiveConsole::~InteractiveConsole() -{ - KConfigGroup cg(KGlobal::config(), "InteractiveConsole"); - saveDialogSize(cg); - cg.writeEntry("SplitterState", m_splitter->saveState()); - kDebug(); -} - -void InteractiveConsole::loadScript(const QString &script) -{ - if (m_docEditor) { - m_docEditor->closeUrl(false); - if (m_docEditor->openUrl(script)) { - m_docEditor->setHighlightingMode("JavaScript/PlasmaDesktop"); - return; - } - } else { - QFile file(KShell::tildeExpand(script)); - if (file.open(QIODevice::ReadOnly | QIODevice::Text) ) { - m_editor->setText(file.readAll()); - return; - } - } - - - m_output->append(i18n("Unable to load script file %1", script)); -} - -void InteractiveConsole::showEvent(QShowEvent *) -{ - if (m_docEditor) { - m_docEditor->activeView()->setFocus(); - } else { - m_editor->setFocus(); - } -} - -void InteractiveConsole::closeEvent(QCloseEvent *event) -{ - onClose(); - KDialog::closeEvent(event); -} - -void InteractiveConsole::reject() -{ - onClose(); - KDialog::reject(); -} - -void InteractiveConsole::onClose() -{ - // need to save first! - const QString path = KStandardDirs::locateLocal("appdata", s_autosaveFileName); - m_closeWhenCompleted = true; - saveScript(path); -} - -void InteractiveConsole::print(const QString &string) -{ - m_output->append(string); -} - -void InteractiveConsole::scriptTextChanged() -{ - const bool enable = m_docEditor ? !m_docEditor->isEmpty() : !m_editor->document()->isEmpty(); - m_saveAction->setEnabled(enable); - m_clearAction->setEnabled(enable); - m_executeAction->setEnabled(enable); -} - -void InteractiveConsole::openScriptFile() -{ - delete m_fileDialog; - - m_fileDialog = new KFileDialog(KUrl(), QString(), 0); - m_fileDialog->setOperationMode(KFileDialog::Opening); - m_fileDialog->setCaption(i18n("Open Script File")); - - QStringList mimetypes; - mimetypes << "application/javascript"; - m_fileDialog->setMimeFilter(mimetypes); - - connect(m_fileDialog, SIGNAL(finished(int)), this, SLOT(openScriptUrlSelected(int))); - m_fileDialog->show(); -} - -void InteractiveConsole::openScriptUrlSelected(int result) -{ - if (!m_fileDialog) { - return; - } - - if (result == QDialog::Accepted) { - const KUrl url = m_fileDialog->selectedUrl(); - if (!url.isEmpty()) { - loadScriptFromUrl(url); - } - } - - m_fileDialog->deleteLater(); - m_fileDialog = 0; -} - -void InteractiveConsole::loadScriptFromUrl(const KUrl &url) -{ - if (m_docEditor) { - m_docEditor->closeUrl(false); - m_docEditor->openUrl(url); - m_docEditor->setHighlightingMode("JavaScript/PlasmaDesktop"); - } else { - m_editor->clear(); - m_editor->setEnabled(false); - - if (m_job) { - m_job.data()->kill(); - } - - m_job = KIO::get(url, KIO::Reload, KIO::HideProgressInfo); - connect(m_job.data(), SIGNAL(data(KIO::Job*,QByteArray)), this, SLOT(scriptFileDataRecvd(KIO::Job*,QByteArray))); - connect(m_job.data(), SIGNAL(result(KJob*)), this, SLOT(reenableEditor(KJob*))); - } -} - -void InteractiveConsole::scriptFileDataRecvd(KIO::Job *job, const QByteArray &data) -{ - Q_ASSERT(m_editor); - - if (job == m_job.data()) { - m_editor->insertPlainText(data); - } -} - -void InteractiveConsole::saveScript() -{ - if (m_docEditor) { - m_docEditor->documentSaveAs(); - return; - } - - delete m_fileDialog; - - m_fileDialog = new KFileDialog(KUrl(), QString(), 0); - m_fileDialog->setOperationMode(KFileDialog::Saving); - m_fileDialog->setCaption(i18n("Save Script File")); - - QStringList mimetypes; - mimetypes << "application/javascript"; - m_fileDialog->setMimeFilter(mimetypes); - - connect(m_fileDialog, SIGNAL(finished(int)), this, SLOT(saveScriptUrlSelected(int))); - m_fileDialog->show(); -} - -void InteractiveConsole::saveScriptUrlSelected(int result) -{ - if (!m_fileDialog) { - return; - } - - if (result == QDialog::Accepted) { - const KUrl url = m_fileDialog->selectedUrl(); - if (!url.isEmpty()) { - saveScript(url); - } - } - - m_fileDialog->deleteLater(); - m_fileDialog = 0; -} - -void InteractiveConsole::saveScript(const KUrl &url) -{ - if (m_docEditor) { - m_docEditor->saveAs(url); - } else { - m_editor->setEnabled(false); - - if (m_job) { - m_job.data()->kill(); - } - - m_job = KIO::put(url, -1, KIO::HideProgressInfo); - connect(m_job.data(), SIGNAL(dataReq(KIO::Job*,QByteArray&)), this, SLOT(scriptFileDataReq(KIO::Job*,QByteArray&))); - connect(m_job.data(), SIGNAL(result(KJob*)), this, SLOT(reenableEditor(KJob*))); - } -} - -void InteractiveConsole::scriptFileDataReq(KIO::Job *job, QByteArray &data) -{ - Q_ASSERT(m_editor); - - if (!m_job || m_job.data() != job) { - return; - } - - data.append(m_editor->toPlainText().toLocal8Bit()); - m_job.clear(); -} - -void InteractiveConsole::reenableEditor(KJob* job) -{ - Q_ASSERT(m_editor); - if (m_closeWhenCompleted && job->error() != 0) { - close(); - } - - m_closeWhenCompleted = false; - m_editor->setEnabled(true); -} - -void InteractiveConsole::evaluateScript() -{ - //kDebug() << "evaluating" << m_editor->toPlainText(); - const QString path = KStandardDirs::locateLocal("appdata", s_autosaveFileName); - saveScript(path); - - m_output->moveCursor(QTextCursor::End); - QTextCursor cursor = m_output->textCursor(); - m_output->setTextCursor(cursor); - - QTextCharFormat format; - format.setFontWeight(QFont::Bold); - format.setFontUnderline(true); - - if (cursor.position() > 0) { - cursor.insertText("\n\n"); - } - - QDateTime dt = QDateTime::currentDateTime(); - cursor.insertText(i18n("Executing script at %1", KGlobal::locale()->formatDateTime(dt)), format); - - format.setFontWeight(QFont::Normal); - format.setFontUnderline(false); - QTextBlockFormat block = cursor.blockFormat(); - block.setLeftMargin(10); - cursor.insertBlock(block, format); - QElapsedTimer t; - t.start(); - - WorkspaceScripting::DesktopScriptEngine scriptEngine(m_corona, false, this); - connect(&scriptEngine, SIGNAL(print(QString)), this, SLOT(print(QString))); - connect(&scriptEngine, SIGNAL(printError(QString)), this, SLOT(print(QString))); - connect(&scriptEngine, SIGNAL(createPendingPanelViews()), PlasmaApp::self(), SLOT(createWaitingPanels())); - scriptEngine.evaluateScript(m_docEditor ? m_docEditor->text() : m_editor->toPlainText()); - - cursor.insertText("\n\n"); - format.setFontWeight(QFont::Bold); - // xgettext:no-c-format - cursor.insertText(i18n("Runtime: %1ms", QString::number(t.elapsed())), format); - block.setLeftMargin(0); - cursor.insertBlock(block); - m_output->ensureCursorVisible(); -} - -void InteractiveConsole::clearEditor() -{ - if (m_docEditor) { - m_docEditor->clear(); - } else { - m_editor->clear(); - } -} - -void InteractiveConsole::clearOutput() -{ - m_output->clear(); -} - -#include "moc_interactiveconsole.cpp" - diff --git a/plasma/shells/plasma-desktop/interactiveconsole.h b/plasma/shells/plasma-desktop/interactiveconsole.h deleted file mode 100644 index 3ef6ec33..00000000 --- a/plasma/shells/plasma-desktop/interactiveconsole.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 INTERACTIVECONSOLE -#define INTERACTIVECONSOLE - -#include -#include -#include -#include -#include - -class KAction; -class KFileDialog; -class KMenu; -class KTextEdit; - -namespace KTextEditor -{ - class Document; -} // namespace KParts - -namespace Plasma -{ - class Corona; -} // namespace Plasma - -class ScriptEngine; - -class InteractiveConsole : public KDialog -{ - Q_OBJECT - -public: - InteractiveConsole(Plasma::Corona *corona, QWidget *parent = 0); - ~InteractiveConsole(); - - void loadScript(const QString &path); - -protected: - void showEvent(QShowEvent *); - void closeEvent(QCloseEvent *event); - -protected Q_SLOTS: - void print(const QString &string); - void reject(); - -private Q_SLOTS: - void openScriptFile(); - void saveScript(); - void scriptTextChanged(); - void evaluateScript(); - void clearEditor(); - void clearOutput(); - void scriptFileDataRecvd(KIO::Job *job, const QByteArray &data); - void scriptFileDataReq(KIO::Job *job, QByteArray &data); - void reenableEditor(KJob *job); - void saveScriptUrlSelected(int result); - void openScriptUrlSelected(int result); - void loadScriptFromUrl(const KUrl &url); - -private: - void onClose(); - void saveScript(const KUrl &url); - - Plasma::Corona *m_corona; - QSplitter *m_splitter; - KTextEditor::Document *m_docEditor; - KTextEdit *m_editor; - QTextBrowser *m_output; - KAction *m_loadAction; - KAction *m_saveAction; - KAction *m_clearAction; - KAction *m_executeAction; - - KFileDialog *m_fileDialog; - QWeakPointer m_job; - bool m_closeWhenCompleted; -}; - -#endif - diff --git a/plasma/shells/plasma-desktop/plasmaapp.cpp b/plasma/shells/plasma-desktop/plasmaapp.cpp index 2a473516..06dc71b4 100644 --- a/plasma/shells/plasma-desktop/plasmaapp.cpp +++ b/plasma/shells/plasma-desktop/plasmaapp.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,6 @@ #include "controllerwindow.h" #include "desktopcorona.h" #include "desktopview.h" -#include "interactiveconsole.h" #include "panelshadows.h" #include "panelview.h" #include "toolbutton.h" @@ -78,14 +78,6 @@ static void addInformationForApplet(QTextStream &stream, Plasma::Applet *applet) stream << "Plugin Name: " << applet->pluginName() << '\n'; stream << "Category: " << applet->category() << '\n'; - - if (applet->package()) { - stream << "API: " << applet->package()->metadata().implementationApi() << '\n'; - stream << "Type: " << applet->package()->metadata().type() << '\n'; - stream << "Version: " << applet->package()->metadata().version() << '\n'; - stream << "Author: " << applet->package()->metadata().author() << '\n'; - } - // runtime info stream << "Failed To Launch: " << applet->hasFailedToLaunch() << '\n'; const QRect rect = applet->screenRect(); @@ -176,7 +168,6 @@ PlasmaApp::~PlasmaApp() m_panels.clear(); qDeleteAll(panels); - delete m_console.data(); delete m_corona; m_corona = 0; @@ -234,31 +225,6 @@ void PlasmaApp::syncConfig() KGlobal::config()->sync(); } -void PlasmaApp::showInteractiveConsole() -{ - if (KGlobal::config()->isImmutable()) { - return; - } - - InteractiveConsole *console = m_console.data(); - if (!console) { - m_console = console = new InteractiveConsole(m_corona); - } - - KWindowSystem::setOnDesktop(console->winId(), KWindowSystem::currentDesktop()); - console->show(); - console->raise(); - KWindowSystem::forceActiveWindow(console->winId()); -} - -void PlasmaApp::loadScriptInInteractiveConsole(const QString &script) -{ - showInteractiveConsole(); - if (m_console) { - m_console.data()->loadScript(script); - } -} - void PlasmaApp::panelHidden(bool hidden) { if (hidden) { diff --git a/plasma/shells/plasma-desktop/plasmaapp.h b/plasma/shells/plasma-desktop/plasmaapp.h index b8f6f9bc..934e8bab 100644 --- a/plasma/shells/plasma-desktop/plasmaapp.h +++ b/plasma/shells/plasma-desktop/plasmaapp.h @@ -48,7 +48,6 @@ namespace Plasma class ControllerWindow; class DesktopView; class DesktopCorona; -class InteractiveConsole; class PanelShadows; class PanelView; @@ -92,9 +91,6 @@ public: public Q_SLOTS: // DBUS interface. if you change these methods, you MUST run: // qdbuscpp2xml plasmaapp.h -o dbus/org.kde.plasma.App.xml - void showInteractiveConsole(); - void loadScriptInInteractiveConsole(const QString &script); - void createWaitingPanels(); void createWaitingDesktops(); void createView(Plasma::Containment *containment); @@ -143,7 +139,6 @@ private: QTimer m_panelViewCreationTimer; QTimer m_desktopViewCreationTimer; - QWeakPointer m_console; int m_panelHidden; QSignalMapper *m_mapper; QHash > m_widgetExplorers; diff --git a/plasma/shells/plasma-desktop/scripting/desktopscriptengine.cpp b/plasma/shells/plasma-desktop/scripting/desktopscriptengine.cpp deleted file mode 100644 index 443efb37..00000000 --- a/plasma/shells/plasma-desktop/scripting/desktopscriptengine.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "desktopscriptengine.h" - -#include -#include -#include - -#include -#include - -#include "panel.h" - -namespace WorkspaceScripting -{ - -DesktopScriptEngine::DesktopScriptEngine(Plasma::Corona *corona, bool startup, QObject *parent) - : ScriptEngine(corona, parent), - m_startup(startup) -{ -} - -QScriptValue DesktopScriptEngine::wrap(Plasma::Containment *c) -{ - Containment *wrapper = isPanel(c) ? new Panel(c) : new Containment(c); - return wrap(wrapper); -} - -QScriptValue DesktopScriptEngine::wrap(Containment *c) -{ - return ScriptEngine::wrap(c); -} - -int DesktopScriptEngine::defaultPanelScreen() const -{ - if (m_startup) { - return ScriptEngine::defaultPanelScreen(); - } - return QApplication::desktop()->screenNumber(QCursor::pos()); -} - -} - -#include "moc_desktopscriptengine.cpp" - diff --git a/plasma/shells/plasma-desktop/scripting/desktopscriptengine.h b/plasma/shells/plasma-desktop/scripting/desktopscriptengine.h deleted file mode 100644 index e574c088..00000000 --- a/plasma/shells/plasma-desktop/scripting/desktopscriptengine.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2010 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 DESKTOPSCRIPTENGINE -#define DESKTOPSCRIPTENGINE - -#include - -namespace WorkspaceScripting -{ - -class DesktopScriptEngine : public ScriptEngine -{ - Q_OBJECT - -public: - DesktopScriptEngine(Plasma::Corona *corona, bool isStartup = true, QObject *parent = 0); - QScriptValue wrap(Plasma::Containment *c); - QScriptValue wrap(Containment *c); - int defaultPanelScreen() const; - -private: - bool m_startup; -}; - -} - -#endif - diff --git a/plasma/shells/plasma-desktop/scripting/panel.cpp b/plasma/shells/plasma-desktop/scripting/panel.cpp deleted file mode 100644 index 492af203..00000000 --- a/plasma/shells/plasma-desktop/scripting/panel.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 "panel.h" - -#include - -#include -#include - -#include "panelview.h" -#include "plasmaapp.h" -#include -#include - -namespace WorkspaceScripting -{ - -Panel::Panel(Plasma::Containment *containment, QObject *parent) - : Containment(containment, parent) -{ -} - -Panel::~Panel() -{ -} - -QString Panel::location() const -{ - Plasma::Containment *c = containment(); - if (!c) { - return "floating"; - } - - switch (c->location()) { - case Plasma::Floating: - return "floating"; - break; - case Plasma::Desktop: - return "desktop"; - break; - case Plasma::FullScreen: - return "fullscreen"; - break; - case Plasma::TopEdge: - return "top"; - break; - case Plasma::BottomEdge: - return "bottom"; - break; - case Plasma::LeftEdge: - return "left"; - break; - case Plasma::RightEdge: - return "right"; - break; - } - - return "floating"; -} - -void Panel::setLocation(const QString &locationString) -{ - Plasma::Containment *c = containment(); - if (!c) { - return; - } - - const QString lower = locationString.toLower(); - Plasma::Location loc = Plasma::Floating; - if (lower == "desktop") { - loc = Plasma::Desktop; - } else if (lower == "fullscreen") { - loc = Plasma::FullScreen; - } else if (lower == "top") { - loc = Plasma::TopEdge; - } else if (lower == "bottom") { - loc = Plasma::BottomEdge; - } else if (lower == "left") { - loc = Plasma::LeftEdge; - } else if (lower == "right") { - loc = Plasma::RightEdge; - } - - c->setLocation(loc); - - c->flushPendingConstraintsEvents(); -} - -PanelView *Panel::panel() const -{ - Plasma::Containment *c = containment(); - if (!c) { - return 0; - } - - foreach (PanelView *v, PlasmaApp::self()->panelViews()) { - if (v->containment() == c) { - return v; - } - } - - return 0; -} - -QString Panel::alignment() const -{ - PanelView *v = panel(); - if (!v) { - return "left"; - } - - switch (v->alignment()) { - case Qt::AlignRight: - return "right"; - break; - case Qt::AlignCenter: - return "center"; - break; - default: - return "left"; - break; - } - - return "left"; -} - -void Panel::setAlignment(const QString &alignment) -{ - PanelView *v = panel(); - if (v) { - bool success = false; - - if (alignment.compare("left", Qt::CaseInsensitive) == 0) { - if (v->alignment() != Qt::AlignLeft) { - success = true; - v->setAlignment(Qt::AlignLeft); - } - } else if (alignment.compare("right", Qt::CaseInsensitive) == 0) { - if (v->alignment() != Qt::AlignRight) { - success = true; - v->setAlignment(Qt::AlignRight); - } - } else if (alignment.compare("center", Qt::CaseInsensitive) == 0) { - if (v->alignment() != Qt::AlignCenter) { - success = true; - v->setAlignment(Qt::AlignCenter); - } - } - - if (success) { - v->setOffset(0); - } - } -} - -int Panel::offset() const -{ - PanelView *v = panel(); - if (v) { - return v->offset(); - } - - return 0; -} - -void Panel::setOffset(int pixels) -{ - Plasma::Containment *c = containment(); - if (pixels < 0 || !c) { - return; - } - - PanelView *v = panel(); - if (v) { - QRectF screen = c->corona()->screenGeometry(v->screen()); - QSizeF size = c->size(); - - if (c->formFactor() == Plasma::Vertical) { - if (pixels > screen.height()) { - return; - } - - if (size.height() + pixels > screen.height()) { - c->resize(size.width(), screen.height() - pixels); - } - } else if (pixels > screen.width()) { - return; - } else if (size.width() + pixels > screen.width()) { - size.setWidth(screen.width() - pixels); - c->resize(size); - c->setMinimumSize(size); - c->setMaximumSize(size); - } - - v->setOffset(pixels); - } -} - -int Panel::length() const -{ - Plasma::Containment *c = containment(); - if (!c) { - return 0; - } - - if (c->formFactor() == Plasma::Vertical) { - return c->size().height(); - } else { - return c->size().width(); - } -} - -void Panel::setLength(int minPixels, int maxPixels) -{ - Plasma::Containment *c = containment(); - if ((minPixels < 0 && maxPixels < 0) || !c) { - return; - } - - PanelView *v = panel(); - if (v) { - if (minPixels < 0) { - minPixels = minLength(); - } else if (minPixels > maxPixels) { - maxPixels = minPixels; - } - - if (maxPixels < 0) { - maxPixels = maxLength(); - } else if (minPixels > maxPixels) { - minPixels = maxPixels; - } - - int pixels = 0; - if (minPixels == maxPixels) { - pixels = minPixels; - } else { - pixels = qBound(minPixels, - c->formFactor() == Plasma::Vertical ? - c->preferredSize().toSize().height() : - c->preferredSize().toSize().width(), - maxPixels); - } - - QRectF screen = c->corona()->screenGeometry(v->screen()); - QSizeF size = c->size(); - QSizeF minSize = c->minimumSize(); - QSizeF maxSize = c->maximumSize(); - if (c->formFactor() == Plasma::Vertical) { - if (minPixels > screen.height() - v->offset()) { - return; - } - - size.setHeight(pixels); - minSize.setHeight(minPixels); - maxSize.setHeight(maxPixels); - } else if (minPixels > screen.width() - v->offset()) { - return; - } else { - size.setWidth(pixels); - minSize.setWidth(minPixels); - maxSize.setWidth(maxPixels); - } - - //kDebug() << "sizes:" << minSize << size << maxSize; - c->setMinimumSize(0, 0); - c->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); - c->resize(size); - c->setMinimumSize(minSize); - c->setMaximumSize(maxSize); - v->pinchContainmentToCurrentScreen(); - } -} - -void Panel::setLength(int pixels) -{ - setLength(pixels, pixels); -} - -int Panel::minLength() const -{ - Plasma::Containment *c = containment(); - if (!c) { - return 0; - } - - if (c->formFactor() == Plasma::Vertical) { - return c->minimumHeight(); - } else { - return c->minimumWidth(); - } -} - -void Panel::setMinLength(int pixels) -{ - setLength(pixels, -1); -} - -int Panel::maxLength() const -{ - Plasma::Containment *c = containment(); - if (!c) { - return 0; - } - - if (c->formFactor() == Plasma::Vertical) { - return c->maximumHeight(); - } else { - return c->maximumWidth(); - } -} - -void Panel::setMaxLength(int pixels) -{ - setLength(-1, pixels); -} - -int Panel::height() const -{ - Plasma::Containment *c = containment(); - if (!c) { - return 0; - } - - return c->formFactor() == Plasma::Vertical ? c->size().width() - : c->size().height(); -} - -void Panel::setHeight(int height) -{ - Plasma::Containment *c = containment(); - if (height < 16 || !c) { - return; - } - - PanelView *v = panel(); - if (v) { - QRect screen = c->corona()->screenGeometry(v->screen()); - QSizeF size = c->size(); - const int max = (c->formFactor() == Plasma::Vertical ? screen.width() : screen.height()) / 3; - height = qBound(16, height, max); - - if (c->formFactor() == Plasma::Vertical) { - size.setWidth(height); - } else { - size.setHeight(height); - } - - c->resize(size); - c->setMinimumSize(size); - c->setMaximumSize(size); - } -} - -QString Panel::hiding() const -{ - PanelView *v = panel(); - if (v) { - switch (v->visibilityMode()) { - case PanelView::NormalPanel: - return "none"; - break; - case PanelView::AutoHide: - return "autohide"; - break; - case PanelView::LetWindowsCover: - return "windowscover"; - break; - case PanelView::WindowsGoBelow: - return "windowsbelow"; - break; - } - } - - return "none"; -} - -void Panel::setHiding(const QString &mode) -{ - PanelView *v = panel(); - if (v) { - if (mode.compare("autohide", Qt::CaseInsensitive) == 0) { - v->setVisibilityMode(PanelView::AutoHide); - } else if (mode.compare("windowscover", Qt::CaseInsensitive) == 0) { - v->setVisibilityMode(PanelView::LetWindowsCover); - } else if (mode.compare("windowsbelow", Qt::CaseInsensitive) == 0) { - v->setVisibilityMode(PanelView::WindowsGoBelow); - } else { - v->setVisibilityMode(PanelView::NormalPanel); - } - } -} - -} - -#include "moc_panel.cpp" - diff --git a/plasma/shells/plasma-desktop/scripting/panel.h b/plasma/shells/plasma-desktop/scripting/panel.h deleted file mode 100644 index d67d4578..00000000 --- a/plasma/shells/plasma-desktop/scripting/panel.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2009 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 PANEL -#define PANEL - -#include - -#include - -class PanelView; - -namespace WorkspaceScripting -{ - -class Panel : public Containment -{ - Q_OBJECT - Q_PROPERTY(QStringList configKeys READ configKeys) - Q_PROPERTY(QStringList configGroups READ configGroups) - Q_PROPERTY(QStringList currentConfigGroup WRITE setCurrentConfigGroup READ currentConfigGroup) - - Q_PROPERTY(QString version READ version) - Q_PROPERTY(QString type READ type) - Q_PROPERTY(QString formFactor READ formFactor) - Q_PROPERTY(QList widgetIds READ widgetIds) - Q_PROPERTY(int screen READ screen WRITE setScreen) - Q_PROPERTY(int desktop READ desktop WRITE setDesktop) - Q_PROPERTY(QString location READ location WRITE setLocation) - Q_PROPERTY(int id READ id) - - // panel properties - Q_PROPERTY(QString alignment READ alignment WRITE setAlignment) - Q_PROPERTY(int offset READ offset WRITE setOffset) - Q_PROPERTY(int minLength READ minLength WRITE setMinLength) - Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) - Q_PROPERTY(int length READ length WRITE setLength) - Q_PROPERTY(int height READ height WRITE setHeight) - Q_PROPERTY(QString hiding READ hiding WRITE setHiding) - -public: - Panel(Plasma::Containment *containment, QObject *parent = 0); - ~Panel(); - - QString location() const; - void setLocation(const QString &location); - - QString alignment() const; - void setAlignment(const QString &alignment); - - int offset() const; - void setOffset(int pixels); - - int minLength() const; - void setMinLength(int pixels); - - int maxLength() const; - void setMaxLength(int pixels); - - int length() const; - void setLength(int pixels); - - int height() const; - void setHeight(int height); - - QString hiding() const; - void setHiding(const QString &mode); - -public Q_SLOTS: - void remove() { Containment::remove(); } - void showConfigurationInterface() { Containment::showConfigurationInterface(); } - - // from the applet interface - QVariant readConfig(const QString &key, const QVariant &def = QString()) const { return Applet::readConfig(key, def); } - void writeConfig(const QString &key, const QVariant &value) { Applet::writeConfig(key, value); } - void reloadConfig() { Applet::reloadConfig(); } - -private: - void setLength(int minPixels, int maxPixels); - PanelView *panel() const; -}; - -} - -#endif - diff --git a/plasma/shells/plasma-windowed/singleview.cpp b/plasma/shells/plasma-windowed/singleview.cpp index afc340a6..6e9a983b 100644 --- a/plasma/shells/plasma-windowed/singleview.cpp +++ b/plasma/shells/plasma-windowed/singleview.cpp @@ -21,14 +21,11 @@ #include #include -#include #include #include #include #include - - #include #include #include @@ -42,21 +39,10 @@ SingleView::SingleView(Plasma::Corona *corona, Plasma::Containment *containment, m_corona(corona) { setScene(m_corona); - QFileInfo info(pluginName); - if (!info.isAbsolute()) { - info = QFileInfo(QDir::currentPath() + '/' + pluginName); - } - - if (info.exists()) { - m_applet = Plasma::Applet::loadPlasmoid(info.absoluteFilePath(), appletId, appletArgs); - } + m_applet = Plasma::Applet::load(pluginName, appletId, appletArgs); if (!m_applet) { - m_applet = Plasma::Applet::load(pluginName, appletId, appletArgs); - } - - if (!m_applet) { - kDebug() << "failed to load" << pluginName; + kWarning() << "failed to load" << pluginName; return; } diff --git a/statusnotifierwatcher/CMakeLists.txt b/statusnotifierwatcher/CMakeLists.txt deleted file mode 100644 index d3920dbe..00000000 --- a/statusnotifierwatcher/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -project(StatusNotifierWatcher) - -set(kded_statusnotifierwatcher_SRCS statusnotifierwatcher.cpp ) - -QT4_ADD_DBUS_ADAPTOR(kded_statusnotifierwatcher_SRCS ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.StatusNotifierWatcher.xml - statusnotifierwatcher.h StatusNotifierWatcher) - - -set(statusnotifieritem_xml ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.StatusNotifierItem.xml) -set_source_files_properties(${statusnotifieritem_xml} PROPERTIES - NO_NAMESPACE false - INCLUDE "systemtraytypedefs.h" - CLASSNAME OrgKdeStatusNotifierItemInterface -) -QT4_ADD_DBUS_INTERFACE(kded_statusnotifierwatcher_SRCS ${statusnotifieritem_xml} statusnotifieritem_interface) - -kde4_add_plugin(kded_statusnotifierwatcher ${kded_statusnotifierwatcher_SRCS}) - - -target_link_libraries(kded_statusnotifierwatcher KDE4::kio ) - -install(TARGETS kded_statusnotifierwatcher DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) - - -install( FILES statusnotifierwatcher.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded) - diff --git a/statusnotifierwatcher/statusnotifierwatcher.cpp b/statusnotifierwatcher/statusnotifierwatcher.cpp deleted file mode 100644 index 33cb7658..00000000 --- a/statusnotifierwatcher/statusnotifierwatcher.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/*************************************************************************** - * Copyright 2009 by Marco Martin * - * * - * 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 "statusnotifierwatcher.h" -#include "statusnotifierwatcheradaptor.h" -#include "statusnotifieritem_interface.h" - -#include -#include - -#include -#include -#include -#include -#include -#include - -static inline KAboutData aboutData() -{ - return KAboutData("statusnotifierwatcher", 0, ki18n("statusnotifierwatcher"), KDE_VERSION_STRING); -} - -K_PLUGIN_FACTORY(StatusNotifierWatcherFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(StatusNotifierWatcherFactory(aboutData())) - -StatusNotifierWatcher::StatusNotifierWatcher(QObject *parent, const QList&) - : KDEDModule(parent) -{ - setModuleName("StatusNotifierWatcher"); - new StatusNotifierWatcherAdaptor(this); - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerService("org.kde.StatusNotifierWatcher"); - dbus.registerObject("/StatusNotifierWatcher", this); - - m_serviceWatcher = new QDBusServiceWatcher(this); - m_serviceWatcher->setConnection(dbus); - m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); - - connect(m_serviceWatcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(serviceUnregistered(QString))); -} - -StatusNotifierWatcher::~StatusNotifierWatcher() -{ - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.unregisterService("org.kde.StatusNotifierWatcher"); -} - - -void StatusNotifierWatcher::RegisterStatusNotifierItem(const QString &serviceOrPath) -{ - QString service; - QString path; - if (serviceOrPath.startsWith('/')) { - service = message().service(); - path = serviceOrPath; - } else { - service = serviceOrPath; - path = "/StatusNotifierItem"; - } - QString notifierItemId = service + path; - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() && - !m_registeredServices.contains(notifierItemId)) { - kDebug()<<"Registering" << notifierItemId << "to system tray"; - - //check if the service has registered a SystemTray object - org::kde::StatusNotifierItem trayclient(service, path, - QDBusConnection::sessionBus()); - if (trayclient.isValid()) { - m_registeredServices.append(notifierItemId); - m_serviceWatcher->addWatchedService(service); - emit StatusNotifierItemRegistered(notifierItemId); - } - } -} - -QStringList StatusNotifierWatcher::RegisteredStatusNotifierItems() const -{ - return m_registeredServices; -} - - -void StatusNotifierWatcher::serviceUnregistered(const QString& name) -{ - kDebug()<<"Service "<< name << "unregistered"; - m_serviceWatcher->removeWatchedService(name); - - QString match = name + '/'; - QStringList::Iterator it = m_registeredServices.begin(); - while (it != m_registeredServices.end()) { - if (it->startsWith(match)) { - QString name = *it; - it = m_registeredServices.erase(it); - emit StatusNotifierItemUnregistered(name); - } else { - ++it; - } - } - - if (m_statusNotifierHostServices.contains(name)) { - m_statusNotifierHostServices.remove(name); - emit StatusNotifierHostUnregistered(); - } -} - -void StatusNotifierWatcher::RegisterStatusNotifierHost(const QString &service) -{ - if (service.contains("org.kde.StatusNotifierHost-") && - QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() && - !m_statusNotifierHostServices.contains(service)) { - kDebug()<<"Registering"<addWatchedService(service); - emit StatusNotifierHostRegistered(); - } -} - -bool StatusNotifierWatcher::IsStatusNotifierHostRegistered() const -{ - return !m_statusNotifierHostServices.isEmpty(); -} - -int StatusNotifierWatcher::ProtocolVersion() const -{ - return 0; -} - -#include "moc_statusnotifierwatcher.cpp" diff --git a/statusnotifierwatcher/statusnotifierwatcher.desktop b/statusnotifierwatcher/statusnotifierwatcher.desktop deleted file mode 100644 index c682c5af..00000000 --- a/statusnotifierwatcher/statusnotifierwatcher.desktop +++ /dev/null @@ -1,128 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Status Notifier Manager -Name[ar]=مدير تنبيهات الحالة -Name[ast]=Xestor del notificador del estáu -Name[bn]=স্ট্যাটাস বিজ্ঞপ্তি ম্যানেজার -Name[bs]=Menadžer izveštavača o stanju -Name[ca]=Gestor del notificador d'estat -Name[ca@valencia]=Gestor del notificador d'estat -Name[cs]=Správce oznamování stavu -Name[da]=Håndtering af statusbekendtgørelser -Name[de]=Statusbenachrichtigungs-Verwaltung -Name[el]=Διαχειριστής των ειδοποιήσεων κατάστασης -Name[en_GB]=Status Notifier Manager -Name[es]=Gestor del notificador del estado -Name[et]=Oleku märguannete haldur -Name[eu]=Egoera-jakinarazlearen kudeatzailea -Name[fi]=Tilailmoittimen hallinta -Name[fr]=Gestionnaire du notificateur d'état -Name[gl]=Xestor das notificacións de estado -Name[he]=מנהל שירותי הודעות מצב -Name[hi]=स्थिति संकेत प्रबंधक -Name[hr]=Upravitelj glasnika stanja -Name[hu]=Állapotértesítés-kezelő -Name[ia]=Gerente de notificator de stato -Name[id]=Manajer Notifikasi Status -Name[is]=Stöðutilkynningaþjónn -Name[it]=Gestore del notificatore di stato -Name[ja]=ステータス通知マネージャ -Name[kk]=Күй-жайы туралы құлақтандырғыш менеджері -Name[km]=កម្មវិធី​គ្រប់គ្រង​ធាតុជូន​ដំណឹង​អំពី​ស្ថានភាព -Name[kn]= ಸ್ಥಿತಿ ಸೂಚನಾ ವ್ಯವಸ್ಥಾಪಕ -Name[ko]=상태 알림 관리자 -Name[lt]=Būsenos pranešimų valdymas -Name[lv]=Statusa paziņojumu pārvaldītājs -Name[mr]=स्थिती निदर्शक व्यवस्थापक -Name[nb]=Håndtering av statusvarsler -Name[nds]=Statusbescheed-Beluern -Name[nl]=Statusmeldingenbeheerder -Name[pa]=ਹਾਲਤ ਨੋਟੀਫਾਇਰ ਮੈਨੇਜਰ -Name[pl]=Zarządzanie powiadomieniami o stanie -Name[pt]=Gestor das Notificações de Estado -Name[pt_BR]=Gerenciador de notificações de status -Name[ro]=Gestionar notificator de stare -Name[ru]=Диспетчер уведомлений о состоянии -Name[si]=තත්ව දැන්වීමේ කළමනාකරු -Name[sk]=Správca oznámení stavu -Name[sl]=Upravljalnik obvestilnika o stanju -Name[sr]=Менаџер извештавача о стању -Name[sr@ijekavian]=Менаџер извјештавача о стању -Name[sr@ijekavianlatin]=Menadžer izvještavača o stanju -Name[sr@latin]=Menadžer izveštavača o stanju -Name[sv]=Hantering av statusunderrättelser -Name[tg]=Мудири ҳолатҳои система -Name[th]=ตัวจัดการการแจ้งสถานะให้ทราบ -Name[tr]=Durum Bildirim Yöneticisi -Name[ug]=ھالەت بىلدۈرگۈ باشقۇرغۇچ -Name[uk]=Керування сповіщенням про стан -Name[wa]=Manaedjeu do notifiaedje d' estat -Name[x-test]=xxStatus Notifier Managerxx -Name[zh_CN]=状态通知管理器 -Name[zh_TW]=狀態通知管理員 -Comment=Manages services that provide status notifier user interfaces -Comment[ar]=أدر الخدمات التي توفر واجهات المستخدم لمنبّهات الحالة -Comment[ast]=Xestiona servicios qu'ufren interfaces d'usuariu pal notificador d'estáu -Comment[bs]=Upravljanje servisima koji pružaju sučelje izveštavača o stanju -Comment[ca]=Gestiona serveis que proporcionen notificacions d'estat a les interfícies d'usuari -Comment[ca@valencia]=Gestiona serveis que proporcionen notificacions d'estat a les interfícies d'usuari -Comment[cs]=Nastavení služeb poskytujících rozhraní pro oznamování stavu -Comment[da]=Håndterer tjenester der giver brugerflader til statusbekendtgørelser -Comment[de]=Verwaltet Dienste, die eine Schnittstelle für Status-Informationen bereitstellen -Comment[el]=Διαχειρίζεται υπηρεσίες που παρέχουν περιβάλλοντα χρήστη για τις ειδοποιήσεις κατάστασης -Comment[en_GB]=Manages services that provide status notifier user interfaces -Comment[es]=Gestiona servicios que proporcionan interfaces de usuario para el notificador de estado -Comment[et]=Teenuste haldamine, mis pakuvad olekumärguannete kasutajaliidest -Comment[eu]=Egora-jakinarazlerako erabiltzaile-interfazeak hornitzen dituen zerbitzuak kudeatzen ditu -Comment[fi]=Hallitsee palveluja, jotka tarjoavat tilailmoitinkäyttöliittymät -Comment[fr]=Gère les services fournissant des interfaces utilisateurs pour la notification d'état -Comment[gl]=Xestiona servizos que fornecen interfaces de usuario para o notificador de estado -Comment[he]=ניהול שירותים המספקים ממשקי משתמש להודעות מצב -Comment[hr]=Upravlja uslugama koje omogućuju obavještavanje o stanju korisničkog sučelja -Comment[hu]=Kezeli az állapotértesítést nyújtó szolgáltatásokat -Comment[ia]=Il gere servicios que forni interfacies de usator pro notificator de stato -Comment[id]=Atur layanan yang menyediakan notifikasi status antarmuka pengguna -Comment[is]=Stjórnar þjónustum sem sjá um stöðutilkynningar notendaviðmóta -Comment[it]=Gestisce i servizi che forniscono interfacce utente al notificatore di stato -Comment[ja]=ステータス通知ユーザインターフェースを提供するサービスを管理 -Comment[kk]=Күй-жайы туралы құлақтандыру интерфейсін қамтамасыз ететін қызметін басқару -Comment[km]=គ្រប់គ្រង​សារ​ដែល​ផ្ដល់​កម្មវិធី​​ជូនដំណឹង​អំពី​ស្ថានភាព​ចំណុច​ប្រទាក់​អ្នកប្រើ -Comment[kn]=ಸ್ಥಿತಿಯನ್ನು ಸೂಚಿಸುವ ಬಳಕೆದಾರ ಸಂಪರ್ಕಸಾಧನಗಳನ್ನು ಒದಗಿಸುವ ಸೇವೆಗಳನ್ನು ನಿರ್ವಹಿಸುತ್ತದೆ -Comment[ko]=상태 알림 인터페이스를 제공하는 서비스를 관리합니다 -Comment[lt]=Valdo tarnybas, teikiančias būsenos pranešimų naudotojo sąsajas -Comment[lv]=Pārvalda servisus, kas sniedz statusa paziņojumu lietotāja saskarni -Comment[mr]=स्थितीबाबत सूचना दैणाऱ्या सेवांचे व्यवस्थापन करतो -Comment[nb]=Håndterer tjenester som tilbyr brukerflater for statusvarsler -Comment[nds]=Deensten plegen, de Statusbescheed-Brukerkoppelsteden praatstellt -Comment[nl]=Beheert services die statusmeldingen leveren aan gebruikersinterfaces -Comment[pa]=ਸਰਵਿਸਾਂ ਦਾ ਪਰਬੰਧ ਕਰਦਾ ਹੈ, ਜੋ ਕਿ ਹਾਲਤ ਨੋਟੀਫਾਇਰ ਯੂਜ਼ਰ ਇੰਟਰਫੇਸ ਦਿੰਦਾ ਹੈ -Comment[pl]=Zarządza usługami, które udostępniają interfejs użytkownika powiadomień o stanie -Comment[pt]=Faz a gestão dos serviços que fornecem interface de notificação do estado -Comment[pt_BR]=Gerencia os serviços que fornecem interfaces de notificação do status -Comment[ro]=Administrează serviciile care furnizează interfețe utilizator pentru notificări de stare -Comment[ru]=Управление службами интерфейсов уведомлений о состоянии -Comment[si]=පරිශීලක අතුරු මුහුණත් වලට තත්ව දැනුම් දීම් සපයන සේවා කළමනාකරනය කරයි -Comment[sk]=Spravuje služby, ktoré poskytujú užívateľské rozhrania pre oznámenie stavu -Comment[sl]=Upravlja s storitvami, ki ponujajo uporabniške vmesnike obvestilnika o stanju -Comment[sr]=Управљање сервисима који пружају сучеље извештавача о стању -Comment[sr@ijekavian]=Управљање сервисима који пружају сучеље извјештавача о стању -Comment[sr@ijekavianlatin]=Upravljanje servisima koji pružaju sučelje izvještavača o stanju -Comment[sr@latin]=Upravljanje servisima koji pružaju sučelje izveštavača o stanju -Comment[sv]=Hanterar tjänster som tillhandahåller användargränssnitt för statusunderrättelser -Comment[th]=จัดการบริการต่าง ๆ ที่แจ้งสถานะมาให้ผู้ใช้รับทราบ -Comment[tr]=Durum bildirimi kullanıcı arayüzünü sunan servisleri yönetir -Comment[ug]=ھالەت بىلدۈرگۈ ئىشلەتكۈچى ئارايۈزىنى تەمىنلەشنى باشقۇرۇش مۇلازىمىتى -Comment[uk]=Керує службами інтерфейсів користувача для сповіщення про стан -Comment[vi]=Quản lý các dịch vụ cung cấp thông báo trạng thái -Comment[wa]=Manaedje les siervices ki dnèt ls eterfaces uzeu d' notifiaedje di l' estat -Comment[x-test]=xxManages services that provide status notifier user interfacesxx -Comment[zh_CN]=状态通知协议的管理服务 -Comment[zh_TW]=管理提供狀態通知使用者介面的服務 - -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=statusnotifierwatcher -X-KDE-DBus-ModuleName=statusnotifierwatcher -X-KDE-Kded-autoload=true -X-KDE-Kded-load-on-demand=false -X-KDE-Kded-phase=1 -OnlyShowIn=KDE; diff --git a/statusnotifierwatcher/statusnotifierwatcher.h b/statusnotifierwatcher/statusnotifierwatcher.h deleted file mode 100644 index 610915f2..00000000 --- a/statusnotifierwatcher/statusnotifierwatcher.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * Copyright 2009 by Marco Martin * - * * - * 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 STATUSNOTIFIERWATCHER_H -#define STATUSNOTIFIERWATCHER_H - -#include - -#include -#include -#include -#include - -#include - -class StatusNotifierWatcher : public KDEDModule, protected QDBusContext -{ - Q_OBJECT - Q_PROPERTY(QStringList RegisteredStatusNotifierItems READ RegisteredStatusNotifierItems) - Q_PROPERTY(bool IsStatusNotifierHostRegistered READ IsStatusNotifierHostRegistered) - Q_PROPERTY(int ProtocolVersion READ ProtocolVersion) - -public: - StatusNotifierWatcher(QObject *parent, const QList&); - ~StatusNotifierWatcher(); - - QStringList RegisteredStatusNotifierItems() const; - - bool IsStatusNotifierHostRegistered() const; - - int ProtocolVersion() const; - -public Q_SLOTS: - void RegisterStatusNotifierItem(const QString &service); - - void RegisterStatusNotifierHost(const QString &service); - -protected Q_SLOTS: - void serviceUnregistered(const QString& name); - -Q_SIGNALS: - void StatusNotifierItemRegistered(const QString &service); - //TODO: decide if this makes sense, the systray itself could notice the vanishing of items, but looks complete putting it here - void StatusNotifierItemUnregistered(const QString &service); - void StatusNotifierHostRegistered(); - void StatusNotifierHostUnregistered(); - -private: - QDBusServiceWatcher *m_serviceWatcher; - QStringList m_registeredServices; - QSet m_statusNotifierHostServices; -}; -#endif diff --git a/statusnotifierwatcher/systemtraytypedefs.h b/statusnotifierwatcher/systemtraytypedefs.h deleted file mode 100644 index 20e63044..00000000 --- a/statusnotifierwatcher/systemtraytypedefs.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * * - * Copyright (C) 2009 Marco Martin * - * * - * 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 SYSTEMTRAYTYPEDEFS_H -#define SYSTEMTRAYTYPEDEFS_H - -#include -#include -#include - -struct KDbusImageStruct { - int width; - int height; - QByteArray data; -}; - -typedef QVector KDbusImageVector; - -struct KDbusToolTipStruct { - QString icon; - KDbusImageVector image; - QString title; - QString subTitle; -}; - -Q_DECLARE_METATYPE(KDbusImageStruct) -Q_DECLARE_METATYPE(KDbusImageVector) -Q_DECLARE_METATYPE(KDbusToolTipStruct) - -#endif - diff --git a/systemsettings/app/kdesystemsettings.desktop b/systemsettings/app/kdesystemsettings.desktop index e4b6b69d..80bf9452 100755 --- a/systemsettings/app/kdesystemsettings.desktop +++ b/systemsettings/app/kdesystemsettings.desktop @@ -6,7 +6,6 @@ StartupNotify=true Implements=org.kde.systemsettings SingleMainWindow=true NotShowIn=KDE; -X-KDE-HasTrayOption=true GenericName=KDE System Settings GenericName[ar]=إعدادات نظام كدي diff --git a/systemsettings/app/systemsettings.desktop b/systemsettings/app/systemsettings.desktop index 300bca47..d6c6c9fe 100755 --- a/systemsettings/app/systemsettings.desktop +++ b/systemsettings/app/systemsettings.desktop @@ -7,7 +7,6 @@ StartupNotify=true Implements=org.kde.systemsettings SingleMainWindow=true OnlyShowIn=KDE; -X-KDE-HasTrayOption=true GenericName=System Settings GenericName[ar]=إعدادات النظام