blob: 7cf2b14534468096354c85d6dc8709ced3944172 (
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
/***************************************************************************
scripttreeview.h - description
-------------------
begin : Thu Sep 16 2003
copyright : (C) 2003-2004 by Andras Mantia <amantia@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
***************************************************************************/
#ifndef SCRIPTTREEVIEW_H
#define SCRIPTTREEVIEW_H
//own includes
#include "basetreeview.h"
/**
* @short treeview with all in Quanta available scripts.
*
* You can manage and excecute scripts from here.
*
* There are local and global scripts in different branches.
*
* For every script should exist an .info file!
*
* The .info file is an xhtml file with the extention .info and
* must be in one folder together with the script.
*
* Inside of your .info file should be an options tag like this
* example:
*
* <options editor="kmdr-editor" interpreter="kmdr-executor" />
*
* Here is defined which program is used for editing and executing the script.
*
* @author Andras Mantia <amantia@kde.org>
*/
class ScriptTreeView : public BaseTreeView {
Q_OBJECT
public:
ScriptTreeView(QWidget *parent, const char *name = 0L);
~ScriptTreeView();
protected slots:
/**
* displays the RBM
*
*
* @param listView KListView where the event comes from
*
* @param item QListViewItem where the mousepointer is hovering
*
* @param point QPoint coordinates of the event
*
*/
virtual void slotMenu(KListView *listView, QListViewItem *item, const QPoint &point);
/**
* slot of QListView
*
* shows the .info file for the script
*
* @param item the selected QListViewItem
*/
virtual void slotSelectFile(QListViewItem *item);
/**
* slot for the RBM
*
* invokes the editor for a script
*/
void slotEditScript();
/**
* slot for the RBM
*
* opens the script in Quanta
*
* if @ref infoOptionValue can not find the definition of the editor
* in the .info file the script will be opened in Quanta
*/
void slotEditInQuanta();
/**
* slot for the RBM
*
* opens the .info file of the script in Quanta
*/
void slotEditDescription();
/**
* slot for the RBM
*
* excecutes the script
*
* If @ref infoOptionValue can not find the definition of the interpreter
* in the .info file you will get a open-with dialog to choose a program.
*/
void slotRun();
/**
* slot for the RBM
*
* opens an dialog to assign an action to this script
*/
void slotAssignAction();
/**
* slot for the RBM
*
* packs and sends the script as attachment to an email
*/
void slotSendScriptInMail();
/**
* slot for the RBM
*
* packs and uploads the script to the main server
*/
void slotUploadScript();
/**
* slot for the RBM
*
* shows .info file for the script
*
* calls @ref slotSelectFile
*/
void slotProperties();
protected:
/**
* don't need this in the class but it is abstract in the base class
* so I need to implement it
*/
virtual KFileTreeBranch* newBranch(const KURL& url)
{
Q_UNUSED(url)
return 0l;
};
signals:
/**
* emited from @ref slotSelectFile to display the .info file
*/
void openFileInPreview(const KURL&);
/**
* emited from @ref slotAssignAction to open the assignment dialog
*/
void assignActionToScript(const KURL&, const QString&);
/**
* emited to make the script describtion visible
*/
void showPreviewWidget(bool);
/**
* emitted to request downloading of a script from the main server
*/
void downloadScript();
/**
* request to upload the @ref fileName script tarball
*/
void uploadScript(const QString& fileName);
private:
/**
* make the default constructor private to force the use of the other one
*/
ScriptTreeView() { };
/**
* creates the URL of the .info file
*
* @param url URL of the script file
* @param htmlVersion if true returns the HTML version of the file
*
* @return URL of the matching .info file (no check is done if the file exists)
*/
KURL infoFile(const KURL& url, bool htmlVersion = false);
/**
* query options from the .info file
*
* inside of your .info file only the first options tag is located
*
* @param infoURL URL of the .info file
*
* @param optionName name of the option you want to query
*
* @return the value of the option
*/
QString infoOptionValue(const KURL& infoURL, const QString& optionName);
/** Create a script tarball which can be uploaded or sent in email. Returns
* the name of the created file or QString::null if creation has failed.
*/
QString createScriptTarball();
/**
* remember the menu for manipulation
*/
KPopupMenu *m_fileMenu;
KPopupMenu *m_folderMenu;
int m_downloadMenuId;
};
#endif
|