From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kicker/extensions/taskbar/Makefile.am | 23 ++ kicker/extensions/taskbar/taskbarextension.cpp | 235 +++++++++++++++++++++ kicker/extensions/taskbar/taskbarextension.desktop | 147 +++++++++++++ kicker/extensions/taskbar/taskbarextension.h | 72 +++++++ 4 files changed, 477 insertions(+) create mode 100644 kicker/extensions/taskbar/Makefile.am create mode 100644 kicker/extensions/taskbar/taskbarextension.cpp create mode 100644 kicker/extensions/taskbar/taskbarextension.desktop create mode 100644 kicker/extensions/taskbar/taskbarextension.h (limited to 'kicker/extensions/taskbar') diff --git a/kicker/extensions/taskbar/Makefile.am b/kicker/extensions/taskbar/Makefile.am new file mode 100644 index 000000000..4dfa1b929 --- /dev/null +++ b/kicker/extensions/taskbar/Makefile.am @@ -0,0 +1,23 @@ +INCLUDES = -I$(srcdir)/../../taskmanager -I$(srcdir)/../../taskbar -I$(srcdir)/../../libkicker -I$(top_builddir)/kicker/libkicker $(all_includes) + +kde_module_LTLIBRARIES = taskbar_panelextension.la + +taskbar_panelextension_la_SOURCES = taskbarextension.cpp taskbarextension.skel +taskbar_panelextension_la_METASOURCES = AUTO +taskbar_panelextension_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +taskbar_panelextension_la_LIBADD = $(LIB_KDEUI) $(LIB_KPARTS) \ + ../../libkicker/libkickermain.la \ + ../../taskmanager/libtaskmanager.la \ + ../../taskbar/libtaskbar.la + +noinst_HEADERS = taskbarextension.h + +lnkdir = $(kde_datadir)/kicker/extensions +lnk_DATA = taskbarextension.desktop + +EXTRA_DIST = $(lnk_DATA) + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/taskbarextension.pot + +taskbarextension.lo: ../../libkicker/kickerSettings.h diff --git a/kicker/extensions/taskbar/taskbarextension.cpp b/kicker/extensions/taskbar/taskbarextension.cpp new file mode 100644 index 000000000..a25297b39 --- /dev/null +++ b/kicker/extensions/taskbar/taskbarextension.cpp @@ -0,0 +1,235 @@ +/***************************************************************** + +Copyright (c) 2001 Matthias Elter + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "global.h" +#include "kickerSettings.h" +#include "taskbarcontainer.h" + +#include "taskbarextension.h" +#include "taskbarextension.moc" + +extern "C" +{ + KDE_EXPORT KPanelExtension* init( QWidget *parent, const QString& configFile ) + { + KGlobal::locale()->insertCatalogue( "taskbarextension" ); + return new TaskBarExtension( configFile, KPanelExtension::Stretch, + KPanelExtension::Preferences, parent, "taskbarextension" ); + } +} + +TaskBarExtension::TaskBarExtension(const QString& configFile, Type type, + int actions, QWidget *parent, const char *name) + : KPanelExtension(configFile, type, actions, parent, name), + m_bgImage(0), + m_bgFilename(0), + m_rootPixmap(0) +{ + QHBoxLayout *layout = new QHBoxLayout(this); + m_container = new TaskBarContainer(false, this); + m_container->setBackgroundOrigin(AncestorOrigin); + positionChange(position()); + layout->addWidget(m_container); + + connect(m_container, SIGNAL(containerCountChanged()), + SIGNAL(updateLayout())); + + kapp->dcopClient()->setNotifications(true); + connectDCOPSignal("kicker", "kicker", "configurationChanged()", + "configure()", false); + + connect(kapp, SIGNAL(kdisplayPaletteChanged()), + SLOT(setBackgroundTheme())); + + QTimer::singleShot(0, this, SLOT(setBackgroundTheme())); +} + +TaskBarExtension::~TaskBarExtension() +{ + KGlobal::locale()->removeCatalogue( "taskbarextension" ); +} + +void TaskBarExtension::positionChange( Position p ) +{ + + m_container->orientationChange(orientation()); + + switch (p) + { + case Bottom: + m_container->popupDirectionChange(KPanelApplet::Up); + break; + case Top: + m_container->popupDirectionChange(KPanelApplet::Down); + break; + case Right: + m_container->popupDirectionChange(KPanelApplet::Left); + break; + case Left: + m_container->popupDirectionChange(KPanelApplet::Right); + break; + case Floating: + if (orientation() == Horizontal) + { + m_container->popupDirectionChange(KPanelApplet::Down); + } + else if (QApplication::reverseLayout()) + { + m_container->popupDirectionChange(KPanelApplet::Left); + } + else + { + m_container->popupDirectionChange(KPanelApplet::Right); + } + break; + } + setBackgroundTheme(); +} + +void TaskBarExtension::preferences() +{ + m_container->preferences(); +} + +QSize TaskBarExtension::sizeHint(Position p, QSize maxSize) const +{ + if (p == Left || p == Right) + maxSize.setWidth(sizeInPixels()); + else + maxSize.setHeight(sizeInPixels()); + +// kdDebug(1210) << "TaskBarExtension::sizeHint( Position, QSize )" << endl; +// kdDebug(1210) << " width: " << size.width() << endl; +// kdDebug(1210) << "height: " << size.height() << endl; + return m_container->sizeHint(p, maxSize); +} + +void TaskBarExtension::configure() +{ + setBackgroundTheme(); + update(); +} + +void TaskBarExtension::setBackgroundTheme() +{ + if (KickerSettings::transparent()) + { + if (!m_rootPixmap) + { + m_rootPixmap = new KRootPixmap(this); + m_rootPixmap->setCustomPainting(true); + connect(m_rootPixmap, SIGNAL(backgroundUpdated(const QPixmap&)), + SLOT(updateBackground(const QPixmap&))); + } + else + { + m_rootPixmap->repaint(true); + } + + double tint = double(KickerSettings::tintValue()) / 100; + m_rootPixmap->setFadeEffect(tint, KickerSettings::tintColor()); + m_rootPixmap->start(); + return; + } + else if (m_rootPixmap) + { + delete m_rootPixmap; + m_rootPixmap = 0; + } + + unsetPalette(); + + if (KickerSettings::useBackgroundTheme()) + { + QString bgFilename = locate("appdata", KickerSettings::backgroundTheme()); + + if (m_bgFilename != bgFilename) + { + m_bgFilename = bgFilename; + m_bgImage.load(m_bgFilename); + } + + if (!m_bgImage.isNull()) + { + QImage bgImage = m_bgImage; + + if (orientation() == Vertical) + { + if (KickerSettings::rotateBackground()) + { + QWMatrix matrix; + matrix.rotate(position() == KPanelExtension::Left ? 90: 270); + bgImage = bgImage.xForm(matrix); + } + + bgImage = bgImage.scaleWidth(size().width()); + } + else + { + if (position() == KPanelExtension::Top && + KickerSettings::rotateBackground()) + { + QWMatrix matrix; + matrix.rotate(180); + bgImage = bgImage.xForm(matrix); + } + + bgImage = bgImage.scaleHeight(size().height()); + } + + if (KickerSettings::colorizeBackground()) + { + KickerLib::colorize(bgImage); + } + setPaletteBackgroundPixmap(bgImage); + } + } + + m_container->setBackground(); +} + +void TaskBarExtension::updateBackground(const QPixmap& bgImage) +{ + unsetPalette(); + setPaletteBackgroundPixmap(bgImage); + m_container->setBackground(); +} + +void TaskBarExtension::resizeEvent(QResizeEvent *e) +{ + QFrame::resizeEvent(e); + setBackgroundTheme(); +} + diff --git a/kicker/extensions/taskbar/taskbarextension.desktop b/kicker/extensions/taskbar/taskbarextension.desktop new file mode 100644 index 000000000..691e3fe0e --- /dev/null +++ b/kicker/extensions/taskbar/taskbarextension.desktop @@ -0,0 +1,147 @@ +[Desktop Entry] +Name=External Taskbar +Name[af]=Eksterne Taakbalk +Name[ar]=شريط المهام الخارجي +Name[az]=Xarici Vəzifə Çubuğu +Name[be]=Вонкавая панэль заданняў +Name[bg]=Допълнителна лента +Name[bn]=বহিঃস্থ টাস্কবার +Name[br]=Barrenn dleadoù diavaez +Name[bs]=Eksterni taskbar +Name[ca]=Barra de tasques externa +Name[cs]=Externí pruh úloh +Name[csb]=Bùtnowô lëstew dzejaniów +Name[cy]=Bar tasgau allanol +Name[da]=Ekstern opgavelinje +Name[de]=Externe Fensterleiste +Name[el]=Εξωτερική γραμμή εργασιών +Name[eo]=Ekstera Taskostrio +Name[es]=Barra de tareas externa +Name[et]=Väline tegumiriba +Name[eu]=Kanpoko ataza-barra +Name[fa]=میله‌ تکلیف خارجی +Name[fi]=Ulkoinen ohjelmapalkki +Name[fr]=Barre des tâches externe +Name[fy]=Eksterne taakbalke +Name[ga]=Tascbharra Seachtrach +Name[gl]=Barra de Tarefas Externa +Name[he]=שורת משימות חיצונית +Name[hi]=बाहरी कार्यपट्टी +Name[hr]=Vanjska traka zadataka +Name[hu]=Külső feladatlista +Name[id]=Taskbar eksternal +Name[is]=Utanáliggjandi verkefnaslá +Name[it]=Barra delle applicazioni esterna +Name[ja]=外部タスクバー +Name[ka]=გაფართოვებული ამოცანათა პანელი +Name[kk]=Сыртқы тапсырмалар панелі +Name[km]=របារ​ភារកិច្ច​ខាង​ក្រៅ +Name[lo]=ຖາດງານພາຍນອກ +Name[lt]=Išorinė užduočių juosta +Name[lv]=Ārējā Uzdevumjosla +Name[mk]=Надворешна лента со програми +Name[mn]=Гадаад ажлын самбар +Name[ms]=Taskbar Luaran +Name[mt]=Taskbar Estern +Name[nb]=Ekstern oppgavelinje +Name[nds]=Extern Programmbalken +Name[ne]=बाह्य कार्यपट्टी +Name[nl]=Externe taakbalk +Name[nn]=Ekstern oppgåvelinje +Name[nso]=Bar ya Mosongwana wa Kantle +Name[pa]=ਬਾਹਰੀ ਕੰਮ-ਪੱਟੀ +Name[pl]=Zewnętrzny pasek zadań +Name[pt]=Barra de Tarefas Externa +Name[pt_BR]=Barra de Tarefas Externa +Name[ro]=Bară de procese externă +Name[ru]=Внешняя панель задач +Name[rw]=Umurongoibikorwa w'Inyuma +Name[se]=Olgguldas bargoholga +Name[sk]=Externý taskbar +Name[sl]=Zunanja opravilna vrstica +Name[sr]=Спољашња трака задатака +Name[sr@Latn]=Spoljašnja traka zadataka +Name[sv]=Externt aktivitetsfält +Name[ta]=புற பணிப்பட்டி +Name[tg]=Сафҳаи масъалаҳои васеъ +Name[th]=ถาดงานภายนอก +Name[tr]=Harici Görev Çubuğu +Name[tt]=Tışqı Eşlärtirä +Name[uk]=Зовнішня смужка задач +Name[uz]=Vazifalar tashqi paneli +Name[uz@cyrillic]=Вазифалар ташқи панели +Name[ven]=Bara ya mushumo ya nga nnda +Name[vi]=Thanh tác vụ Ngoài +Name[wa]=Bår ås bouyes då dfoû +Name[xh]=Ibar yomsebenzi Wangaphandle +Name[zh_CN]=外部任务栏 +Name[zh_TW]=外部工作列 +Name[zu]=Ibha yemisebenzi yangaphandle +Comment=External taskbar panel extension +Comment[af]=Eksterne taakbalk paneel uitbreiding +Comment[ar]=تمديدة لوحة شريط المهام الخارجي +Comment[be]=Вонкавае пашырэнне панэлі заданняў +Comment[bg]=Допълнителна лента за задачите +Comment[bn]=মূল প্যানেল-এর বাইরে আলাদা টাস্কবার +Comment[bs]=Proširenje panela za eksterni taskbar +Comment[ca]=Extensió del plafó de la barra de tasques externa +Comment[cs]=Rozšíření s externím pruhem úloh +Comment[csb]=Rozszérzenié panelu z bùtnową lëstwą dzejaniów +Comment[cy]=Estyniad panel bar tasgau allanol +Comment[da]=Paneludvidelse - ekstern joblinje +Comment[de]=Eine alternative Fensterleiste +Comment[el]=Επέκταση του πίνακα εξωτερική γραμμή εργασιών +Comment[eo]=Ekstera taskostria panelaldono +Comment[es]=Extensión del panel con barra de tareas externa +Comment[et]=Välise tegumiriba laiendus +Comment[eu]=Panelaren hedapena kanpoko ataza-barrarekin +Comment[fa]=پسوند تابلوی میله‌ تکلیف خارجی +Comment[fi]=Ulkoinen ohjelmapalkin paneelilaajennus +Comment[fr]=Barre des tâches externe +Comment[fy]=Eksterne taakbalke +Comment[gl]=Extensión do painel da barra de tarefas externa +Comment[he]=הרחבת שורת משימות חיצונית +Comment[hr]=Vanjsko proširenje ploče trake zadataka +Comment[hu]=Külső feladatlista-kiterjesztés +Comment[is]=Útvíkkun utanáliggjandi spjalds +Comment[it]=Barra delle applicazioni esterna +Comment[ja]=外部タスクバーパネル拡張 +Comment[ka]=გარე პულტისა და პანელის გაფართოება +Comment[kk]=Қосымша тапсырмалар панелі. +Comment[km]=ផ្នែក​បន្ថែម​បន្ទះ​របារ​ភារកិច្ច​ខាង​ក្រៅ ។ +Comment[lt]=Išorinis užduočių juostos praplėtimas +Comment[mk]=Екстензија на панелот - надворешна лента со програми. +Comment[nb]=Oppgavelinje utenfor panelet +Comment[nds]=En Programmbalken buten dat Paneel +Comment[ne]=बाह्य कार्यपट्टी प्यानल विस्तार +Comment[nl]=Externe taakbalk +Comment[nn]=Oppgåvelinje utanfor panelet +Comment[pa]=ਬਾਹਰੀ ਕੰਮਪੱਟੀ ਪੈਨਲ ਵਧਾਰਾ +Comment[pl]=Rozszerzenie panelu z zewnętrznym paskiem zadań +Comment[pt]=Extensão do painel de barra de tarefas externa +Comment[pt_BR]=Extensão do painel para a barra de tarefas externa +Comment[ro]=Extensie pentru bară de procese externă +Comment[ru]=Внешняя панель задач KDE +Comment[se]=Olgguldas bargoholga viiddádus +Comment[sk]=Rozšírenie externého panelu úloh +Comment[sl]=Zunanja razširitev opravilne vrstice +Comment[sr]=Спољашња трака задатака, проширење панела. +Comment[sr@Latn]=Spoljašnja traka zadataka, proširenje panela. +Comment[sv]=Extern utökning till aktivitetsfältet +Comment[th]=ส่วนขยายเพิ่มเติมแอพเพล็ตถาดงานภายนอก +Comment[tr]=Harici görev çubuğu uzantısı. +Comment[uk]=Зовнішнє розширення панелі задач +Comment[vi]=Bảng điều khiển mở rộng có thanh tác vụ bên ngoài +Comment[wa]=On module di scriftôr di bår ås bouyes då dfoû +Comment[zh_CN]=外部任务栏面板扩展 +Comment[zh_TW]=外部工作列面板延伸 + +Icon=taskbar +X-KDE-Library=taskbar_panelextension +X-KDE-UniqueApplet=true +X-KDE-PanelExt-Resizeable=true +X-KDE-PanelExt-StdSizes=true +X-KDE-PanelExt-StdSizeDefault=1 +X-KDE-PanelExt-CustomSizeMin=24 +X-KDE-PanelExt-CustomSizeMax=400 +X-KDE-PanelExt-CustomSizeDefault=58 diff --git a/kicker/extensions/taskbar/taskbarextension.h b/kicker/extensions/taskbar/taskbarextension.h new file mode 100644 index 000000000..021420483 --- /dev/null +++ b/kicker/extensions/taskbar/taskbarextension.h @@ -0,0 +1,72 @@ +/***************************************************************** + +Copyright (c) 2001 Matthias Elter + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef __taskbarextension_h__ +#define __taskbarextension_h__ + +#include + +#include +#include + +class KRootPixmap; +class TaskBarContainer; + +class TaskBarExtension : public KPanelExtension, virtual public DCOPObject +{ + Q_OBJECT + K_DCOP + +k_dcop: + int panelSize() { return sizeInPixels(); } + int panelOrientation() { return static_cast(orientation()); } + int panelPosition() { return static_cast(position()); } + void setPanelSize(int size) { setSize(static_cast(size),true);}///slotSetSize(size); } + void configure(); + +public: + TaskBarExtension( const QString& configFile, Type t = Normal, + int actions = 0, QWidget *parent = 0, const char *name = 0 ); + ~TaskBarExtension(); + + QSize sizeHint( Position, QSize maxSize ) const; + Position preferedPosition() const { return Bottom; } + +protected: + void resizeEvent(QResizeEvent*); + + void positionChange( Position ); + void preferences(); + +private: + TaskBarContainer *m_container; + QImage m_bgImage; + QString m_bgFilename; + KRootPixmap *m_rootPixmap; + +private slots: + void setBackgroundTheme(); + void updateBackground(const QPixmap&); +}; + +#endif -- cgit v1.2.1