1 /***************************************************************************
6 * begin : Tue Jan 29 2002
7 * copyright : (C) 2002 by Patrick Charbonnier
8 * : Based On Caitoo v.0.7.3 (c) 1998 - 2000, Matej Koss
9 * email : pch@freeshell.org
11 ****************************************************************************/
13 /***************************************************************************
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 ***************************************************************************/
29 #include <QDragEnterEvent>
30 #include <QMouseEvent>
33 #include <kaboutdata.h>
34 #include <kapplication.h>
35 #include <kiconloader.h>
40 #include "kmainwidget.h"
45 DockWidget::DockWidget(KMainWidget
* _parent
):KSystemTray(_parent
)
49 setPixmap( loadIcon( "kget_dock" ));
51 // popup menu for right mouse button
52 KMenu
*popupMenu
= contextMenu();
53 parent
->action("drop_target")->plug(popupMenu
);
54 parent
->action("konqueror_integration")->plug(popupMenu
);
55 popupMenu
->insertSeparator();
56 parent
->m_paPreferences
->plug(popupMenu
);
61 dtip
= new DynamicTip( this );
62 dtip
->setStatus( kapp
->aboutData()->shortDescription() );
67 DockWidget::~DockWidget()
74 void DockWidget::dragEnterEvent(QDragEnterEvent
* event
)
76 event
->accept(KURLDrag::canDecode(event
)
77 || Q3TextDrag::canDecode(event
));
81 void DockWidget::dropEvent(QDropEvent
* event
)
86 if (KURLDrag::decode(event
, list
)) {
87 parent
->addTransfers(list
);
88 } else if (Q3TextDrag::decode(event
, str
)) {
89 parent
->addTransfer(str
);
94 void DockWidget::mousePressEvent(QMouseEvent
* e
)
96 if (e
->button() == Qt::MidButton
) {
97 parent
->slotPasteTransfer();
99 KSystemTray::mousePressEvent(e
);
104 void DockWidget::updateToolTip( const QString
& _status
)
106 dtip
->setStatus( _status
);
110 void DockWidget::changeIcon( const QString
& icon
)
112 setPixmap( loadIcon( icon
));
116 DynamicTip::DynamicTip( QWidget
* parent
)
119 // no explicit initialization needed
123 void DynamicTip::setStatus( const QString
& _status
)
128 void DynamicTip::maybeTip( const QPoint
& _pos
)
130 QRect
r( parentWidget()->rect() );
134 #include "docking.moc"