3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
6 Permission to use, copy, modify, and distribute this software
7 and its documentation for any purpose and without fee is hereby
8 granted, provided that the above copyright notice appear in all
9 copies and that both that the copyright notice and this
10 permission notice and warranty disclaimer appear in supporting
11 documentation, and that the name of the author not be used in
12 advertising or publicity pertaining to distribution of the
13 software without specific, written prior permission.
15 The author disclaim all warranties with regard to this
16 software, including all implied warranties of merchantability
17 and fitness. In no event shall the author be liable for any
18 special, indirect or consequential damages or any damages
19 whatsoever resulting from loss of use, data or profits, whether
20 in an action of contract, negligence or other tortious action,
21 arising out of or in connection with the use or performance of
26 #include <kdeversion.h>
27 #include <kuniqueapplication.h>
29 #include <kaboutdata.h>
30 #include <kcmdlineargs.h>
31 #include <kmessagebox.h>
36 #include "passwddlg.h"
39 int main(int argc
, char **argv
)
41 KAboutData
aboutData("kdepasswd", 0, ki18n("KDE passwd"),
42 KDE_VERSION_STRING
, ki18n("Changes a UNIX password."),
43 KAboutData::License_Artistic
, ki18n("Copyright (c) 2000 Geert Jansen"));
44 aboutData
.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
47 KCmdLineArgs::init(argc
, argv
, &aboutData
);
49 KCmdLineOptions options
;
50 options
.add("+[user]", ki18n("Change password of this user"));
51 KCmdLineArgs::addCmdLineOptions(options
);
52 KUniqueApplication::addCmdLineOptions();
55 if (!KUniqueApplication::start()) {
56 kDebug() << "kdepasswd is already running";
60 KUniqueApplication app
;
61 QApplication::setWindowIcon( KIcon( "preferences-desktop-user-password" ) );
65 bool bRoot
= ku
.isSuperUser();
66 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
71 /* You must be able to run "kdepasswd loginName" */
72 if ( !user
.isEmpty() && user
!=KUser().loginName() && !bRoot
)
74 KMessageBox::sorry(0, i18n("You need to be root to change the password of other users."));
81 int result
= KDEpasswd1Dialog::getPassword(oldpass
);
82 if (result
!= KDEpasswd1Dialog::Accepted
)
86 KDEpasswd2Dialog
*dlg
= new KDEpasswd2Dialog(oldpass
, user
.toLocal8Bit());