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

libkdepim

  • sources
  • kde-4.12
  • kdepim
  • libkdepim
  • widgets
nepomukwarning.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2011 Volker Krause <vkrause@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "nepomukwarning.h"
21 
22 #include <Nepomuk2/ResourceManager>
23 
24 #include <KAction>
25 #include <KConfig>
26 #include <KConfigGroup>
27 #include <KDebug>
28 #include <KLocalizedString>
29 #include <KStandardDirs>
30 #include <KService>
31 
32 #include <QProcess>
33 
34 KPIM::NepomukWarning::NepomukWarning( const char *neverShowAgainKey, QWidget *parent )
35  : KMessageWidget( parent ),
36  m_neverShowAgainKey( QLatin1String( neverShowAgainKey ) )
37 {
38  const bool neverShowAgain = missingNepomukWarning( neverShowAgainKey );
39  if ( !neverShowAgain )
40  {
41  setMessageType( Warning );
42  setCloseButtonVisible( true );
43  setWordWrap( true );
44  setText( i18n( "You do not have the semantic desktop system enabled. "
45  "Many important features of this software depend on the "
46  "semantic desktop system and will not work correctly without it." ) );
47 
48  connect( Nepomuk2::ResourceManager::instance(), SIGNAL(nepomukSystemStarted()),
49  SLOT(animatedHide()) );
50  connect( Nepomuk2::ResourceManager::instance(), SIGNAL(nepomukSystemStopped()),
51  SLOT(animatedShow()) );
52 
53  setVisible( !Nepomuk2::ResourceManager::instance()->initialized() );
54 
55  KAction *action = this->findChild<KAction *>(); // should give us the close action...
56  if ( action ) {
57  connect( action, SIGNAL(triggered(bool)), SLOT(explicitlyClosed()) );
58  }
59 
60  action = new KAction( KIcon( QLatin1String("configure") ), i18n( "&Configure" ), this );
61  connect( action, SIGNAL(triggered(bool)), SLOT(configure()) );
62  addAction( action );
63  }
64  else
65  setVisible(false);
66 }
67 
68 bool KPIM::NepomukWarning::missingNepomukWarning( const char *neverShowAgainKey )
69 {
70  const KConfigGroup cfgGroup( KGlobal::config(), KPIM::NepomukWarning::nepomukWarningGroupName() );
71  const bool neverShowAgain = cfgGroup.readEntry( neverShowAgainKey, false );
72  return neverShowAgain;
73 }
74 
75 QString KPIM::NepomukWarning::nepomukWarningGroupName()
76 {
77  return QLatin1String( "Missing Nepomuk Warning" );
78 }
79 
80 void KPIM::NepomukWarning::configure()
81 {
82  if ( KService::serviceByStorageId( QLatin1String("kcm_nepomuk.desktop") ) ) {
83  QProcess::startDetached( KStandardDirs::findExe( QLatin1String( "kcmshell4" ) ),
84  QStringList( QLatin1String( "kcm_nepomuk" ) ) );
85  } else {
86  KAction *action = qobject_cast<KAction *>( sender() );
87  action->setEnabled( false );
88  setText( i18n( "The module to configure the semantic desktop system (Nepomuk) "
89  "was not found on your system. Please make sure Nepomuk was "
90  "properly installed." ) );
91  }
92 
93 }
94 
95 void KPIM::NepomukWarning::setMissingFeatures( const QStringList &features )
96 {
97  if ( !features.isEmpty() ) {
98  setText( i18n( "You do not have the semantic desktop system enabled. "
99  "The following features will not work correctly:<ul><li>%1</li></ul>",
100  features.join( QLatin1String( "</li><li>" ) ) ) );
101  }
102 }
103 
104 void KPIM::NepomukWarning::explicitlyClosed()
105 {
106  KConfigGroup cfgGroup( KGlobal::config(), QLatin1String( "Missing Nepomuk Warning" ) );
107  cfgGroup.writeEntry( m_neverShowAgainKey, true );
108 }
109 
110 #include "nepomukwarning.moc"
KPIM::NepomukWarning::NepomukWarning
NepomukWarning(const char *neverShowAgainKey, QWidget *parent=0)
Definition: nepomukwarning.cpp:34
QWidget
nepomukwarning.h
KPIM::NepomukWarning::missingNepomukWarning
static bool missingNepomukWarning(const char *neverShowAgainKey)
Definition: nepomukwarning.cpp:68
KPIM::NepomukWarning::nepomukWarningGroupName
static QString nepomukWarningGroupName()
Definition: nepomukwarning.cpp:75
KPIM::NepomukWarning::setMissingFeatures
void setMissingFeatures(const QStringList &features)
Sets a list of features that wont work.
Definition: nepomukwarning.cpp:95
KMessageWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdepim

Skip menu "libkdepim"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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