• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • cleaner
mainwindow.cpp
Go to the documentation of this file.
1 /*
2  <one line to give the library's name and an idea of what it does.>
3  Copyright (C) 2012 Vishesh Handa <me@vhanda.in>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library 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 GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 
21 #include "mainwindow.h"
22 #include "jobmodel.h"
23 
24 #include <QtGui/QVBoxLayout>
25 #include <QLabel>
26 #include <QCoreApplication>
27 
28 #include <KLocalizedString>
29 
30 MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(parent, flags)
31 {
32  QWidget* widget = new QWidget( this );
33  QVBoxLayout* layout = new QVBoxLayout( widget );
34 
35  QLabel* label = new QLabel( i18n("The Nepomuk Cleaner can be used to cleanup invalid and buggy"
36  " data in your Nepomuk database."), this );
37  label->setWordWrap( true );
38 
39  m_model = new JobModel( this );
40  connect( m_model, SIGNAL(finished()), this, SLOT(slotModelFinished()) );
41 
42  m_view = new QListView( widget );
43  m_view->setModel( m_model );
44  m_view->setWordWrap( true );
45  m_view->setSelectionMode( QAbstractItemView::NoSelection );
46 
47  m_button = new KPushButton(i18n("Start"), widget);
48  connect(m_button, SIGNAL(clicked(bool)), this, SLOT(slotButtonClicked()));
49 
50  layout->addWidget( label );
51  layout->addWidget( m_view );
52  layout->addWidget( m_button );
53 
54  setCentralWidget( widget );
55  setWindowTitle( i18n("Nepomuk Cleaner") );
56 }
57 
58 void MainWindow::slotButtonClicked()
59 {
60  if( m_model->status() == JobModel::NotStarted ) {
61  m_button->setText( i18n("Pause") );
62  m_model->start();
63  }
64  else if( m_model->status() == JobModel::Running ) {
65  m_model->pause();
66  m_button->setText( i18n("Resume") );
67  }
68  else if( m_model->status() == JobModel::Paused ) {
69  m_model->resume();
70  m_button->setText( i18n("Pause") );
71  }
72  else if( m_model->status() == JobModel::Finished ) {
73  QCoreApplication::instance()->quit();
74  }
75 }
76 
77 void MainWindow::slotModelFinished()
78 {
79  m_button->setText( i18n("Quit") );
80 }
JobModel::pause
void pause()
Definition: jobmodel.cpp:87
JobModel::Finished
Definition: jobmodel.h:51
QWidget
JobModel::Running
Definition: jobmodel.h:49
JobModel
Definition: jobmodel.h:33
JobModel::resume
void resume()
Definition: jobmodel.cpp:97
JobModel::NotStarted
Definition: jobmodel.h:48
JobModel::start
void start()
Definition: jobmodel.cpp:81
mainwindow.h
JobModel::Paused
Definition: jobmodel.h:50
QMainWindow
JobModel::status
Status status()
Definition: jobmodel.cpp:103
MainWindow::MainWindow
MainWindow(QWidget *parent=0, Qt::WindowFlags flags=0)
Definition: mainwindow.cpp:30
jobmodel.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal