diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kicker/extensions/sidebar | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
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
Diffstat (limited to 'kicker/extensions/sidebar')
-rw-r--r-- | kicker/extensions/sidebar/Makefile.am | 16 | ||||
-rw-r--r-- | kicker/extensions/sidebar/sidebarextension.cpp | 181 | ||||
-rw-r--r-- | kicker/extensions/sidebar/sidebarextension.desktop | 147 | ||||
-rw-r--r-- | kicker/extensions/sidebar/sidebarextension.h | 63 |
4 files changed, 407 insertions, 0 deletions
diff --git a/kicker/extensions/sidebar/Makefile.am b/kicker/extensions/sidebar/Makefile.am new file mode 100644 index 000000000..18f0cfbc0 --- /dev/null +++ b/kicker/extensions/sidebar/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = -I$(top_srcdir)/libkonq $(all_includes) + +kde_module_LTLIBRARIES = sidebar_panelextension.la + +sidebar_panelextension_la_SOURCES = sidebarextension.cpp + +sidebar_panelextension_la_METASOURCES = AUTO +sidebar_panelextension_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +sidebar_panelextension_la_LIBADD = $(LIB_KDEUI) $(LIB_KPARTS) ../../../libkonq/libkonq.la + + +lnkdir = $(kde_datadir)/kicker/extensions +lnk_DATA = sidebarextension.desktop + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/kickersidebarextension.pot diff --git a/kicker/extensions/sidebar/sidebarextension.cpp b/kicker/extensions/sidebar/sidebarextension.cpp new file mode 100644 index 000000000..a959f7f87 --- /dev/null +++ b/kicker/extensions/sidebar/sidebarextension.cpp @@ -0,0 +1,181 @@ +/*************************************************************************** + sidebarextension.cpp + ------------------- + begin : Sun July 20 16:00:00 CEST 2003 + copyright : (C) 2003 Joseph Wenninger + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include "sidebarextension.h" +#include "sidebarextension.moc" +#include <kdebug.h> +#include <kmessagebox.h> +#include <kglobal.h> +#include <klocale.h> +#include <kparts/part.h> +#include <kparts/componentfactory.h> +#include <qlayout.h> +#include <konq_historymgr.h> +#include <krun.h> +#include <kurl.h> +#include <qvbox.h> +#include <qcursor.h> + +extern "C" +{ + KDE_EXPORT KPanelExtension *init( QWidget *parent, const QString& configFile ) + { + KGlobal::locale()->insertCatalogue("kickersidebarextension"); + KGlobal::locale()->insertCatalogue("konqueror"); + return new SidebarExtension( configFile, + KPanelExtension::Normal, + 0, + parent, "kickersidebarextension"); + } +} + +SidebarExtension::SidebarExtension( const QString& configFile, + Type type, + int actions, + QWidget *parent, const char *name ) + : KPanelExtension( configFile, type, actions, parent, name ),m_resizing(false),m_expandedSize(200) +{ + kdDebug() << "SidebarExtension: Created '" << name << "', '" << configFile << "'" << endl; + new KonqHistoryManager(0,"SidebarExtensionHistoryManager"); + m_layout=new QHBoxLayout(this); + m_layout->activate(); + m_sbWrapper=new QVBox(this); + KParts::ReadOnlyPart *p=KParts::ComponentFactory::createPartInstanceFromLibrary<KParts::ReadOnlyPart>( + "konq_sidebar", + m_sbWrapper, + "SideBar_View", + this, + "Sidebar","universal"); + + KParts::BrowserExtension *be=KParts::BrowserExtension::childObject(p); + if (be) { + connect(be,SIGNAL(openURLRequest( const KURL &, const KParts::URLArgs &)), + this,SLOT(openURLRequest( const KURL &, const KParts::URLArgs &))); + connect(be,SIGNAL(createNewWindow( const KURL &, const KParts::URLArgs &)), + this,SLOT(openURLRequest( const KURL &, const KParts::URLArgs &))); + + } + + m_resizeHandle=new QFrame(this); + m_resizeHandle->setFrameShape(QFrame::Panel); + m_resizeHandle->setFrameShadow(QFrame::Raised); + m_resizeHandle->setFixedWidth(6); + m_resizeHandle->setCursor(QCursor(Qt::SizeHorCursor)); + connect(p->widget(),SIGNAL(panelHasBeenExpanded(bool)),this,SLOT(needLayoutUpdate(bool))); + needLayoutUpdate(false); + m_resizeHandle->installEventFilter(this); + m_resizeHandle->setMouseTracking(true); +// l->add(p->widget()); +// p->widget()->show(); +// l->activate(); + +} + +void SidebarExtension::needLayoutUpdate(bool exp) { + setReserveStrut(!exp); // only reserve a strut when we are collapsed + if (exp) { + m_currentWidth=m_expandedSize; + m_resizeHandle->show(); + raise(); + } else { + m_currentWidth=24; + m_resizeHandle->hide(); + } + topLevelWidget()->setFixedWidth(m_currentWidth); + emit updateLayout(); +} + +void SidebarExtension::openURLRequest( const KURL &url, const KParts::URLArgs &) { + KRun::runCommand("kfmclient openURL \""+url.prettyURL()+"\"", "kfmclient", "konqueror"); + +} + + +SidebarExtension::~SidebarExtension() +{ + KGlobal::locale()->removeCatalogue("kickersidebarextension"); + KGlobal::locale()->removeCatalogue("konqueror"); +} + +bool SidebarExtension::eventFilter( QObject *, QEvent *e ) { + if (e->type()==QEvent::MouseButtonPress) { + m_resizing=true; + m_x=((QMouseEvent*)e)->globalX(); + return true; + } else if (e->type()==QEvent::MouseButtonRelease) { + m_resizing=false; + m_expandedSize=topLevelWidget()->width(); + needLayoutUpdate(true); + return true; + } else if (e->type()==QEvent::MouseMove) { + if (m_resizing) { + Position p=position(); + if (p==Left) { + int diff=((QMouseEvent*)e)->globalX()-m_x; + if (abs(diff)>3) { + topLevelWidget()->setFixedWidth(topLevelWidget()->width()+diff); + m_x=((QMouseEvent*)e)->globalX(); + } + } else if (p==Right) { + int diff=((QMouseEvent*)e)->globalX()-m_x; + if (abs(diff)>3) { + topLevelWidget()->setFixedWidth(topLevelWidget()->width()-diff); + topLevelWidget()->move(topLevelWidget()->x()+diff,topLevelWidget()->y()); + m_x=((QMouseEvent*)e)->globalX(); + } + } + return true; + } + } + return false; +} + +KPanelExtension::Position SidebarExtension::preferedPosition() const { + kdDebug()<<"SidebarExtension::preferedPosition()***************"<<endl; + return KPanelExtension::Left; +} + +QSize SidebarExtension::sizeHint(Position, QSize maxSize ) const +{ + return QSize(m_currentWidth,maxSize.height()); +} + +void SidebarExtension::positionChange( Position position ) { + if (position == Right) { + m_layout->remove(m_sbWrapper); + m_layout->remove(m_resizeHandle); + + m_layout->add(m_resizeHandle); + m_layout->add(m_sbWrapper); + } else if (position == Left) { + m_layout->remove(m_sbWrapper); + m_layout->remove(m_resizeHandle); + + m_layout->add(m_sbWrapper); + m_layout->add(m_resizeHandle); + + } + +} + +void SidebarExtension::about() +{ +} + +void SidebarExtension::preferences() +{ +} + diff --git a/kicker/extensions/sidebar/sidebarextension.desktop b/kicker/extensions/sidebar/sidebarextension.desktop new file mode 100644 index 000000000..8ff52adb7 --- /dev/null +++ b/kicker/extensions/sidebar/sidebarextension.desktop @@ -0,0 +1,147 @@ +[Desktop Entry] +Name=Universal Sidebar +Name[af]=Universele Kantbalk +Name[ar]=الشريط الجانبي العالمي +Name[az]=Ümumi Yan Çubuq +Name[be]=Універсальная бакавая панэль +Name[bg]=Универсален панел +Name[bn]=সার্বজনীন সাইডবার +Name[bs]=Univerzalni sidebar +Name[ca]=Barra universal +Name[cs]=Univerzální postranní lišta +Name[csb]=Ùniwersalnô bòcznô lëstew +Name[cy]=BarOchr Cyffredinol +Name[da]=Universel sidebjælke +Name[de]=Universeller Navigationsbereich +Name[el]=Καθολική πλευρική μπάρα +Name[eo]=Ĝenerala flankzono +Name[es]=Barra lateral universal +Name[et]=Universaalne külgriba +Name[eu]=Alboko barra unibertsala +Name[fa]=میله جانبی عمومی +Name[fi]=Yleissivupalkki +Name[fr]=Barre latérale universelle +Name[fy]=Universele sydbalke +Name[ga]=Barra Taoibh Uilíoch +Name[gl]=Barra Lateral Universal +Name[he]=סרגל־צד אוניברסלי +Name[hi]=सर्वव्यापी बाज़ू-पट्टी +Name[hr]=Univerzalna bočna traka +Name[hu]=Univerzális oldalsáv +Name[is]=Algild hliðarslá +Name[it]=Barra laterale universale +Name[ja]=汎用サイドバー +Name[ka]=უნივერსალური გვერდითი პანელი +Name[kk]=Әмбебап бүйірдегі панель +Name[km]=របារចំហៀងទូទៅ +Name[lt]=Universali šoninė juosta +Name[lv]=Unversālā sānjosla +Name[mk]=Универзална странична лента +Name[mn]=Универсал хажуу самбар +Name[ms]=Bar Sisi Universal +Name[mt]=Sidebar Universali +Name[nb]=Universell sidestolpe +Name[nds]=Siet-Navigatschoonbalken +Name[ne]=विश्वव्यापी छेउपट्टी +Name[nl]=Universele zijbalk +Name[nn]=Universell sidestolpe +Name[pa]=ਯੂਨੀਵਰਸਲ ਬਾਹੀ +Name[pl]=Uniwersalny pasek boczny +Name[pt]=Barra Lateral Universal +Name[pt_BR]=Barra Lateral Universal +Name[ro]=Bară laterală universală +Name[ru]=Универсальная боковая панель +Name[rw]=Umurongokuruhande Mpuzamahanga +Name[se]=Universella holga +Name[sk]=Univerzálny bočný panel +Name[sl]=Univerzalna stranska vrstica +Name[sr]=Универзална бочна трака +Name[sr@Latn]=Univerzalna bočna traka +Name[sv]=Generell sidopanel +Name[ta]=பொது வரலாற்றுப் பக்கப்பட்டி +Name[th]=แถบข้าง +Name[tr]=Genel Yan Çubuk +Name[tt]=Küpçaralı Yantirä +Name[uk]=Універсальна бічна панель +Name[uz]=Universal yon paneli +Name[uz@cyrillic]=Универсал ён панели +Name[vi]=Thanh bên Chung +Name[wa]=Bår di costé universele +Name[zh_CN]=通用侧边栏 +Name[zh_TW]=整體的邊列 + +Comment=Wrapper around Konqueror's navigation panel +Comment[af]='n Toevou program rondom Konqueror se navigasie paneel +Comment[be]=Панэль для хуткай навігацыі +Comment[bg]=Допълнителен универсален панел, подобен на панела на браузъра +Comment[bn]=কনকরার-এর ন্যাভিগেশন প্যানেল-এর প্রসারণ +Comment[bs]=Omotač za Konquerorov navigacioni panel +Comment[ca]=Embolcall al voltant del plafó de navegació del Konqueror +Comment[csb]=Programa òpakòwującô nawigacëjny panel Konquerora +Comment[cy]=Lapiad o gwmpas panel morlywio Konqueror +Comment[da]=Konvolut om Konquerors navigationspanel +Comment[de]=Erweiterung zum Navigationsbereich von Konqueror +Comment[el]=Ενσωματωτής στο Περιηγητή του Konqueror +Comment[eo]=Ŝelo ĉirkaŭ la Konkeranta stirpanelo +Comment[es]=Envoltura para el panel de navegación de Konqueror +Comment[et]=Konquerori liikumisriba skelett +Comment[eu]=Konquerorren arakatze panelerako bilgarria +Comment[fa]=سطرشکن در اطراف تابلوی ناوش Konqueror +Comment[fi]=Kuori Konquerorin navigaatiopaneelin ympärille +Comment[fr]=Un enveloppement autour du panneau de navigation de Konqueror +Comment[fy]=In kontainer rûn de Konqueror's navigaasjepaniel +Comment[gl]=Reutilización do painel de navegación de Konqueror +Comment[he]=מעטפת מסביב ללוח הניווט של Konqueror +Comment[hi]=कॉन्करर के नेविगेशन फलक के चारों ओर रैपर +Comment[hr]=Omotač oko Konqueror navigacijske ploče +Comment[hu]=Segédelem a Konqueror navigációs paneljéhez +Comment[is]=Lag í kringum stjórnborð Konqueror vefrans +Comment[it]=Wrapper per il pannello di navigazione di Konqueror +Comment[ja]=Konqueror のナビゲーションパネルのラッパー +Comment[ka]=Konqueror -ის პანელის დამმუშავებელი +Comment[kk]=Konqueror's басқару панелінің өңдеушісі +Comment[km]=Wrapper ជុំវិញបន្ទះរុករករបស់ Konqueror +Comment[lt]=Konqueror navigacijos pulto dėklas +Comment[lv]=Iekarotāja navigācijas paneļa vraperis +Comment[mk]=Обвивка околу навигациониот панел на Konqueror +Comment[ms]=Pembalut sekeliling panel navigasi Konqueror +Comment[mt]="Wrapper" madwar il-pannell ta' navigazzjoni ta' Konqueror +Comment[nb]=Overbygning på navigasjonspanelet i Konqueror +Comment[nds]=Konqueror sien Navigatschoonpaneel för den Schriefdisch +Comment[ne]=कन्क्वेररको नेभिगेसन प्यानल वरिपरि आवरण +Comment[nl]=Een container rond Konqueror's navigatiepaneel +Comment[nn]=Overbygning på navigasjonspanelet i Konqueror +Comment[pa]=ਕੋਨਕਿਉਰਰ ਦੇ ਏਧਰ-ਓਧਰ ਪੈਨਲ ਲਈ ਸਮੇਟਣ ਵਾਲੀ +Comment[pl]=Program opakowujący panel nawigacyjny Konquerora +Comment[pt]=Uma interface sobre o painel de navegação do Konqueror +Comment[pt_BR]=Wrapper para o painel de navegação do Konqueror +Comment[ro]=O încapsulare a panoului de navigare Konqueror +Comment[ru]=Обработчик панели навигации Konqueror +Comment[rw]=Mufunika hafi y'umwanya w'ibuganya wa Konqueror +Comment[sk]=Obálka pre navigačný panel Konquerora +Comment[sl]=Objemalnik okoli Konquerorjevega navigacijskega pulta +Comment[sr]=Омотач Konqueror-вог навигационог панела +Comment[sr@Latn]=Omotač Konqueror-vog navigacionog panela +Comment[sv]=Omgivning för Konquerors navigeringspanel +Comment[ta]=கான்கொரர் நவிகேஷன் பலகத்தை சுற்றப்பட்டுள்ளது. +Comment[th]=หุ้มอยู่รอบๆ Navigation panel ของคอนเควอร์เรอร์ +Comment[tr]=Konqueror'un yönlendirme paneli çevresindeki satır atlatıcı +Comment[tt]=Konqueror'nıñ küçü taqtasınıñ sıydırması +Comment[uk]=Обгортка навколо навігаційної панелі Konqueror +Comment[vi]=Bao bọc xung quanh bảng duyệt của Konqueror +Comment[wa]=On bagaedje åtoû do scriftôr di naiviaedje di Konqueror +Comment[zh_CN]=Konqueror 导航面板的转换器 +Comment[zh_TW]=包裝於 konqueror 的導覽面板 + +Icon=view_sidetree + +X-KDE-Library=sidebar_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=200 +X-KDE-UniqueExtension=true +X-KDE-PanelExt-Positions=Left,Right diff --git a/kicker/extensions/sidebar/sidebarextension.h b/kicker/extensions/sidebar/sidebarextension.h new file mode 100644 index 000000000..a44c270ba --- /dev/null +++ b/kicker/extensions/sidebar/sidebarextension.h @@ -0,0 +1,63 @@ +/*************************************************************************** + sidebarextension.h + ------------------- + begin : Sun July 20 16:00:00 CEST 2003 + copyright : (C) 2003 Joseph Wenninger + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#ifndef SIDEBAREXTENSION_H +#define SIDEBAREXTENSION_H + +#include <kpanelextension.h> +#include <kurl.h> +#include <kparts/browserextension.h> + +class QHBoxLayout; +class QVBox; + +class SidebarExtension : public KPanelExtension +{ + Q_OBJECT + +public: + SidebarExtension( const QString& configFile, + Type t = Normal, + int actions = 0, + QWidget *parent = 0, const char *name = 0 ); + + virtual ~SidebarExtension(); + + QSize sizeHint( Position, QSize maxSize ) const; + Position preferedPosition() const; + + virtual void positionChange( Position position ); + +protected: + virtual void about(); + virtual void preferences(); + virtual bool eventFilter( QObject *o, QEvent *e ); +protected slots: + void openURLRequest( const KURL &, const KParts::URLArgs &); + void needLayoutUpdate(bool); + +private: + int m_currentWidth; + int m_x; + QFrame *m_resizeHandle; + bool m_resizing; + int m_expandedSize; + QHBoxLayout *m_layout; + QVBox *m_sbWrapper; +}; + +#endif + |