22 #include <Nepomuk2/ResourceManager>
26 #include <KConfigGroup>
28 #include <KLocalizedString>
29 #include <KStandardDirs>
36 m_neverShowAgainKey( QLatin1String( neverShowAgainKey ) )
39 if ( !neverShowAgain )
41 setMessageType( Warning );
42 setCloseButtonVisible(
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." ) );
48 connect( Nepomuk2::ResourceManager::instance(), SIGNAL(nepomukSystemStarted()),
49 SLOT(animatedHide()) );
50 connect( Nepomuk2::ResourceManager::instance(), SIGNAL(nepomukSystemStopped()),
51 SLOT(animatedShow()) );
53 setVisible( !Nepomuk2::ResourceManager::instance()->initialized() );
55 KAction *action = this->findChild<KAction *>();
57 connect( action, SIGNAL(triggered(
bool)), SLOT(explicitlyClosed()) );
60 action =
new KAction( KIcon( QLatin1String(
"configure") ), i18n(
"&Configure" ),
this );
61 connect( action, SIGNAL(triggered(
bool)), SLOT(configure()) );
71 const bool neverShowAgain = cfgGroup.readEntry( neverShowAgainKey,
false );
72 return neverShowAgain;
77 return QLatin1String(
"Missing Nepomuk Warning" );
80 void KPIM::NepomukWarning::configure()
82 if ( KService::serviceByStorageId( QLatin1String(
"kcm_nepomuk.desktop") ) ) {
83 QProcess::startDetached( KStandardDirs::findExe( QLatin1String(
"kcmshell4" ) ),
84 QStringList( QLatin1String(
"kcm_nepomuk" ) ) );
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." ) );
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>" ) ) ) );
104 void KPIM::NepomukWarning::explicitlyClosed()
106 KConfigGroup cfgGroup( KGlobal::config(), QLatin1String(
"Missing Nepomuk Warning" ) );
107 cfgGroup.writeEntry( m_neverShowAgainKey,
true );
110 #include "nepomukwarning.moc"
NepomukWarning(const char *neverShowAgainKey, QWidget *parent=0)
static bool missingNepomukWarning(const char *neverShowAgainKey)
static QString nepomukWarningGroupName()
void setMissingFeatures(const QStringList &features)
Sets a list of features that wont work.