core.cpp
Go to the documentation of this file.00001 #include <qtimer.h>
00002
00003
00004 #include <kapplication.h>
00005 #include <kdebug.h>
00006 #include <kstatusbar.h>
00007 #include <kmainwindow.h>
00008 #include <kconfig.h>
00009 #include <kdeversion.h>
00010 #include <kstandarddirs.h>
00011 #include <kglobal.h>
00012
00013 #include "toplevel.h"
00014 #include "partcontroller.h"
00015 #include "api.h"
00016 #include "projectmanager.h"
00017 #include "kdevlicense.h"
00018
00019 #include "core.h"
00020
00021
00022 Core *Core::s_instance = 0;
00023
00024
00025 Core *Core::getInstance()
00026 {
00027 if (!s_instance)
00028 s_instance = new Core;
00029 return s_instance;
00030 }
00031
00032
00033 Core::Core()
00034 : KDevCore()
00035 {
00036 }
00037
00038
00039 Core::~Core()
00040 {
00041 }
00042
00043 void Core::insertNewAction( KAction* action )
00044 {
00045 Q_UNUSED( action );
00046 }
00047
00048
00049 bool Core::queryClose()
00050 {
00051
00052 KConfig* config = kapp->config();
00053 config->setGroup("General Options");
00054 config->writePathEntry("Last Project",ProjectManager::getInstance()->projectFile().url());
00055
00056 if ( !PartController::getInstance()->querySaveFiles() )
00057 return false;
00058
00059 if ( !ProjectManager::getInstance()->closeProject( true ) )
00060 return false;
00061
00062 if ( !PartController::getInstance()->readyToClose() )
00063 return false;
00064
00065 return true;
00066 }
00067
00068
00069 void Core::running(KDevPlugin * which, bool runs)
00070 {
00071 emit activeProcessChanged( which, runs );
00072 }
00073
00074
00075 void Core::fillContextMenu(QPopupMenu *popup, const Context *context)
00076 {
00077 emit contextMenu(popup, context);
00078 }
00079
00080
00081 void Core::openProject(const QString& projectFileName)
00082 {
00083 ProjectManager::getInstance()->loadProject(KURL( projectFileName ));
00084 }
00085
00086 QDict< KDevLicense > Core::licenses()
00087 {
00088 return m_licenses;
00089 }
00090
00091 void Core::loadLicenses()
00092 {
00093
00094 KStandardDirs* dirs = KGlobal::dirs();
00095 dirs->addResourceType( "licenses", KStandardDirs::kde_default( "data" ) + "kdevelop/licenses/" );
00096 QStringList licNames = dirs->findAllResources( "licenses", QString::null, false, true );
00097
00098 QStringList::Iterator it;
00099 for (it = licNames.begin(); it != licNames.end(); ++it)
00100 {
00101 QString licPath( dirs->findResource( "licenses", *it ) );
00102
00103 QString licName = licPath.mid( licPath.findRev('/') + 1 );
00104 KDevLicense* lic = new KDevLicense( licName, licPath );
00105 m_licenses.insert( licName, lic );
00106 }
00107
00108 }
00109
00110 namespace MainWindowUtils{
00111 QString beautifyToolTip(const QString& text)
00112 {
00113 QString temp = text;
00114 temp.replace(QRegExp("&"), "");
00115 temp.replace(QRegExp("\\.\\.\\."), "");
00116 return temp;
00117 }
00118 }
00119
00120 #include "core.moc"
This file is part of the documentation for KDevelop Version 3.1.2.