00001 /* 00002 * $Id$ 00003 * Kockpit - an Qt application for user/group management on unix based systems. 00004 * 00005 * Copyright (C) 2010 Julian Thome 00006 * 00007 * This program is free software; you can redistribute it and/or modify it under the terms of 00008 * the GNU General Public License as published by the Free Software Foundation; 00009 * either version 3 of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00012 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00013 * See the GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along with this program; 00016 * if not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef KOCKPITMAINWINDOW_H 00020 #define KOCKPITMAINWINDOW_H 00021 00022 #include <QDialog> 00023 #include <QtGui> 00024 #include <QStateMachine> 00025 #include "ui_kockpit_main.h" 00026 #include "kockpitunitmap.h" 00027 #include "kockpitscriptaction.h" 00028 #include "kockpitifaces.h" 00029 #include "kockpitlogin.h" 00030 #include "kockpitvalidator.h" 00031 00032 00034 00037 class KockpitMainWindow : public QMainWindow, public Ui::KockpitMainWindow{ 00038 00039 Q_OBJECT 00040 00041 public: 00043 00048 KockpitMainWindow(QMainWindow *parent = 0); 00049 00051 00054 ~KockpitMainWindow(); 00055 00056 private: 00058 QList<KockpitUnitMap*> kumap; 00060 QList<KockpitUnitMap*> kgmap; 00061 00063 QList<KockpitIface *> plugIns; 00064 00066 KockpitValidator val; 00067 00069 00073 QStateMachine machine; 00074 00076 LDAPModule ldap; 00077 00079 KockpitScriptAction kscript; 00080 00082 00086 KockpitUser* getKockpitUserFromSelection(); 00087 00089 00093 KockpitGroup* getKockpitGroupFromSelection(); 00094 00096 00101 void writeUserPluginChanges(wraddmod mod); 00102 00104 00110 void writeUserPluginChange(KockpitIface &iface, wraddmod mod); 00111 00113 00118 void writeGroupPluginChanges(wraddmod mod); 00119 00121 00127 void writeGroupPluginChange(KockpitIface &iface, wraddmod mod); 00128 00130 00133 void loadPlugins(); 00134 00136 00139 void populatePlugins(); 00140 00142 00146 void highlightItem(QListWidgetItem *item); 00147 00149 00153 void unhighlightItem(QListWidgetItem *item); 00154 00156 00159 void createStatusBar(); 00160 00162 00165 void createActions(); 00166 00168 00171 void createMenus(); 00172 00174 KockpitAuthObj auth; 00175 00177 KockpitBaseObj group; 00178 00180 KockpitBaseObj user; 00181 00183 QLabel *stateLabel; 00184 00186 QListWidgetItem *currentAuthUserItem; 00187 00189 QListWidgetItem *userLastCommited; 00190 00192 QListWidgetItem *groupLastCommited; 00193 00195 QString scriptPath; 00196 00198 QString plugInPath; 00199 00201 QMenu *mainMenu; 00202 00204 QMenu *helpMenu; 00205 00207 QAction *helpAction; 00208 00210 QAction *aboutKockpitAction; 00211 00213 QAction *aboutQtAction; 00214 00216 QAction *exitAction; 00217 00218 private slots: 00219 00221 00225 void authenticate(); 00226 00228 00231 void unauthenticate(); 00232 00234 00237 void showUserAttributes(); 00238 00240 00243 void showGroupAttributes(); 00244 00246 00250 void assignUserAttributes(KockpitUser *kuser); 00251 00253 00257 void assignGroupAttributes(KockpitGroup *kgrp); 00258 00260 00263 void addKockpitUserItem(); 00264 00266 00269 void addKockpitGroupItem(); 00270 00272 00276 void createKockpitUser(QWidget *widget); 00277 00279 00283 void validateKockpitUser(); 00284 00286 00289 void writeKockpitUser(); 00290 00292 00295 void deleteKockpitUser(); 00296 00298 00302 void createKockpitGroup(QWidget *widget); 00303 00305 00309 void validateKockpitGroup(); 00310 00312 00315 void writeKockpitGroup(); 00316 00318 00321 void deleteKockpitGroup(); 00322 00324 00329 bool refreshUserList(); 00330 00332 00337 bool refreshGroupList(); 00338 00340 00345 bool refreshAll(); 00346 00348 00351 void about(); 00352 00354 00357 void showHelp(); 00358 00359 00360 signals: 00362 void kockpitUserValidated(); 00364 void kockpitGroupValidated(); 00366 void newKockpitUserCreated(); 00368 void newKockpitGroupCreated(); 00370 void kockpitUserAuthenticated(); 00372 void kockpitUserUnauthenticated(); 00373 }; 00374 00375 #endif // KOCKPITMAINWINDOW_H