1 /***************************************************************************
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. *
8 * Copyright (C) 2007 by Javier Goday <jgoday@gmail.com>
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
19 ***************************************************************************/
21 #include "errorgraph.h"
22 #include "transfergraph.h"
24 #include <plasma/widgets/icon.h>
25 #include <plasma/widgets/label.h>
26 #include <plasma/layouts/boxlayout.h>
27 #include <plasma/widgets/pushbutton.h>
32 ErrorGraph::ErrorGraph(Plasma::Applet
*parent
, const QString
&message
)
33 : TransferGraph(parent
)
35 m_layout
= dynamic_cast<Plasma::BoxLayout
*>(parent
->layout());
39 m_icon
= new Plasma::Icon(KIcon("dialog-warning"), "", m_applet
);
41 m_errorLabel
= new Plasma::Label(m_applet
);
42 m_errorLabel
->setText(message
);
43 m_errorLabel
->setPen(QPen(Qt::white
));
44 m_errorLabel
->setAlignment(Qt::AlignCenter
);
46 m_launchButton
= new Plasma::PushButton(KIcon("kget"), "Launch KGet", m_applet
);
48 m_layout
->addItem(m_icon
);
49 m_layout
->addItem(m_errorLabel
);
50 m_layout
->addItem(m_launchButton
);
52 connect(m_launchButton
, SIGNAL(clicked()), SLOT(launchKGet()));
56 ErrorGraph::~ErrorGraph()
60 delete m_launchButton
;
63 void ErrorGraph::launchKGet()
65 QProcess
*kgetProcess
= new QProcess(this);
66 kgetProcess
->startDetached("kget");