Ejemplo n.º 1
0
int main( int argc, char **argv )
{
    AboutData aboutData;
    KCmdLineArgs::init(argc, argv, &aboutData);

#ifdef KJOTSKONTACTPLUGIN
    KontactInterface::PimUniqueApplication::addCmdLineOptions();
    if (!KontactInterface::PimUniqueApplication::start()) {
        kWarning() << "kjots is already running!";
        exit(0);
    }
    KontactInterface::PimUniqueApplication a;
#else
    
    KUniqueApplication::addCmdLineOptions();
    if (!KUniqueApplication::start()) {
        kWarning() << "kjots is already running!";
        exit(0);
    }
    KUniqueApplication a;
#endif


    // backwards compatibility code to convert "old" user font settings
    // to the new config settings
    KConfigGroup config(KGlobal::config(), "kjots");
    if (config.hasKey("EFontFamily")) {
      // read old font and create it
      QFont font( config.readEntry("EFontFamily"),
                  config.readEntry("EFontSize", 12),
                  config.readEntry("EFontWeight", 0),
                  config.readEntry("EFontItalic", 0));
      // delete old entries
      config.deleteEntry("EFontFamily");
      config.deleteEntry("EFontSize");
      config.deleteEntry("EFontWeight");
      config.deleteEntry("EFontItalic");
      config.deleteEntry("EFontCharset");
      // write new "converted" entry
      config.writeEntry("Font", font);
    }

    KJotsMain *jots = new KJotsMain;
    if( a.isSessionRestored() ) {
        if( KJotsMain::canBeRestored(1) ) {
            jots->restore(1);
        }
    }

    jots->show();
    jots->resize(jots->size());
    return a.exec();
}
Ejemplo n.º 2
0
Archivo: main.cpp Proyecto: KDE/kjots
int main(int argc, char **argv)
{
    AboutData aboutData;
    KontactInterface::PimUniqueApplication app(argc, &argv);
    KLocalizedString::setApplicationDomain("kjots");
    app.setAboutData(aboutData);

    QCommandLineParser *cmdArgs = app.cmdArgs();
    const QStringList args = QApplication::arguments();
    cmdArgs->process(args);
    aboutData.processCommandLine(cmdArgs);

    if (!KontactInterface::PimUniqueApplication::start(args)) {
        qWarning() << "kjots is already running!";
        exit(0);
    }

    // backwards compatibility code to convert "old" user font settings
    // to the new config settings
    KConfigGroup config(KSharedConfig::openConfig(), "kjots");
    if (config.hasKey("EFontFamily")) {
        // read old font and create it
        QFont font(config.readEntry("EFontFamily"),
                   config.readEntry("EFontSize", 12),
                   config.readEntry("EFontWeight", 0),
                   config.readEntry("EFontItalic", 0));
        // delete old entries
        config.deleteEntry("EFontFamily");
        config.deleteEntry("EFontSize");
        config.deleteEntry("EFontWeight");
        config.deleteEntry("EFontItalic");
        config.deleteEntry("EFontCharset");
        // write new "converted" entry
        config.writeEntry("Font", font);
    }

    KJotsMain *jots = new KJotsMain;
    if (app.isSessionRestored()) {
        if (KJotsMain::canBeRestored(1)) {
            jots->restore(1);
        }
    }

    jots->show();
    jots->resize(jots->size());
    return app.exec();
}