summaryrefslogtreecommitdiffstats
path: root/src/core.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /src/core.cpp
downloadtdevelop-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 'src/core.cpp')
-rw-r--r--src/core.cpp118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/core.cpp b/src/core.cpp
new file mode 100644
index 00000000..d7b6b285
--- /dev/null
+++ b/src/core.cpp
@@ -0,0 +1,118 @@
+#include <qtimer.h>
+
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kstatusbar.h>
+#include <kmainwindow.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#include <kstandarddirs.h>
+#include <kglobal.h>
+#include <kactioncollection.h>
+
+#include "toplevel.h"
+#include "partcontroller.h"
+#include "api.h"
+#include "projectmanager.h"
+
+#include "core.h"
+
+
+Core *Core::s_instance = 0;
+
+
+Core *Core::getInstance()
+{
+ if (!s_instance)
+ s_instance = new Core;
+ return s_instance;
+}
+
+void Core::setupShourtcutTips(KXMLGUIClient * client)
+{
+ QPtrList<KXMLGUIClient> clients;
+ if (client != 0)
+ clients.append(client);
+ else
+ clients = TopLevel::getInstance()->main()->guiFactory()->clients();
+
+ for( QPtrListIterator<KXMLGUIClient> it(clients); it.current(); ++it ) {
+ KActionCollection *actionCollection = (*it)->actionCollection();
+ for (int i = 0; i < actionCollection->count(); i++) {
+ KAction *action = actionCollection->action(i);
+
+ QString tooltip = action->toolTip();
+ if (tooltip.isEmpty())
+ tooltip = action->text().remove('&');
+ else {
+ int i = tooltip.findRev('(');
+ if (i > 0) tooltip = tooltip.left(i).stripWhiteSpace();
+ }
+
+ QString shortcut = action->shortcutText();
+ if (!shortcut.isEmpty())
+ tooltip += " (" + shortcut + ")";
+ action->setToolTip(tooltip);
+ }
+ }
+}
+
+Core::Core()
+ : KDevCore()
+{
+}
+
+
+Core::~Core()
+{
+}
+
+bool Core::queryClose()
+{
+ // save the the project to open it automaticly on startup if needed
+ KConfig* config = kapp->config();
+ config->setGroup("General Options");
+ config->writePathEntry("Last Project",ProjectManager::getInstance()->projectFile().url());
+
+ if ( !PartController::getInstance()->querySaveFiles() )
+ return false;
+
+ if ( !ProjectManager::getInstance()->closeProject( true ) )
+ return false;
+
+ if ( !PartController::getInstance()->readyToClose() )
+ return false;
+
+ return true;
+}
+
+
+void Core::running(KDevPlugin * which, bool runs)
+{
+ emit activeProcessChanged( which, runs );
+}
+
+
+void Core::fillContextMenu(QPopupMenu *popup, const Context *context)
+{
+ emit contextMenu(popup, context);
+}
+
+
+void Core::openProject(const QString& projectFileName)
+{
+ ProjectManager::getInstance()->loadProject(KURL( projectFileName ));
+}
+
+namespace MainWindowUtils{
+QString beautifyToolTip(const QString& text)
+{
+ QString temp = text;
+ temp.replace(QRegExp("&"), "");
+ temp.replace(QRegExp("\\.\\.\\."), "");
+ return temp;
+}
+}
+
+#include "core.moc"