blob: 8b33dd4c8340125b5488bdee697754e25c828a0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/***************************************************************************
copyright : (C) 2006 by Robby Stephenson
email : robby@periapsis.org
***************************************************************************/
/***************************************************************************
* *
* 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 <tqobject.h>
#include <tqptrlist.h>
class TQStringList;
namespace KNS {
class Entry;
}
namespace KIO {
class Job;
}
namespace Tellico {
namespace NewStuff {
class NewScript;
enum DataType {
EntryTemplate,
DataScript
};
enum InstalltqStatus {
NotInstalled,
OldVersion,
Current
};
struct DataSourceInfo {
DataSourceInfo() : isUpdate(false) {}
TQString specFile; // full path of .spec file
TQString sourceName;
TQString sourceExec; // full executable path of script
bool isUpdate : 1; // whether the info is for an updated source
};
class Manager : public TQObject {
Q_OBJECT
TQ_OBJECT
public:
Manager(TQObject* parent);
~Manager();
void install(DataType type, KNS::Entry* entry);
TQPtrList<DataSourceInfo> dataSourceInfo() const { return m_infoList; }
bool installTemplate(const KURL& url, const TQString& entryName = TQString());
bool removeTemplate(const TQString& name);
bool installScript(const KURL& url);
bool removeScript(const TQString& name);
static InstalltqStatus installtqStatus(KNS::Entry* entry);
static bool checkCommonFile();
signals:
void signalInstalled(KNS::Entry* entry);
private slots:
void slotDownloadJobResult(KIO::Job* job);
void slotInstallFinished();
private:
static TQStringList archiveFiles(const KArchiveDirectory* dir,
const TQString& path = TQString());
static TQString findXSL(const KArchiveDirectory* dir);
static TQString findEXE(const KArchiveDirectory* dir);
typedef TQPair<KNS::Entry*, DataType> EntryPair;
TQMap<KIO::Job*, EntryPair> m_jobMap;
TQMap<KURL, TQString> m_urlNameMap;
TQMap<const NewScript*, KNS::Entry*> m_scriptEntryMap;
TQPtrList<DataSourceInfo> m_infoList;
KTempFile* m_tempFile;
};
}
}
#endif
|