1 /***************************************************************************
2  *                                                                         *
3  *   This program is free software; you can redistribute it and/or modify  *
4  *   it under the terms of the GNU General Public License as published by  *
5  *   the Free Software Foundation; either version 2 of the License, or     *
6  *   (at your option) any later version.                                   *
7  *                                                                         *
8  *   Copyright (C) 2007 by Javier Goday <jgoday@gmail.com>                 *
9  *   Copyright (C) 2009 by Matthias Fuchs <mat69@gmx.net>                  *
10  *                                                                         *
11  *   This program is distributed in the hope that it will be useful,       *
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14  *   GNU General Public License for more details.                          *
15  *                                                                         *
16  *   You should have received a copy of the GNU General Public License     *
17  *   along with this program; if not, write to the                         *
18  *   Free Software Foundation, Inc.,                                       *
19  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
20  ***************************************************************************/
21 
22 #ifndef KGETAPPLETUTILS_H
23 #define KGETAPPLETUTILS_H
24 
25 #include <QGraphicsProxyWidget>
26 
27 class QDBusConnectionInterface;
28 class QGraphicsLinearLayout;
29 class QGraphicsWidget;
30 class QPainter;
31 class QRect;
32 
33 namespace Plasma {
34     class Svg;
35     class Label;
36     class IconWidget;
37     class PushButton;
38 }
39 
40 class KGetAppletUtils
41 {
42     public:
43         static void paintTitle(QPainter *p, Plasma::Svg *svg, const QRect &rect);
44         static QGraphicsWidget *createErrorWidget(const QString &message, QGraphicsWidget *parent = 0);
45 
46     private:
47         static const int SPACING;
48 };
49 
50 class ErrorWidget : public QGraphicsProxyWidget
51 {
52     Q_OBJECT
53 public:
54     explicit ErrorWidget(const QString &message, QGraphicsWidget *parent = 0);
55     ~ErrorWidget();
56 
57 private Q_SLOTS:
58     void launchKGet();
59     void checkKGetStatus();
60 
61 Q_SIGNALS:
62     void kgetStarted();
63 
64 private:
65     QGraphicsLinearLayout *m_layout;
66     Plasma::Label *m_errorLabel;
67     Plasma::IconWidget *m_icon;
68     Plasma::PushButton *m_launchButton;
69     QDBusConnectionInterface *m_interface;
70 };
71 
72 #endif
73