当前位置: 首页>>代码示例>>C++>>正文


C++ CmdLineArgs::startLocked方法代码示例

本文整理汇总了C++中CmdLineArgs::startLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ CmdLineArgs::startLocked方法的具体用法?C++ CmdLineArgs::startLocked怎么用?C++ CmdLineArgs::startLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CmdLineArgs的用法示例。


在下文中一共展示了CmdLineArgs::startLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
		IniFilename=HomeDir+"/config.ini";
	}
	else
		IniFilename=args.configLocation();

#ifdef Q_WS_X11
	{
		QString OldHomeDir = QDir::homePath()+"/.keepassx";
		if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
			QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini");
			if (QDir(OldHomeDir).entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System).count()==0)
				QDir().rmdir(OldHomeDir);
		}
	}
#else
	if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini"))
		QFile::rename(HomeDir+"/config", HomeDir+"/config.ini");
#endif
	config = new KpxConfig(IniFilename);
	fileDlgHistory.load();
	
	// PlugIns
	/*
#ifdef Q_WS_X11
	if(config->integrPlugin()!=KpxConfig::NoIntegr){
		QString LibName="libkeepassx-";
		if(config->integrPlugin()==KpxConfig::KDE)
			LibName+="kde.so";
		else if(config->integrPlugin()==KpxConfig::Gnome)
			LibName+="gnome.so";
		QString filename=findPlugin(LibName);
		if(filename!=QString()){
			QPluginLoader plugin(filename);
			if(!plugin.load()){
				PluginLoadError=plugin.errorString();
				qWarning("Could not load desktop integration plugin:");
				qWarning("%s", CSTR(PluginLoadError));
			}
			else{
				QObject *plugininstance=plugin.instance();
				IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugininstance);
				IconLoader=qobject_cast<IIconTheme*>(plugininstance);
				if(IconLoader==NULL){
					qWarning("Error: Integration Plugin: Could not initialize IconTheme interface.");
				}
				KpxFileDialogs::setPlugin(fdlg);
				if(config->integrPlugin()==KpxConfig::KDE){
					IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance());
					app=kdeinit->getMainAppObject(argc,argv);
					if(!app) PluginLoadError = "Initialization failed.";
				}
				if(config->integrPlugin()==KpxConfig::Gnome){
					IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance());
					if(!ginit->init(argc,argv)){
						KpxFileDialogs::setPlugin(NULL);
						qWarning("GtkIntegrPlugin: Gtk init failed.");
						PluginLoadError = "Initialization failed.";
					}
				}
			}
		}
		else{
			qWarning(CSTR(QString("Could not load desktop integration plugin: File '%1' not found.").arg(LibName)));
			PluginLoadError=QApplication::translate("Main", "Could not locate library file.");
		}
	}
#endif
	*/
	
	DetailViewTemplate=config->detailViewTemplate();

	loadImages();
	KpxBookmarks::load();
	initYarrow(); //init random number generator
	SecString::generateSessionKey();
	
	installTranslator();

#ifdef Q_WS_MAC
	QApplication::processEvents();
	if (args.file().isEmpty() && !eventListener->file().isEmpty()) {
		args.setFile(eventListener->file());
	}
#endif

	KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked());
#ifdef Q_WS_MAC
	eventListener->setMainWin(mainWin);
#endif

	int r=app->exec();
	delete mainWin;
	delete eventListener;

	fileDlgHistory.save();
	SecString::deleteSessionKey();
	delete app;
	delete config;
	return r;
}
开发者ID:Davenport-Physics,项目名称:keepassx-classic,代码行数:101,代码来源:main.cpp

示例2: main


//.........这里部分代码省略.........
                IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugininstance);
                IconLoader=qobject_cast<IIconTheme*>(plugininstance);
                if(IconLoader==NULL) {
                    qWarning("Error: Integration Plugin: Could not initialize IconTheme interface.");
                }
                KpxFileDialogs::setPlugin(fdlg);
                if(config->integrPlugin()==KpxConfig::KDE) {
                    IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance());
                    app=kdeinit->getMainAppObject(argc,argv);
                    if(!app)PluginLoadError=QObject::tr("Initialization failed.");
                }
                if(config->integrPlugin()==KpxConfig::Gnome) {
                    IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance());
                    if(!ginit->init(argc,argv)) {
                        KpxFileDialogs::setPlugin(NULL);
                        qWarning("GtkIntegrPlugin: Gtk init failed.");
                        PluginLoadError=QObject::tr("Initialization failed.");
                    }
                }
            }
        }
        else {
            qWarning(CSTR(QString("Could not load desktop integration plugin: File '%1' not found.").arg(LibName)));
            PluginLoadError=QObject::tr("Could not locate library file.");
        }
    }
    if(!app) {
#if defined(Q_WS_X11) && defined(GLOBAL_AUTOTYPE)
        app = new KeepassApplication(argc,argv);
#else
        app = new QApplication(argc,argv);
#endif
    }
    args.parse(QApplication::arguments());


    //Internationalization
    QLocale loc;
    if(!args.language().size())
        loc=QLocale::system();
    else
        loc=QLocale(args.language());

    QTranslator* translator = NULL;
    QTranslator* qtTranslator=NULL;
    translator=new QTranslator;
    qtTranslator=new QTranslator;

    if(loadTranslation(translator,"keepass-",loc.name(),QStringList()
                       << DataDir+"/i18n/"
                       << HomeDir))
    {
        app->installTranslator(translator);
        TrActive=true;
    }
    else {
        if(loc.name()!="en_US")
            qWarning(QString("Kpx: No Translation found for '%1 (%2)' using 'English (UnitedStates)'")
                     .arg(QLocale::languageToString(loc.language()))
                     .arg(QLocale::countryToString(loc.country())).toAscii());
        delete translator;
        TrActive=false;
    }

    if(TrActive) {
        if(loadTranslation(qtTranslator,"qt_",loc.name(),QStringList()
                           << QLibraryInfo::location(QLibraryInfo::TranslationsPath)
                           << DataDir+"/i18n/"
                           << HomeDir))
            app->installTranslator(qtTranslator);
        else {
            if(loc.name()!="en_US")
                qWarning(QString("Qt: No Translation found for '%1 (%2)' using 'English (UnitedStates)'")
                         .arg(QLocale::languageToString(loc.language()))
                         .arg(QLocale::countryToString(loc.country())).toAscii());
            delete qtTranslator;
        }
    }

    DetailViewTemplate=config->detailViewTemplate();

    loadImages();
    KpxBookmarks::load();
    initYarrow(); //init random number generator
    SecString::generateSessionKey();

    eventListener = new EventListener();
    app->installEventFilter(eventListener);

    QApplication::setQuitOnLastWindowClosed(false);
    KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked());
    int r=app->exec();
    delete mainWin;
    delete eventListener;

    fileDlgHistory.save();
    delete app;
    delete config;
    return r;
}
开发者ID:zarmin,项目名称:KeePassX_zmod,代码行数:101,代码来源:main.cpp


注:本文中的CmdLineArgs::startLocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。