aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/term/libkviterm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/term/libkviterm.cpp')
-rw-r--r--src/modules/term/libkviterm.cpp64
1 files changed, 12 insertions, 52 deletions
diff --git a/src/modules/term/libkviterm.cpp b/src/modules/term/libkviterm.cpp
index 3f7b8abe5..abdf6df92 100644
--- a/src/modules/term/libkviterm.cpp
+++ b/src/modules/term/libkviterm.cpp
@@ -30,24 +30,16 @@
#include <QSplitter>
-#ifdef COMPILE_KDE3_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "termwidget.h"
#include "termwindow.h"
- #include "ktrader.h"
-// #include "kparts/part.h"
-// #include "kparts/factory.h"
-// #include "klibloader.h"
-#endif
-
-KviModule * g_pTermModule = 0;
-
-#ifdef COMPILE_KDE3_SUPPORT
KviPointerList<KviTermWidget> * g_pTermWidgetList = 0;
KviPointerList<KviTermWindow> * g_pTermWindowList = 0;
- KviStr g_szKonsoleLibraryName = "";
#endif
+KviModule * g_pTermModule = 0;
+
/*
@doc: term.open
@type:
@@ -73,21 +65,15 @@ KviModule * g_pTermModule = 0;
static bool term_kvs_cmd_open(KviKvsModuleCommandCall * c)
{
-#ifdef COMPILE_KDE3_SUPPORT
- if(g_szKonsoleLibraryName.hasData())
+#ifdef COMPILE_KDE_SUPPORT
+ c->module()->lock(); // multiple locks are allowed
+ if(c->hasSwitch('m',"mdi"))
{
- c->module()->lock(); // multiple locks are allowed
- if(c->hasSwitch('m',"mdi"))
- {
- KviTermWindow *w = new KviTermWindow(c->window()->frame(),"Terminal emulator");
- c->window()->frame()->addWindow(w);
- } else {
- KviTermWidget *w = new KviTermWidget(c->window()->frame()->splitter(),
- c->window()->frame(),true);
- w->show();
- }
+ KviTermWindow *w = new KviTermWindow(c->window()->frame(),"Terminal emulator");
+ c->window()->frame()->addWindow(w);
} else {
- c->warning("No terminal emulation service available");
+ KviTermWidget *w = new KviTermWidget(c->window()->frame()->splitter(), c->window()->frame(),true);
+ w->show();
}
#else
c->warning("Terminal emulation service not supported (non-KDE compilation)");
@@ -99,46 +85,20 @@ static bool term_module_init(KviModule * m)
{
g_pTermModule = m;
-#ifdef COMPILE_KDE3_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
g_pTermWidgetList = new KviPointerList<KviTermWidget>;
g_pTermWidgetList->setAutoDelete(false);
g_pTermWindowList = new KviPointerList<KviTermWindow>;
g_pTermWindowList->setAutoDelete(false);
-
-// KTrader::OfferList offers = KTrader::self()->query("Browser/View","KonsolePart");
-// KTrader::OfferList offers = KTrader::self()->query("Browser/View","");
-// if(offers.count() > 0)
-// {
-// KTrader::OfferList::Iterator it = offers.begin();
-// while(it != offers.end())
-// {
-// KviStr tmp = (*it)->name();
-// KviStr tmp2 = (*it)->type();
-// KviStr tmp3 = (*it)->library();
-// debug("Got Service name:%s type:%s library:%s",tmp.ptr(),tmp2.ptr(),tmp3.ptr());
-// ++it;
-// }
-// }
-// KService::Ptr service = *offers.begin();
- KService::Ptr pKonsoleService = KService::serviceByName("Terminal Emulator");
- if(!pKonsoleService)pKonsoleService = KService::serviceByName("KonsolePart");
- if(!pKonsoleService)pKonsoleService = KService::serviceByName("Terminal *");
- if(pKonsoleService)
- {
- g_szKonsoleLibraryName = pKonsoleService->library();
-// debug("KONSOLE LIB %s",g_szKonsoleLibraryName.ptr());
- }
-// delete pKonsoleService;
#endif
-// m->registerCommand("open",term_module_cmd_open);
KVSM_REGISTER_SIMPLE_COMMAND(m,"open",term_kvs_cmd_open);
return true;
}
static bool term_module_cleanup(KviModule *)
{
-#ifdef COMPILE_KDE3_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
while(g_pTermWidgetList->first())delete g_pTermWidgetList->first();
delete g_pTermWidgetList;
g_pTermWidgetList = 0;