File indexing completed on 2024-04-21 16:29:38

0001 /***************************************************************************
0002  *   Copyright (C) 2008-2011 by Daniel Nicoletti                           *
0003  *   dantti12@gmail.com                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; see the file COPYING. If not, write to       *
0017  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0018  *   Boston, MA 02110-1301, USA.                                           *
0019  ***************************************************************************/
0020 
0021 #include "IntroDialog.h"
0022 
0023 #include "ui_IntroDialog.h"
0024 
0025 #include <PkStrings.h>
0026 
0027 #include <KLocalizedString>
0028 #include <KMessageBox>
0029 
0030 #include <QLoggingCategory>
0031 
0032 #include <QWeakPointer>
0033 #include <QFileInfo>
0034 #include <QCoreApplication>
0035 
0036 #include <Daemon>
0037 
0038 #include "FilesModel.h"
0039 
0040 IntroDialog::IntroDialog(QWidget *parent) :
0041     QWidget(parent),
0042     ui(new Ui::IntroDialog)
0043 {
0044     ui->setupUi(this);
0045 }
0046 
0047 IntroDialog::~IntroDialog()
0048 {
0049     delete ui;
0050 }
0051 
0052 void IntroDialog::setModel(QAbstractItemModel *model)
0053 {
0054     ui->listView->setModel(model);
0055     connect(model, &QAbstractItemModel::dataChanged, this, &IntroDialog::selectionChanged);
0056 }
0057 
0058 void IntroDialog::acceptDrops(const QString &toolTip)
0059 {
0060     ui->listView->setDragDropMode(QListView::DropOnly);
0061     ui->listView->setToolTip(toolTip);
0062 }
0063 
0064 bool IntroDialog::canContinue() const
0065 {
0066     return ui->listView->model()->rowCount();
0067 }
0068 
0069 void IntroDialog::selectionChanged()
0070 {
0071     // if the model has more than one item it can continue
0072     emit continueChanged(canContinue());
0073 }
0074 
0075 void IntroDialog::setDescription(const QString &description)
0076 {
0077     ui->descriptionL->setText(description);
0078 }
0079 
0080 #include "moc_IntroDialog.cpp"