1
/****************************************************************************
5
Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
7
Distributed under the terms of the GNU General Public License version 2.
9
****************************************************************************/
11
#define _KHOTKEYSGLOBAL_CPP_
13
#include "khotkeysglobal.h"
16
#include <kstandarddirs.h>
19
#include "windows_handler.h"
20
#include "triggers/triggers.h"
21
#include "triggers/gestures.h"
23
#include "shortcuts_handler.h"
26
// #include "soundrecorder.h"
31
QPointer<ShortcutsHandler> keyboard_handler = NULL;
32
QPointer<WindowsHandler> windows_handler = NULL;
34
static bool _khotkeys_active = false;
36
void init_global_data( bool active_P, QObject* owner_P )
38
// FIXME: get rid of that static_cast<>s. Don't know why they are there.
39
// Make these singletons.
40
if (!keyboard_handler)
42
keyboard_handler = new ShortcutsHandler( active_P ? ShortcutsHandler::Active : ShortcutsHandler::Configuration, owner_P );
46
windows_handler = new WindowsHandler( active_P, owner_P );
50
gesture_handler = new Gesture( active_P, owner_P );
53
// static_cast< void >( new Voice( active_P, owner_P ));
54
khotkeys_set_active( false );
57
void khotkeys_set_active( bool active_P )
59
_khotkeys_active = active_P;
62
bool khotkeys_active()
64
return _khotkeys_active;
67
// does the opposite of KStandardDirs::findResource() i.e. e.g.
68
// "/opt/kde2/share/applnk/System/konsole.desktop" -> "System/konsole.desktop"
69
QString get_menu_entry_from_path( const QString& path_P )
71
const QStringList dirs = KGlobal::dirs()->resourceDirs( "apps" );
72
for( QStringList::ConstIterator it = dirs.constBegin();
73
it != dirs.constEnd();
75
if( path_P.indexOf( *it ) == 0 )
78
ret.remove( 0, (*it).length());
86
} // namespace KHotKeys