• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Generic Shell
 

KDevelop Generic Shell

  • src
core.cpp
1#include <tqtimer.h>
2
3
4#include <tdeapplication.h>
5#include <kdebug.h>
6#include <kstatusbar.h>
7#include <tdemainwindow.h>
8#include <tdeconfig.h>
9#include <kstandarddirs.h>
10#include <tdeglobal.h>
11#include <tdeactioncollection.h>
12
13#include "toplevel.h"
14#include "partcontroller.h"
15#include "api.h"
16#include "projectmanager.h"
17
18#include "core.h"
19
20
21Core *Core::s_instance = 0;
22
23
24Core *Core::getInstance()
25{
26 if (!s_instance)
27 s_instance = new Core;
28 return s_instance;
29}
30
31void Core::setupShourtcutTips(KXMLGUIClient * client)
32{
33 TQPtrList<KXMLGUIClient> clients;
34 if (client != 0)
35 clients.append(client);
36 else
37 clients = TopLevel::getInstance()->main()->guiFactory()->clients();
38
39 for( TQPtrListIterator<KXMLGUIClient> it(clients); it.current(); ++it ) {
40 TDEActionCollection *actionCollection = (*it)->actionCollection();
41 for (int i = 0; i < actionCollection->count(); i++) {
42 TDEAction *action = actionCollection->action(i);
43
44 TQString tooltip = action->toolTip();
45 if (tooltip.isEmpty())
46 tooltip = action->text().remove('&');
47 else {
48 int i = tooltip.findRev('(');
49 if (i > 0) tooltip = tooltip.left(i).stripWhiteSpace();
50 }
51
52 TQString shortcut = action->shortcutText();
53 if (!shortcut.isEmpty())
54 tooltip += " (" + shortcut + ")";
55 action->setToolTip(tooltip);
56 }
57 }
58}
59
60Core::Core()
61 : KDevCore()
62{
63}
64
65
66Core::~Core()
67{
68}
69
70bool Core::queryClose()
71{
72 // save the the project to open it automaticly on startup if needed
73 TDEConfig* config = kapp->config();
74 config->setGroup("General Options");
75 config->writePathEntry("Last Project",ProjectManager::getInstance()->projectFile().url());
76
77 if ( !PartController::getInstance()->querySaveFiles() )
78 return false;
79
80 if ( !ProjectManager::getInstance()->closeProject( true ) )
81 return false;
82
83 if ( !PartController::getInstance()->readyToClose() )
84 return false;
85
86 return true;
87}
88
89
90void Core::running(KDevPlugin * which, bool runs)
91{
92 emit activeProcessChanged( which, runs );
93}
94
95
96void Core::fillContextMenu(TQPopupMenu *popup, const Context *context)
97{
98 emit contextMenu(popup, context);
99}
100
101
102void Core::openProject(const TQString& projectFileName)
103{
104 ProjectManager::getInstance()->loadProject(KURL( projectFileName ));
105}
106
107namespace MainWindowUtils{
108TQString beautifyToolTip(const TQString& text)
109{
110 TQString temp = text;
111 temp.replace(TQRegExp("&"), "");
112 temp.replace(TQRegExp("\\.\\.\\."), "");
113 return temp;
114}
115}
116
117#include "core.moc"
Core
Core implementation.
Definition core.h:21
Core::setupShourtcutTips
static void setupShourtcutTips(KXMLGUIClient *client=0)
Setup shourtcut tips.
Definition core.cpp:31
TopLevel::getInstance
static KDevMainWindow * getInstance()
Get a pointer to the single KDevTopLevel object.
Definition toplevel.cpp:18

KDevelop Generic Shell

Skip menu "KDevelop Generic Shell"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDevelop Generic Shell

Skip menu "KDevelop Generic Shell"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Generic Shell by doxygen 1.15.0
This website is maintained by Timothy Pearson.