/*************************************************************************** * Copyright (C) 2005 by Tarek Saidi * * tarek@linux * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include #include //Added by qt3to4: #include #include "pwsafe.h" #include "PwmConfig.h" #include "lib/KdePlugin.h" void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg){ if(argc>1){ int i=1; if(argv[i][0]!='-'){ ArgFile=QString::fromUtf8(argv[i]); i++; } for(i; iload(app->applicationDirPath()+"/../share/keepass/i18n/"+config.Language)){ if(!translator->load(app->applicationDirPath()+"/share/i18n/"+config.Language)){ config.Language="_DEUTSCH_"; QMessageBox::warning(NULL,"Warning", QString("Translation file '%1' could not be loaded.") .arg(config.Language),"OK",0,0,2,1); delete translator; translator=NULL;}} else app->installTranslator(translator); } PwSafe *mainWin = 0; mainWin = new PwSafe(app,ArgFile,&config); app->setMainWidget( mainWin ); mainWin->show(); int ret=app->exec(); if(!config.saveToIni(IniFilename)) QMessageBox::warning(NULL,QObject::tr("Warnung"),QObject::trUtf8("Die Konfigurationsdatei konnte nicht gespeichert werden.Stellen Sie sicher, dass\nSie Schreibrechte im Verzeichnis ~/.keepass besitzen."),QObject::tr("OK"),"","",0.0); delete app; return ret; } /********* KDE ************** #include #include #include #include static const char description[] = I18N_NOOP("A KDE KPart Application"); static const char version[] = "0.1"; static KCmdLineOptions options[] = { // { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, KCmdLineLastOption }; int main(int argc, char **argv) { KAboutData about("Keepass", I18N_NOOP("Keepass"), version, description, KAboutData::License_BSD, "(C) %{YEAR} Tarek Saidi", 0, 0, "tareks@arcor.de"); about.addAuthor( "Tarek Saidi", 0, "tareks@arcor.de" ); KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::addCmdLineOptions( options ); KApplication app; PwSafe *mainWin = 0; if (app.isRestored()) { RESTORE(PwSafe); } else { // no session.. just start up normally KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); /// @todo do something with the command line args here mainWin = new PwSafe(); app.setMainWidget( mainWin ); mainWin->show(); args->clear(); } // mainWin has WDestructiveClose flag by default, so it will delete itself. return app.exec(); } */