• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

kwallet

  • sources
  • kde-4.12
  • kdeutils
  • kwalletmanager
  • src
  • manager
main.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003-2005 George Staikos <staikos@kde.org>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; see the file COPYING. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18  */
19 
20 #include <kaboutdata.h>
21 #include <kcmdlineargs.h>
22 #include <kdebug.h>
23 #include <kglobal.h>
24 #include <klocale.h>
25 #include <kmimetype.h>
26 #include <kstandarddirs.h>
27 #include <kuniqueapplication.h>
28 
29 #include <QFile>
30 #include <QFileInfo>
31 
32 #include "kwalletmanager.h"
33 
34 
35 class MyApp : public KUniqueApplication {
36  public:
37  MyApp() : KUniqueApplication() { KGlobal::ref(); }
38  virtual ~MyApp() {}
39 
40  virtual int newInstance() { return 0; }
41 };
42 
43 int main(int argc, char **argv) {
44  KAboutData about("kwalletmanager", 0, ki18n("KDE Wallet Manager"), "2.0",
45  ki18n("KDE Wallet Management Tool"),
46  KAboutData::License_GPL,
47  ki18n("(c) 2003,2004 George Staikos"), KLocalizedString(),
48  "http://utils.kde.org/projects/kwalletmanager");
49 
50  about.addAuthor(ki18n("Valentin Rusu"), ki18n("Maintainer, user interface refactoring"), "kde@rusu.info");
51  about.addAuthor(ki18n("George Staikos"), ki18n("Original author and former maintainer"), "staikos@kde.org");
52  about.addAuthor(ki18n("Michael Leupold"), ki18n("Developer and former maintainer"), "lemma@confuego.org");
53  about.addAuthor(ki18n("Isaac Clerencia"), ki18n("Developer"), "isaac@warp.es");
54 
55  KCmdLineArgs::init(argc, argv, &about);
56 
57  KCmdLineOptions options;
58  options.add("show", ki18n("Show window on startup"));
59  options.add("kwalletd", ki18n("For use by kwalletd only"));
60  options.add("+name", ki18n("A wallet name"));
61  KCmdLineArgs::addCmdLineOptions(options);
62 
63  if (!KUniqueApplication::start()) {
64  return 0;
65  }
66 
67  MyApp a;
68 
69  KWalletManager wm;
70  wm.setCaption(i18n("KDE Wallet Manager"));
71 
72  KGlobal::dirs()->addResourceType("kwallet", 0, QLatin1String( "share/apps/kwallet" ));
73 
74  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
75 
76  if (args->isSet("show")) {
77  wm.show();
78  }
79 
80  if (args->isSet("kwalletd")) {
81  wm.kwalletdLaunch();
82  }
83 
84  for (int i = 0; i < args->count(); ++i) {
85  QString fn = QFileInfo(args->arg(i)).absoluteFilePath();
86  KMimeType::Ptr ptr;
87  if (QFile::exists(fn) &&
88  (ptr = KMimeType::findByFileContent(fn)) &&
89  ptr->is(QLatin1String( "application/x-kwallet" ))) {
90  wm.openWalletFile(fn);
91  } else {
92  wm.openWallet(args->arg(i));
93  }
94  }
95  args->clear();
96  return a.exec();
97 }
98 
main
int main(int argc, char **argv)
Definition: main.cpp:43
KWalletManager::openWallet
void openWallet(const QString &walletName)
Definition: kwalletmanager.cpp:327
KWalletManager::kwalletdLaunch
void kwalletdLaunch()
Definition: kwalletmanager.cpp:171
KWalletManager::openWalletFile
void openWalletFile(const QString &path)
Definition: kwalletmanager.cpp:234
KWalletManager
Definition: kwalletmanager.h:31
kwalletmanager.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kwallet

Skip menu "kwallet"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal