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

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.8.13
This website is maintained by Timothy Pearson.