~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/access/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "kaccess.h"
 
3
#include <kdebug.h>
 
4
#include <kaboutdata.h>
 
5
#include <kcmdlineargs.h>
 
6
#include <klocale.h>
 
7
extern "C" KDE_EXPORT int kdemain(int argc, char * argv[] )
 
8
{
 
9
  KAboutData about(I18N_NOOP("kaccess"), 0, ki18n("KDE Accessibility Tool"),
 
10
                  0, KLocalizedString(), KAboutData::License_GPL,
 
11
                  ki18n("(c) 2000, Matthias Hoelzer-Kluepfel"));
 
12
 
 
13
  about.addAuthor(ki18n("Matthias Hoelzer-Kluepfel"), ki18n("Author") , "hoelzer@kde.org");
 
14
 
 
15
  KCmdLineArgs::init( argc, argv, &about );
 
16
 
 
17
  if (!KAccessApp::start())
 
18
    return 0;
 
19
 
 
20
  // verify the Xlib has matching XKB extension
 
21
  int major = XkbMajorVersion;
 
22
  int minor = XkbMinorVersion;
 
23
  if (!XkbLibraryVersion(&major, &minor))
 
24
    {
 
25
      kError() << "Xlib XKB extension does not match" << endl;
 
26
      return 1;
 
27
    }
 
28
  kDebug() << "Xlib XKB extension major=" << major << " minor=" << minor;
 
29
 
 
30
  // we need an application object for QX11Info
 
31
  KAccessApp app;
 
32
 
 
33
  // verify the X server has matching XKB extension
 
34
  // if yes, the XKB extension is initialized
 
35
  int opcode_rtrn;
 
36
  int error_rtrn;
 
37
  int xkb_opcode;
 
38
  if (!XkbQueryExtension(QX11Info::display(), &opcode_rtrn, &xkb_opcode, &error_rtrn,
 
39
                         &major, &minor))
 
40
    {
 
41
      kError() << "X server has not matching XKB extension" << endl;
 
42
      return 1;
 
43
    }
 
44
  kDebug() << "X server XKB extension major=" << major << " minor=" << minor;
 
45
 
 
46
  //Without that, the application dies when the dialog is closed only once.
 
47
  app.setQuitOnLastWindowClosed(false);
 
48
  
 
49
  app.setXkbOpcode(xkb_opcode);
 
50
  app.disableSessionManagement();
 
51
  return app.exec();
 
52
}