diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/tipofday/tipofday_part.cpp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/tipofday/tipofday_part.cpp')
-rw-r--r-- | parts/tipofday/tipofday_part.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/parts/tipofday/tipofday_part.cpp b/parts/tipofday/tipofday_part.cpp new file mode 100644 index 00000000..fefdcd39 --- /dev/null +++ b/parts/tipofday/tipofday_part.cpp @@ -0,0 +1,67 @@ +#include "tipofday_part.h" + +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <qwhatsthis.h> + +#include <kaboutdata.h> +#include <kaction.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kstandarddirs.h> +#include <ktextbrowser.h> +#include <ktip.h> + +#include "kdevapi.h" +#include "kdevcore.h" + +static const KDevPluginInfo data("kdevtipofday"); + +typedef KDevGenericFactory<TipOfDayPart> TipOfDayFactory; +K_EXPORT_COMPONENT_FACTORY( libkdevtipofday, TipOfDayFactory( data ) ) + +TipOfDayPart::TipOfDayPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name ? name : "TipOfDayPart") +{ + setInstance(TipOfDayFactory::instance()); + + setXMLFile("kdevpart_tipofday.rc"); + + KAction *action; + + action = new KAction(i18n("&Tip of the Day"), "idea", 0, + this, SLOT(showTip()), actionCollection(), "help_tipofday"); + action->setToolTip(i18n("A tip how to use KDevelop")); + action->setWhatsThis(i18n("<b>Tip of the day</b><p>" + "Will display another good tip \n" + "contributed by KDevelop users.")); + + connect(core(), SIGNAL(coreInitialized()), this, SLOT(showOnStart())); +} + + +QString TipOfDayPart::getFilename() +{ + KConfig * config = KApplication::kApplication()->config(); + config->setGroup("Tip of day plugin"); + return config->readEntry("TipsFile", "kdevtipofday/tips"); +} + +void TipOfDayPart::showTip() +{ + KTipDialog::showTip(getFilename(), true); +} + + +void TipOfDayPart::showOnStart() +{ + KTipDialog::showTip(getFilename()); +} + + + +#include "tipofday_part.moc" |