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 DBMODULE_H 00020 #define DBMODULE_H 00021 00022 #include <QVariant> 00023 #include <QString> 00024 #include <QStringList> 00025 #include <QtGui> 00026 #include <QtSql> 00027 #include <QSqlDatabase> 00028 #include <QSqlQuery> 00029 #include <QMultiHash> 00030 #include <QCache> 00031 00032 #include "kockpitmodule.h" 00033 #include "attributemap.h" 00034 00036 00039 class DBModule: public QObject, public KockpitModule { 00040 00041 Q_OBJECT 00042 Q_INTERFACES(KockpitModule) 00043 00044 public: 00046 DBModule( QObject *parent = 0):QObject(parent){ } 00047 00049 virtual ~DBModule() { } 00050 00052 00057 void connect(const KockpitAuthObj &authobj); 00058 00060 void disconnect(); 00061 00063 00070 void build(QList<KockpitUnitMap*>* kuml, const KockpitBaseObj &baseobj); 00071 00073 00077 bool entryExists(KockpitUnitMap* kunit); 00078 00080 00085 void createEntry(KockpitUnitMap* kunit); 00086 00088 00093 void deleteEntry(KockpitUnitMap* kunit); 00094 00096 00101 void modifyEntry(KockpitUnitMap* kunit); 00102 00103 private: 00105 static QString buildBaseQuery; 00107 static QString createBaseQuery; 00109 static QString deleteBaseQuery; 00111 static QString modifyBaseQuery; 00112 00113 QString conid; 00114 00115 }; 00116 00117 Q_DECLARE_METATYPE(DBModule*); 00118 00119 #endif // DBMODULE_H