1
/***************************************************************************
2
* Copyright © 2010 by Daniel Nicoletti <dantti85-pk@yahoo.com.br> *
3
* Copyright © 2010-2012 Jonathan Thomas <echidnaman@kubuntu.org> *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
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; see the file COPYING. If not, write to *
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
18
* Boston, MA 02110-1301, USA. *
19
***************************************************************************/
21
#include "ApplicationLauncher.h"
23
#include "LaunchListModel.h"
25
#include <QtCore/QStringBuilder>
26
#include <QtWidgets/QLabel>
28
#include <QtWidgets/QPushButton>
29
#include <QStandardItemModel>
30
#include <QtWidgets/QVBoxLayout>
32
#include <KLocalizedString>
33
#include <KStandardGuiItem>
35
ApplicationLauncher::ApplicationLauncher(LaunchListModel* model, QWidget* parent)
39
QVBoxLayout *layout = new QVBoxLayout(this);
42
QLabel *label = new QLabel(this);
43
label->setText(i18np("The following application was just installed, click on it to launch:",
44
"The following applications were just installed, click on them to launch:",
47
QListView *appView = new QListView(this);
48
appView->setIconSize(QSize(32, 32));
49
connect(appView, SIGNAL(activated(QModelIndex)),
50
m_model, SLOT(invokeApplication(QModelIndex)));
52
QWidget *bottomBox = new QWidget(this);
53
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomBox);
54
bottomLayout->setSpacing(0);
55
bottomLayout->setMargin(0);
56
bottomBox->setLayout(bottomLayout);
58
QWidget *bottomSpacer = new QWidget(bottomBox);
59
bottomSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
61
QPushButton *closeButton = new QPushButton(bottomBox);
62
KGuiItem closeItem = KStandardGuiItem::close();
63
closeButton->setText(closeItem.text());
64
closeButton->setIcon(closeItem.icon());
65
connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
67
bottomLayout->addWidget(bottomSpacer);
68
bottomLayout->addWidget(closeButton);
70
appView->setModel(m_model);
72
layout->addWidget(label);
73
layout->addWidget(appView);
74
layout->addWidget(bottomBox);