• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Kross

  • kross
  • ui
view.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * view.cpp
3 * This file is part of the KDE project
4 * copyright (c) 2005-2006 Cyrille Berger <cberger@cberger.net>
5 * copyright (C) 2006-2007 Sebastian Sauer <mail@dipe.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this program; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 ***************************************************************************/
20
21#include "view.h"
22#include "model.h"
23
24#include <kross/core/manager.h>
25#include <kross/core/action.h>
26#include <kross/core/actioncollection.h>
27#include <kross/core/interpreter.h>
28
29#include <QtCore/QFileInfo>
30#include <QtCore/QDir>
31#include <QtGui/QBoxLayout>
32#include <QtGui/QHeaderView>
33#include <QtGui/QTreeView>
34#include <QtGui/QLabel>
35
36#include <kapplication.h>
37//#include <kdeversion.h>
38#include <kconfig.h>
39#include <kstandarddirs.h>
40#include <kmessagebox.h>
41#include <kpushbutton.h>
42#include <kfiledialog.h>
43#include <kmenu.h>
44#include <kpagedialog.h>
45#include <kaction.h>
46#include <kactioncollection.h>
47#include <kcombobox.h>
48#include <kicondialog.h>
49#include <klocale.h>
50#include <klineedit.h>
51#include <kurlrequester.h>
52
53//#include <ktar.h>
54//#include <kio/netaccess.h>
55
56using namespace Kross;
57
58/*********************************************************************************
59 * ActionCollectionEditor
60 */
61
62namespace Kross {
63
65 class ActionCollectionEditor::Private
66 {
67 public:
68 enum Type { ActionType, CollectionType };
69 const Type type;
70 union {
71 Action* action;
72 ActionCollection* collection;
73 };
74
75 QString name() const {
76 return type == ActionType ? action->name() : collection->name();
77 }
78 QString text() const {
79 return type == ActionType ? action->text() : collection->text();
80 }
81 QString description() const {
82 return type == ActionType ? action->description() : collection->description();
83 }
84 QString iconName() const {
85 return type == ActionType ? action->iconName() : collection->iconName();
86 }
87 bool isEnabled() const {
88 return type == ActionType ? action->isEnabled() : collection->isEnabled();
89 }
90
91 KLineEdit* nameedit;
92 KLineEdit* textedit;
93 KLineEdit* commentedit;
94 KLineEdit* iconedit;
95 KComboBox* interpreteredit;
96 KUrlRequester* fileedit;
97 //QCheckBox* enabledcheckbox;
98
99 explicit Private(Action* a) : type(ActionType), action(a) { Q_ASSERT(a); }
100 explicit Private(ActionCollection* c) : type(CollectionType), collection(c) { Q_ASSERT(c); }
101 };
102
103}
104
105ActionCollectionEditor::ActionCollectionEditor(Action* action, QWidget* parent)
106 : QWidget(parent), d(new Private(action))
107{
108 initGui();
109}
110
111ActionCollectionEditor::ActionCollectionEditor(ActionCollection* collection, QWidget* parent)
112 : QWidget(parent), d(new Private(collection))
113{
114 initGui();
115}
116
117ActionCollectionEditor::~ActionCollectionEditor()
118{
119 delete d;
120}
121
122Action* ActionCollectionEditor::action() const
123{
124 return d->type == Private::ActionType ? d->action : 0;
125}
126
127ActionCollection* ActionCollectionEditor::collection() const
128{
129 return d->type == Private::CollectionType ? d->collection : 0;
130}
131
132QLineEdit* ActionCollectionEditor::nameEdit() const { return d->nameedit; }
133QLineEdit* ActionCollectionEditor::textEdit() const { return d->textedit; }
134QLineEdit* ActionCollectionEditor::commentEdit() const { return d->commentedit; }
135QLineEdit* ActionCollectionEditor::iconEdit() const { return d->iconedit; }
136QComboBox* ActionCollectionEditor::interpreterEdit() const { return d->interpreteredit; }
137KUrlRequester* ActionCollectionEditor::fileEdit() const { return d->fileedit; }
138
139void ActionCollectionEditor::initGui()
140{
141 QVBoxLayout* mainlayout = new QVBoxLayout();
142 setLayout(mainlayout);
143
144 QWidget* w = new QWidget(this);
145 mainlayout->addWidget(w);
146 QGridLayout* gridlayout = new QGridLayout();
147 gridlayout->setMargin(0);
148 //gridlayout->setSpacing(0);
149 w->setLayout(gridlayout);
150
151 QLabel* namelabel = new QLabel(i18n("Name:"), w);
152 gridlayout->addWidget(namelabel, 0, 0);
153 d->nameedit = new KLineEdit(w);
154 namelabel->setBuddy(d->nameedit);
155 d->nameedit->setText( d->name() );
156 d->nameedit->setEnabled(false);
157 gridlayout->addWidget(d->nameedit, 0, 1);
158
159 QLabel* textlabel = new QLabel(i18n("Text:"), w);
160 gridlayout->addWidget(textlabel, 1, 0);
161 d->textedit = new KLineEdit(w);
162 textlabel->setBuddy(d->textedit);
163 d->textedit->setText( d->text() );
164 gridlayout->addWidget(d->textedit, 1, 1);
165
166 QLabel* commentlabel = new QLabel(i18n("Comment:"), w);
167 gridlayout->addWidget(commentlabel, 2, 0);
168 d->commentedit = new KLineEdit(w);
169 commentlabel->setBuddy(d->commentedit);
170 d->commentedit->setText( d->description() );
171 gridlayout->addWidget(d->commentedit, 2, 1);
172
173 QLabel* iconlabel = new QLabel(i18n("Icon:"), w);
174 gridlayout->addWidget(iconlabel, 3, 0);
175 QWidget* iconbox = new QWidget(w);
176 QHBoxLayout* iconlayout = new QHBoxLayout();
177 iconlayout->setMargin(0);
178 iconbox->setLayout(iconlayout);
179 d->iconedit = new KLineEdit(iconbox);
180 iconlabel->setBuddy(d->iconedit);
181 d->iconedit->setText( d->iconName() );
182 iconlayout->addWidget(d->iconedit, 1);
183 KIconButton* iconbutton = new KIconButton(iconbox);
184 iconbutton->setIcon( d->iconName() );
185 connect(iconbutton, SIGNAL(iconChanged(QString)), d->iconedit, SLOT(setText(QString)));
186 iconlayout->addWidget(iconbutton);
187 gridlayout->addWidget(iconbox, 3, 1);
188
189 //QFrame* hr1 = new QFrame(w);
190 //hr1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
191 //gridlayout->addWidget(hr1, 4, 0, -1, -1, Qt::AlignVCenter);
192
193 if( d->type == Private::ActionType ) {
194 QLabel* interpreterlabel = new QLabel(i18n("Interpreter:"), w);
195 gridlayout->addWidget(interpreterlabel, 4, 0);
196 d->interpreteredit = new KComboBox(w);
197 interpreterlabel->setBuddy(d->interpreteredit);
198 d->interpreteredit->setMaxVisibleItems(10);
199 d->interpreteredit->insertItems(0, Manager::self().interpreters());
200 d->interpreteredit->setEditable(true);
201 //c->lineEdit()->setText( d->action->interpreter() );
202 int idx = Manager::self().interpreters().indexOf( d->action->interpreter() );
203 if( idx >= 0 )
204 d->interpreteredit->setCurrentIndex(idx);
205 else
206 d->interpreteredit->setEditText( d->action->interpreter() );
207 gridlayout->addWidget(d->interpreteredit, 4, 1);
208
209 QLabel* filelabel = new QLabel(i18n("File:"), w);
210 gridlayout->addWidget(filelabel, 5, 0);
211 d->fileedit = new KUrlRequester(w);
212 filelabel->setBuddy(d->fileedit);
213 QStringList mimetypes;
214 foreach(const QString &interpretername, Manager::self().interpreters()) {
215 InterpreterInfo* info = Manager::self().interpreterInfo(interpretername);
216 Q_ASSERT( info );
217 mimetypes.append( info->mimeTypes().join(" ").trimmed() );
218 }
219 //InterpreterInfo* info = Manager::self().interpreterInfo( Manager::self().interpreternameForFile( d->action->file() ) );
220 //const QString defaultmime = info ? info->mimeTypes().join(" ").trimmed() : QString();
221 d->fileedit->fileDialog()->setMimeFilter(mimetypes /*, defaultmime*/);
222 d->fileedit->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
223 d->fileedit->setUrl(KUrl(d->action->file()) );
224 gridlayout->addWidget(d->fileedit, 5, 1);
225 }
226 else {
227 d->interpreteredit = 0;
228 d->fileedit = 0;
229 }
230
231 //d->enabledcheckbox = new QCheckBox(this);
232 //d->enabledcheckbox->setText( i18n("Enabled") );
233 //d->enabledcheckbox->setChecked( d->isEnabled() );
234 //mainlayout->addWidget(d->enabledcheckbox);
235
236 mainlayout->addStretch(1);
237}
238
239bool ActionCollectionEditor::isValid()
240{
241 //TODO check also if such a name already exist.
242 return ! d->nameedit->text().isEmpty();
243}
244
245void ActionCollectionEditor::commit()
246{
247 switch( d->type ) {
248 case Private::ActionType: {
249 d->action->setText( d->textedit->text() );
250 d->action->setDescription( d->commentedit->text() );
251 d->action->setIconName( d->iconedit->text() );
252 d->action->setInterpreter( d->interpreteredit->currentText() );
253 d->action->setFile( d->fileedit->url().path() );
254 //d->action->setEnabled( d->enabledcheckbox->isChecked() );
255 } break;
256 case Private::CollectionType: {
257 d->collection->setText( d->textedit->text() );
258 d->collection->setDescription( d->commentedit->text() );
259 d->collection->setIconName( d->iconedit->text() );
260 //d->collection->setEnabled( d->enabledcheckbox->isChecked() );
261 } break;
262 default: break;
263 }
264}
265
266/*********************************************************************************
267 * ActionCollectionView
268 */
269
270namespace Kross {
271
273 class ActionCollectionView::Private
274 {
275 public:
276 bool modified;
277 KActionCollection* collection;
278 QMap< QString, KPushButton* > buttons;
279 explicit Private() : modified(false) {}
280 };
281
282}
283
284ActionCollectionView::ActionCollectionView(QWidget* parent)
285 : QTreeView(parent)
286 , d(new Private())
287{
288 header()->hide();
289 setSelectionMode(QAbstractItemView::SingleSelection);
290 setAlternatingRowColors(true);
291 setRootIsDecorated(true);
292 setSortingEnabled(false);
293 setItemsExpandable(true);
294 //setDragEnabled(true);
295 //setAcceptDrops(true);
296 setDropIndicatorShown(true);
297 setDragDropMode(QAbstractItemView::InternalMove);
298
299 d->collection = new KActionCollection(this);
300
301 KAction* runaction = new KAction(KIcon("system-run"), i18n("Run"), this);
302 runaction->setObjectName("run");
303 runaction->setToolTip( i18n("Execute the selected script.") );
304 runaction->setEnabled(false);
305 d->collection->addAction("run", runaction);
306 connect(runaction, SIGNAL(triggered()), this, SLOT(slotRun()));
307
308 KAction* stopaction = new KAction(KIcon("process-stop"), i18n("Stop"), this);
309 stopaction->setObjectName("stop");
310 stopaction->setToolTip( i18n("Stop execution of the selected script.") );
311 stopaction->setEnabled(false);
312 d->collection->addAction("stop", stopaction);
313 connect(stopaction, SIGNAL(triggered()), this, SLOT(slotStop()));
314
315 KAction* editaction = new KAction(KIcon("document-properties"), i18n("Edit..."), this);
316 editaction->setObjectName("edit");
317 editaction->setToolTip( i18n("Edit selected script.") );
318 editaction->setEnabled(false);
319 d->collection->addAction("edit", editaction);
320 connect(editaction, SIGNAL(triggered()), this, SLOT(slotEdit()));
321
322 KAction* addaction = new KAction(KIcon("list-add"), i18n("Add..."), this);
323 addaction->setObjectName("add");
324 addaction->setToolTip( i18n("Add a new script.") );
325 //addaction->setEnabled(false);
326 d->collection->addAction("add", addaction);
327 connect(addaction, SIGNAL(triggered()), this, SLOT(slotAdd()) );
328
329 KAction* removeaction = new KAction(KIcon("list-remove"), i18n("Remove"), this);
330 removeaction->setObjectName("remove");
331 removeaction->setToolTip( i18n("Remove selected script.") );
332 removeaction->setEnabled(false);
333 d->collection->addAction("remove", removeaction);
334 connect(removeaction, SIGNAL(triggered()), this, SLOT(slotRemove()) );
335
336 connect(this, SIGNAL(enabledChanged(QString)), this, SLOT(slotEnabledChanged(QString)));
337 //expandAll();
338}
339
340ActionCollectionView::~ActionCollectionView()
341{
342 delete d;
343}
344
345void ActionCollectionView::setModel(QAbstractItemModel* m)
346{
347 QTreeView::setModel(m);
348 d->modified = false;
349
350 QItemSelectionModel* selectionmodel = new QItemSelectionModel(m, this);
351 setSelectionModel(selectionmodel);
352
353 connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
354 this, SLOT(slotSelectionChanged()));
355 connect(m, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
356 this, SLOT(slotDataChanged(QModelIndex,QModelIndex)));
357}
358
359bool ActionCollectionView::isModified() const
360{
361 return d->modified;
362}
363
364void ActionCollectionView::setModified(bool modified)
365{
366 d->modified = modified;
367}
368
369KActionCollection* ActionCollectionView::actionCollection() const
370{
371 return d->collection;
372}
373
374KPushButton* ActionCollectionView::button(const QString& actionname) const
375{
376 return d->buttons.contains(actionname) ? d->buttons[actionname] : 0;
377}
378
379QItemSelection ActionCollectionView::itemSelection() const
380{
381 QAbstractProxyModel* proxymodel = dynamic_cast< QAbstractProxyModel* >( model() );
382 QItemSelection selection = selectionModel()->selection();
383 return proxymodel ? proxymodel->mapSelectionToSource(selection) : selection;
384}
385
386KPushButton* ActionCollectionView::createButton(QWidget* parentWidget, const QString& actionname)
387{
388 QAction* action = d->collection->action(actionname);
389 if( ! action ) return 0;
390 //if( d->buttons.contains(actionname) ) delete d->buttons[];
391 KPushButton* btn = new KPushButton(parentWidget);
392 btn->setText( action->text() );
393 btn->setToolTip( action->toolTip() );
394 btn->setIcon( KIcon(action->icon()) );
395 btn->setEnabled( action->isEnabled() );
396 if( parentWidget && parentWidget->layout() )
397 parentWidget->layout()->addWidget(btn);
398 QObject::connect(btn, SIGNAL(clicked()), action, SLOT(trigger()));
399 d->buttons.insert( actionname, btn );
400 return btn;
401}
402
403void ActionCollectionView::slotEnabledChanged(const QString& actionname)
404{
405 if( d->buttons.contains( actionname ) ) {
406 QAction* action = d->collection->action( actionname );
407 d->buttons[ actionname ]->setEnabled( action ? action->isEnabled() : false );
408 }
409}
410
411void ActionCollectionView::slotSelectionChanged()
412{
413 bool startenabled = selectionModel()->hasSelection();
414 bool stopenabled = false;
415 bool hasselection = selectionModel()->selectedIndexes().count() > 0;
416 foreach(const QModelIndex &index, itemSelection().indexes()) {
417 Action* action = ActionCollectionModel::action(index);
418 if( startenabled && ! action )
419 startenabled = false;
420 if( ! stopenabled )
421 stopenabled = (action && ! action->isFinalized());
422 }
423 QAction* runaction = d->collection->action("run");
424 if( runaction ) {
425 runaction->setEnabled(startenabled);
426 emit enabledChanged("run");
427 }
428 QAction* stopaction = d->collection->action("stop");
429 if( stopaction ) {
430 stopaction->setEnabled(stopenabled);
431 emit enabledChanged("stop");
432 }
433 QAction* editaction = d->collection->action("edit");
434 if( editaction ) {
435 editaction->setEnabled(hasselection);
436 emit enabledChanged("edit");
437 }
438 QAction* removeaction = d->collection->action("remove");
439 if( removeaction ) {
440 removeaction->setEnabled(hasselection);
441 emit enabledChanged("remove");
442 }
443}
444
445void ActionCollectionView::slotDataChanged(const QModelIndex&, const QModelIndex&)
446{
447 d->modified = true;
448}
449
450void ActionCollectionView::slotRun()
451{
452 if( ! selectionModel() ) return;
453 QAction* stopaction = d->collection->action("stop");
454
455 foreach(const QModelIndex &index, itemSelection().indexes()) {
456 if( ! index.isValid() )
457 continue;
458 if( stopaction ) {
459 stopaction->setEnabled(true);
460 emit enabledChanged("stop");
461 }
462 Action* action = ActionCollectionModel::action(index);
463 if( ! action )
464 continue;
465 connect(action, SIGNAL(finished(Kross::Action*)), SLOT(slotSelectionChanged()));
466 action->trigger();
467 }
468 slotSelectionChanged();
469}
470
471void ActionCollectionView::slotStop()
472{
473 if( ! selectionModel() ) return;
474 foreach(const QModelIndex &index, itemSelection().indexes()) {
475 if( ! index.isValid() )
476 continue;
477 Action* action = ActionCollectionModel::action(index);
478 if( ! action )
479 continue;
480 //connect(action, SIGNAL(started(Kross::Action*)), SLOT(slotSelectionChanged()));
481 //connect(action, SIGNAL(finished(Kross::Action*)), SLOT(slotSelectionChanged()));
482 action->finalize();
483 }
484 slotSelectionChanged();
485}
486
487void ActionCollectionView::slotEdit()
488{
489 if( ! selectionModel() ) return;
490 Action* action = 0;
491 ActionCollection* collection = 0;
492 foreach(const QModelIndex &index, itemSelection().indexes()) {
493 if( ! index.isValid() ) continue;
494 if( Action* a = ActionCollectionModel::action(index) )
495 action = a;
496 else if( ActionCollection* c = ActionCollectionModel::collection(index) )
497 collection = c;
498 else
499 continue;
500 break;
501 }
502 if( (! action) && (! collection) ) return;
503 KPageDialog* dialog = new KPageDialog( this );
504 dialog->setCaption( i18n("Edit") );
505 dialog->setButtons( KDialog::Ok | KDialog::Cancel );
506 //dialog->enableButtonOk( false );
507 dialog->setFaceType( KPageDialog::Plain ); //Auto Plain List Tree Tabbed
508 ActionCollectionEditor* editor =
509 action ? new ActionCollectionEditor(action, dialog->mainWidget())
510 : new ActionCollectionEditor(collection, dialog->mainWidget());
511 dialog->addPage(editor, i18nc("@title:group Script properties", "General"));
512 //dialog->addPage(new QWidget(this), i18n("Security"));
513 dialog->resize( QSize(580, 200).expandedTo( dialog->minimumSizeHint() ) );
514 int result = dialog->exec();
515 if( result == QDialog::Accepted /*&& dialog->result() == KDialog::Ok*/ ) {
516 editor->commit();
517 }
518 dialog->delayedDestruct();
519}
520
521void ActionCollectionView::slotAdd()
522{
523
524//TODO
525KMessageBox::sorry(0, "TODO");
526
527//ScriptManagerAddWizard wizard(this, collection);
528//int result = wizard.exec();
529
530#if 0
531 if( ! selectionModel() ) return;
532 ActionCollection* collection = 0;
533 foreach(QModelIndex index, itemSelection().indexes()) {
534 if( ! index.isValid() ) continue;
535 if( ActionCollectionModel::action(index) ) {
536 //TODO propably add the item right after the current selected one?
537 QModelIndex parent = index;
538 while( parent.isValid() && ! collection ) {
539 parent = d->view->model()->parent(parent);
540 collection = ActionCollectionModel::collection(parent);
541 }
542 if( collection ) break; // job done
543 }
544 else if( ActionCollection* c = ActionCollectionModel::collection(index) ) {
545 collection = c;
546 break; // job done
547 }
548 }
549 ScriptManagerAddWizard wizard(this, collection);
550 int result = wizard.exec();
551 Q_UNUSED(result);
552#endif
553}
554
555void ActionCollectionView::slotRemove()
556{
557 if( ! selectionModel() ) return;
558 KMessageBox::sorry(0, "TODO");
559}
560
561#include "view.moc"
action.h
actioncollection.h
KActionCollection
KAction
KComboBox
KDialog::minimumSizeHint
virtual QSize minimumSizeHint() const
KDialog::mainWidget
QWidget * mainWidget()
KDialog::setButtons
void setButtons(ButtonCodes buttonMask)
KDialog::Ok
Ok
KDialog::Cancel
Cancel
KDialog::delayedDestruct
void delayedDestruct()
KDialog::setCaption
virtual void setCaption(const QString &caption)
KIcon
KLineEdit
KMessageBox::sorry
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
KPageDialog
KPageDialog::Plain
Plain
KPageDialog::setFaceType
void setFaceType(FaceType faceType)
KPageDialog::addPage
void addPage(KPageWidgetItem *item)
KPushButton
KPushButton::setIcon
void setIcon(const KIcon &icon)
KPushButton::setText
void setText(const QString &text)
KUrl
Kross::ActionCollectionEditor
The ActionCollectionEditor class implements a general editor for Action and ActionCollection instance...
Definition: view.h:66
Kross::ActionCollectionEditor::ActionCollectionEditor
ActionCollectionEditor(Action *action, QWidget *parent=0)
Constructor.
Definition: view.cpp:105
Kross::ActionCollectionEditor::interpreterEdit
QComboBox * interpreterEdit() const
Definition: view.cpp:136
Kross::ActionCollectionEditor::isValid
virtual bool isValid()
Definition: view.cpp:239
Kross::ActionCollectionEditor::commit
virtual void commit()
This method got called if the changes done in the editor should be saved aka committed to the Action ...
Definition: view.cpp:245
Kross::ActionCollectionEditor::commentEdit
QLineEdit * commentEdit() const
Definition: view.cpp:134
Kross::ActionCollectionEditor::action
Action * action() const
Definition: view.cpp:122
Kross::ActionCollectionEditor::fileEdit
KUrlRequester * fileEdit() const
Definition: view.cpp:137
Kross::ActionCollectionEditor::~ActionCollectionEditor
virtual ~ActionCollectionEditor()
Destructor.
Definition: view.cpp:117
Kross::ActionCollectionEditor::nameEdit
QLineEdit * nameEdit() const
Following getters are providing access to the edit-widgets once the initGui() was called by the const...
Definition: view.cpp:132
Kross::ActionCollectionEditor::collection
ActionCollection * collection() const
Definition: view.cpp:127
Kross::ActionCollectionEditor::iconEdit
QLineEdit * iconEdit() const
Definition: view.cpp:135
Kross::ActionCollectionEditor::initGui
virtual void initGui()
Initialize the GUI.
Definition: view.cpp:139
Kross::ActionCollectionEditor::textEdit
QLineEdit * textEdit() const
Definition: view.cpp:133
Kross::ActionCollectionModel::collection
static ActionCollection * collection(const QModelIndex &index)
Definition: model.cpp:200
Kross::ActionCollectionModel::action
static Action * action(const QModelIndex &index)
Definition: model.cpp:191
Kross::ActionCollectionView::slotEnabledChanged
virtual void slotEnabledChanged(const QString &actionname)
This slot got called if the enable/disable state of an action changed.
Definition: view.cpp:403
Kross::ActionCollectionView::setModel
virtual void setModel(QAbstractItemModel *model)
Set the model this view should use to model .
Definition: view.cpp:345
Kross::ActionCollectionView::button
KPushButton * button(const QString &actionname) const
Definition: view.cpp:374
Kross::ActionCollectionView::actionCollection
KActionCollection * actionCollection() const
Definition: view.cpp:369
Kross::ActionCollectionView::createButton
KPushButton * createButton(QWidget *parentWidget, const QString &actionname)
Create and return a new KPushButton instance for the given actionname.
Definition: view.cpp:386
Kross::ActionCollectionView::isModified
bool isModified() const
Definition: view.cpp:359
Kross::ActionCollectionView::slotAdd
virtual void slotAdd()
Called if the "add" action was triggered and a new item should be added.
Definition: view.cpp:521
Kross::ActionCollectionView::slotSelectionChanged
virtual void slotSelectionChanged()
This slot got called if the selected item changed.
Definition: view.cpp:411
Kross::ActionCollectionView::~ActionCollectionView
virtual ~ActionCollectionView()
Destructor.
Definition: view.cpp:340
Kross::ActionCollectionView::slotRun
virtual void slotRun()
Called if the "run" action was triggered and the selected script should be executed.
Definition: view.cpp:450
Kross::ActionCollectionView::enabledChanged
void enabledChanged(const QString &actionname)
This signal is emitted if the enabled/disabled state of an action changed.
Kross::ActionCollectionView::ActionCollectionView
ActionCollectionView(QWidget *parent=0)
Constructor.
Definition: view.cpp:284
Kross::ActionCollectionView::setModified
void setModified(bool modified)
Set the internal modified state of the collection to modified .
Definition: view.cpp:364
Kross::ActionCollectionView::slotDataChanged
virtual void slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This slot got called if the data changed.
Definition: view.cpp:445
Kross::ActionCollectionView::itemSelection
QItemSelection itemSelection() const
This method provides us access to the QItemSelection.
Definition: view.cpp:379
Kross::ActionCollectionView::slotStop
virtual void slotStop()
Called if the "stop" action was triggered and the selected script stops execution if running.
Definition: view.cpp:471
Kross::ActionCollectionView::slotEdit
virtual void slotEdit()
Called if the "edit" action was triggered and the select item should be edited via the scripts manage...
Definition: view.cpp:487
Kross::ActionCollectionView::slotRemove
virtual void slotRemove()
Called if the "remove" action was triggered and the selected item should be removed.
Definition: view.cpp:555
Kross::ActionCollection
The ActionCollection class manages collections of Action instances.
Definition: actioncollection.h:46
Kross::Action
The Action class is an abstract container to deal with scripts like a single standalone script file.
Definition: action.h:99
Kross::Action::isFinalized
bool isFinalized() const
Definition: action.cpp:504
Kross::Action::finalize
void finalize()
Finalize the Script instance and frees any cached or still running executions.
Definition: action.cpp:496
Kross::InterpreterInfo
The InterpreterInfo class provides abstract information about a Interpreter before the interpreter-ba...
Definition: core/interpreter.h:44
Kross::InterpreterInfo::mimeTypes
const QStringList mimeTypes() const
List of mimetypes this interpreter supports.
Definition: core/interpreter.cpp:86
Kross::Manager::interpreters
QStringList interpreters() const
Definition: manager.cpp:280
Kross::Manager::self
static Manager & self()
Return the Manager instance.
Definition: manager.cpp:73
Kross::Manager::interpreterInfo
InterpreterInfo * interpreterInfo(const QString &interpretername) const
Definition: manager.cpp:250
QAbstractItemModel
QAbstractProxyModel
QAction
QComboBox
QItemSelectionModel
QLabel
QLineEdit
QMap
QTreeView
QWidget
interpreter.h
header
const char header[]
kaction.h
kactioncollection.h
kapplication.h
kcombobox.h
kconfig.h
klineedit.h
klocale.h
i18n
QString i18n(const char *text)
i18nc
QString i18nc(const char *ctxt, const char *text)
kmenu.h
kmessagebox.h
kpagedialog.h
kpushbutton.h
kstandarddirs.h
manager.h
model.h
Type
Type
name
const char * name(StandardAction id)
Kross
Definition: action.cpp:36
Action
view.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

Skip menu "Kross"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal