diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
commit | e38d2351b83fa65c66ccde443777647ef5cb6cff (patch) | |
tree | 1897fc20e9f73a81c520a5b9f76f8ed042124883 /src/newstuff/manager.h | |
download | tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip |
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/newstuff/manager.h')
-rw-r--r-- | src/newstuff/manager.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/src/newstuff/manager.h b/src/newstuff/manager.h new file mode 100644 index 0000000..4102be3 --- /dev/null +++ b/src/newstuff/manager.h @@ -0,0 +1,101 @@ +/*************************************************************************** + copyright : (C) 2006 by Robby Stephenson + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#ifndef TELLICO_NEWSTUFF_MANAGER_H +#define TELLICO_NEWSTUFF_MANAGER_H + +class KArchiveDirectory; +class KURL; +class KTempFile; + +#include <qobject.h> +#include <qptrlist.h> + +class QStringList; + +namespace KNS { + class Entry; +} +namespace KIO { + class Job; +} + +namespace Tellico { + namespace NewStuff { + +class NewScript; + +enum DataType { + EntryTemplate, + DataScript +}; + +enum InstallStatus { + NotInstalled, + OldVersion, + Current +}; + +struct DataSourceInfo { + DataSourceInfo() : isUpdate(false) {} + QString specFile; // full path of .spec file + QString sourceName; + QString sourceExec; // full executable path of script + bool isUpdate : 1; // whether the info is for an updated source +}; + +class Manager : public QObject { +Q_OBJECT + +public: + Manager(QObject* parent); + ~Manager(); + + void install(DataType type, KNS::Entry* entry); + QPtrList<DataSourceInfo> dataSourceInfo() const { return m_infoList; } + + bool installTemplate(const KURL& url, const QString& entryName = QString::null); + bool removeTemplate(const QString& name); + + bool installScript(const KURL& url); + bool removeScript(const QString& name); + + static InstallStatus installStatus(KNS::Entry* entry); + static bool checkCommonFile(); + +signals: + void signalInstalled(KNS::Entry* entry); + +private slots: + void slotDownloadJobResult(KIO::Job* job); + void slotInstallFinished(); + +private: + static QStringList archiveFiles(const KArchiveDirectory* dir, + const QString& path = QString::null); + + static QString findXSL(const KArchiveDirectory* dir); + static QString findEXE(const KArchiveDirectory* dir); + + typedef QPair<KNS::Entry*, DataType> EntryPair; + QMap<KIO::Job*, EntryPair> m_jobMap; + QMap<KURL, QString> m_urlNameMap; + QMap<const NewScript*, KNS::Entry*> m_scriptEntryMap; + QPtrList<DataSourceInfo> m_infoList; + KTempFile* m_tempFile; +}; + + } +} + +#endif |