[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Systray III.
From: Lubos Lunak <l.lunak () suse ! cz>
Date: 2005-05-27 17:17:46
Message-ID: 200505271917.46925.l.lunak () suse ! cz
[Download RAW message or body]
Hello,
attached are final(?) patches for kdelibs/kdecore, kdelibs/kdeui,
kdebase/kicker/applets/systemtray and kdebase/kwin implementing tray docking
for any app, as already discussed before. I intend to commit them to CVS, so
if somebody sees something wrong with them, like a space not conforming to
Kicker's HACKING file ;), now it's time to complain. If it will show to be
too confusing together with all KDE apps currently using KSystemTray, the UI
elements related to it can be disabled for 3.5.
So, a short summary:
- KWin has a new titlebar button that puts any window into the tray (actually
now that I think of it, only the "KDE2" decoration currently supports it)
- the close and minimize buttons in the titlebar have their normal logical
meaning, i.e. hiding of such apps is done simply by minimizing them, and the
close button really closes the window, usually resulting in the application
quiting
- it clearly doesn't quite work together with apps using KSystemTray
- it is possible to configure in the tray applet preferences what various
mouse buttons on the tray icon do
- for additional features specific to the tray icon (although some of that
could be actually used also e.g. by the taskbar) there's class KDockHandler
(should it have some better name?). It acts a bit like KSystemTray except
that it's not the actual window. You can set the menu there, tooltip,
tray-specific icon (otherwise the window's one is used), you receive DND,
click and wheel events there. The usage of it is something like the attached
a.cpp .
- you can use window-specific settings (Preference tab) to set initial state
of the docking, etc.
Hmm, that's about it I guess.
Also, as another step in my insidious plan to destroy the evil systray,
attached is a patch for kicker that turns systray icons to applets (only the
old-style systray icons, not these). With the patch it's possible to move
things like kget and similar freely on the panel. Currently rather hackish,
Kicker doesn't handle very well automatic adding of new applets, but it's
good enough for showing. Just wondering what you think about it.
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
["kdecore.patch.gz" (application/x-gzip)]
["kdeui.patch.gz" (application/x-gzip)]
["systemtray.patch.gz" (application/x-gzip)]
["a.cpp" (text/x-c++src)]
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <kdebug.h>
#include <qtimer.h>
#include <kdockhandler.h>
#include <kiconloader.h>
#include <qimage.h>
#include <qpopupmenu.h>
class X
: public KDockHandler
{
Q_OBJECT
public:
X( QWidget* w );
public slots:
void smouseClick();
void smouseWheel( QWheelEvent* );
private slots:
void resetIcon();
protected:
virtual void dragEnterEvent( QDragEnterEvent* ) { kdDebug() << "ENTER" << endl; }
virtual void dragMoveEvent( QDragMoveEvent* ) { kdDebug() << "MOVE" << endl; }
virtual void dragLeaveEvent( QDragLeaveEvent* ) { kdDebug() << "LEAVE" << endl; }
virtual void dropEvent( QDropEvent* ) { kdDebug() << "DROP" << endl; }
private:
QTimer t;
};
QWidget* w;
X::X( QWidget* w )
: KDockHandler( w )
{
connect( &t, SIGNAL( timeout()), SLOT( resetIcon()));
}
void X::smouseClick()
{
kdDebug() << "CLICK" << endl;
setIcon( SmallIcon( "about_kde" ));
t.start( 3000, true );
}
void X::resetIcon()
{
setIcon( QImage());
}
void X::smouseWheel( QWheelEvent* e )
{
kdDebug() << "WHEEL:" << e->delta() << endl;
}
int main( int argc, char* argv[] )
{
KCmdLineArgs::init( argc, argv, "a", "b", "c", "d" );
KApplication app;
QWidget ww;
w = &ww;
app.setMainWidget( w );
X h( w );
QObject::connect( &h, SIGNAL( mouseClick()), &h, SLOT( smouseClick()));
QObject::connect( &h, SIGNAL( mouseWheel( QWheelEvent* )), &h, SLOT( smouseWheel( QWheelEvent* )));
h.setAcceptDrops( true );
h.setToolTip( "Hi there!" );
QPopupMenu p;
p.insertItem( "Whatever", kapp, SLOT( quit()));
h.setMenu( &p );
w->show();
return app.exec();
}
#include "a.moc"
["kwin.patch.gz" (application/x-gzip)]
["kicker.patch.gz" (application/x-gzip)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic