kexi

kexipartmanager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2003-2005 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIPARTMANAGER_H
00022 #define KEXIPARTMANAGER_H
00023 
00024 #include <qobject.h>
00025 #include <qdict.h>
00026 #include <qasciidict.h>
00027 #include <qintdict.h>
00028 #include <qvaluelist.h>
00029 #include <qptrlist.h>
00030 
00031 #include <kservice.h>
00032 
00033 #include <kexidb/object.h>
00034 
00035 //#include "kexipartdatasource.h"
00036 
00037 namespace KexiDB
00038 {
00039     class Connection;
00040 }
00041 
00042 namespace KexiPart
00043 {
00044     class Info;
00045     class Part;
00046     class StaticPart;
00047 
00048     struct Missing
00049     {
00050         QString name;
00051         QCString mime;
00052         QString url;
00053     };
00054 
00055     typedef QAsciiDict<Info> PartInfoDict;
00056     typedef QDictIterator<Info> PartInfoDictIterator;
00057     typedef QValueList<Missing> MissingList;
00058     typedef QPtrList<Info> PartInfoList;
00059     typedef QPtrListIterator<Info> PartInfoListIterator;
00060     typedef QIntDict<Part> PartDict;
00061 //  typedef QPtrList<DataSource> DataSourceList;
00062 
00068 class KEXICORE_EXPORT Manager : public QObject, public KexiDB::Object
00069 {
00070     Q_OBJECT
00071 
00072     public:
00076         Manager(QObject *parent = 0);
00077         ~Manager();
00078 
00082         void lookup();
00083 
00088         Part *partForMimeType(const QString& mimeTypt);
00089 
00094         Part *part(Info *);
00095 
00099         Info *infoForMimeType(const QString& mimeType);
00100 
00107         bool checkProject(KexiDB::Connection *conn);
00108 
00112         MissingList missingParts() const { return m_missing; }
00113 
00114 
00118         PartInfoList *partInfoList() { return &m_partlist; }
00119 
00120     signals:
00121         void partLoaded(KexiPart::Part*);
00122 
00123     protected:
00125         void insertStaticPart(KexiPart::StaticPart* part);
00126 
00127     private:
00128         PartDict m_parts;
00129         PartInfoList m_partlist;
00130         PartInfoDict m_partsByMime;
00131         MissingList m_missing;
00132         int m_nextTempProjectPartID;
00133         bool m_lookupDone : 1;
00134 
00135         friend class StaticPart;
00136 };
00137 
00138 }
00139 
00140 #endif
00141 
KDE Home | KDE Accessibility Home | Description of Access Keys