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

Kross

  • sources
  • kde-4.14
  • kdelibs
  • 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 
56 using namespace Kross;
57 
58 /*********************************************************************************
59  * ActionCollectionEditor
60  */
61 
62 namespace 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 
105 ActionCollectionEditor::ActionCollectionEditor(Action* action, QWidget* parent)
106  : QWidget(parent), d(new Private(action))
107 {
108  initGui();
109 }
110 
111 ActionCollectionEditor::ActionCollectionEditor(ActionCollection* collection, QWidget* parent)
112  : QWidget(parent), d(new Private(collection))
113 {
114  initGui();
115 }
116 
117 ActionCollectionEditor::~ActionCollectionEditor()
118 {
119  delete d;
120 }
121 
122 Action* ActionCollectionEditor::action() const
123 {
124  return d->type == Private::ActionType ? d->action : 0;
125 }
126 
127 ActionCollection* ActionCollectionEditor::collection() const
128 {
129  return d->type == Private::CollectionType ? d->collection : 0;
130 }
131 
132 QLineEdit* ActionCollectionEditor::nameEdit() const { return d->nameedit; }
133 QLineEdit* ActionCollectionEditor::textEdit() const { return d->textedit; }
134 QLineEdit* ActionCollectionEditor::commentEdit() const { return d->commentedit; }
135 QLineEdit* ActionCollectionEditor::iconEdit() const { return d->iconedit; }
136 QComboBox* ActionCollectionEditor::interpreterEdit() const { return d->interpreteredit; }
137 KUrlRequester* ActionCollectionEditor::fileEdit() const { return d->fileedit; }
138 
139 void 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 
239 bool ActionCollectionEditor::isValid()
240 {
241  //TODO check also if such a name already exist.
242  return ! d->nameedit->text().isEmpty();
243 }
244 
245 void 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 
270 namespace 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 
284 ActionCollectionView::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 
340 ActionCollectionView::~ActionCollectionView()
341 {
342  delete d;
343 }
344 
345 void 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 
359 bool ActionCollectionView::isModified() const
360 {
361  return d->modified;
362 }
363 
364 void ActionCollectionView::setModified(bool modified)
365 {
366  d->modified = modified;
367 }
368 
369 KActionCollection* ActionCollectionView::actionCollection() const
370 {
371  return d->collection;
372 }
373 
374 KPushButton* ActionCollectionView::button(const QString& actionname) const
375 {
376  return d->buttons.contains(actionname) ? d->buttons[actionname] : 0;
377 }
378 
379 QItemSelection 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 
386 KPushButton* 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 
403 void 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 
411 void 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 
445 void ActionCollectionView::slotDataChanged(const QModelIndex&, const QModelIndex&)
446 {
447  d->modified = true;
448 }
449 
450 void 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 
471 void 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 
487 void 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 
521 void ActionCollectionView::slotAdd()
522 {
523 
524 //TODO
525 KMessageBox::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 
555 void ActionCollectionView::slotRemove()
556 {
557  if( ! selectionModel() ) return;
558  KMessageBox::sorry(0, "TODO");
559 }
560 
561 #include "view.moc"
QWidget::layout
QLayout * layout() const
Kross::ActionCollectionModel::action
static Action * action(const QModelIndex &index)
Definition: model.cpp:191
QAction::text
text
i18n
QString i18n(const char *text)
Kross::ActionCollectionView::button
KPushButton * button(const QString &actionname) const
Definition: view.cpp:374
QModelIndex
kcombobox.h
KPushButton
KActionCollection
QWidget
Kross::ActionCollectionModel::collection
static ActionCollection * collection(const QModelIndex &index)
Definition: model.cpp:200
KPageDialog
QDialog::minimumSizeHint
virtual QSize minimumSizeHint() const
Kross::ActionCollectionEditor
The ActionCollectionEditor class implements a general editor for Action and ActionCollection instance...
Definition: view.h:65
QAbstractItemView::setAlternatingRowColors
void setAlternatingRowColors(bool enable)
Type
Type
Kross::Action::description
QString description() const
Definition: action.cpp:281
QAbstractItemView::setSelectionMode
void setSelectionMode(QAbstractItemView::SelectionMode mode)
Kross::ActionCollectionEditor::ActionCollectionEditor
ActionCollectionEditor(Action *action, QWidget *parent=0)
Constructor.
Definition: view.cpp:105
kapplication.h
Kross::ActionCollectionView::slotAdd
virtual void slotAdd()
Called if the "add" action was triggered and a new item should be added.
Definition: view.cpp:521
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
QAbstractProxyModel
QAbstractItemView::selectionModel
QItemSelectionModel * selectionModel() const
QTreeView::dataChanged
virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Kross::ActionCollection::iconName
QString iconName() const
Definition: actioncollection.cpp:91
QTreeView::setSelectionModel
virtual void setSelectionModel(QItemSelectionModel *selectionModel)
kactioncollection.h
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
kconfig.h
Kross::ActionCollectionView::slotRun
virtual void slotRun()
Called if the "run" action was triggered and the selected script should be executed.
Definition: view.cpp:450
QAction::icon
icon
QMap< QString, KPushButton * >
Kross::ActionCollection::isEnabled
bool isEnabled() const
Return the enable this ActionCollection has.
Definition: actioncollection.cpp:95
QAbstractItemView::setDragDropMode
void setDragDropMode(DragDropMode behavior)
QHBoxLayout
QDialog::exec
int exec()
Kross::Action::iconName
QString iconName() const
Return the name of the icon.
Definition: action.cpp:293
model.h
QGridLayout
QStringList::join
QString join(const QString &separator) const
Kross::Manager::interpreterInfo
InterpreterInfo * interpreterInfo(const QString &interpretername) const
Definition: manager.cpp:250
Kross::ActionCollectionView::~ActionCollectionView
virtual ~ActionCollectionView()
Destructor.
Definition: view.cpp:340
klocale.h
Kross::Action::name
QString name() const
Definition: action.cpp:271
Kross::ActionCollectionEditor::commentEdit
QLineEdit * commentEdit() const
Definition: view.cpp:134
KUrl
QAction::setToolTip
void setToolTip(const QString &tip)
i18nc
QString i18nc(const char *ctxt, const char *text)
Kross::ActionCollectionEditor::fileEdit
KUrlRequester * fileEdit() const
Definition: view.cpp:137
QAction::trigger
void trigger()
Kross::InterpreterInfo
The InterpreterInfo class provides abstract information about a Interpreter before the interpreter-ba...
Definition: core/interpreter.h:43
Kross::ActionCollectionEditor::iconEdit
QLineEdit * iconEdit() const
Definition: view.cpp:135
interpreter.h
QLabel::setBuddy
void setBuddy(QWidget *buddy)
QWidget::resize
void resize(int w, int h)
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
QObject::name
const char * name() const
QModelIndex::isValid
bool isValid() const
Kross::ActionCollectionView::ActionCollectionView
ActionCollectionView(QWidget *parent=0)
Constructor.
Definition: view.cpp:284
Kross::ActionCollectionEditor::action
Action * action() const
Definition: view.cpp:122
QWidget::isEnabled
bool isEnabled() const
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QList::append
void append(const T &value)
KPushButton::setText
void setText(const QString &text)
Kross::ActionCollectionEditor::textEdit
QLineEdit * textEdit() const
Definition: view.cpp:133
QWidget::setLayout
void setLayout(QLayout *layout)
view.h
kmenu.h
QAbstractProxyModel::mapSelectionToSource
virtual QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const
action.h
QItemSelectionModel::selection
const QItemSelection selection() const
KMessageBox::sorry
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
QObject::setObjectName
void setObjectName(const QString &name)
Kross::ActionCollectionView::actionCollection
KActionCollection * actionCollection() const
Definition: view.cpp:369
QItemSelectionModel::selectedIndexes
QModelIndexList selectedIndexes() const
QString::trimmed
QString trimmed() const
QItemSelectionModel::hasSelection
bool hasSelection() const
KIcon
Kross::ActionCollectionView::isModified
bool isModified() const
Definition: view.cpp:359
QVBoxLayout
Kross::ActionCollectionEditor::~ActionCollectionEditor
virtual ~ActionCollectionEditor()
Destructor.
Definition: view.cpp:117
QString
QWidget::hide
void hide()
manager.h
QLayout::setMargin
void setMargin(int margin)
Kross::ActionCollectionView::slotDataChanged
virtual void slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This slot got called if the data changed.
Definition: view.cpp:445
QLayout::addWidget
void addWidget(QWidget *w)
QStringList
Kross::ActionCollectionEditor::interpreterEdit
QComboBox * interpreterEdit() const
Definition: view.cpp:136
kaction.h
Kross::ActionCollectionEditor::initGui
virtual void initGui()
Initialize the GUI.
Definition: view.cpp:139
QSize
kpushbutton.h
Kross::ActionCollection::text
QString text() const
Definition: actioncollection.cpp:85
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::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
QItemSelection
QTreeView::setSortingEnabled
void setSortingEnabled(bool enable)
KLineEdit
Kross::ActionCollectionView::setModified
void setModified(bool modified)
Set the internal modified state of the collection to modified .
Definition: view.cpp:364
Kross::Manager::self
static Manager & self()
Return the Manager instance.
Definition: manager.cpp:73
KPushButton::setIcon
void setIcon(const KIcon &icon)
QTreeView
QBoxLayout::addStretch
void addStretch(int stretch)
Kross::Manager::interpreters
QStringList interpreters() const
Definition: manager.cpp:280
kstandarddirs.h
Kross::Action::finalize
void finalize()
Finalize the Script instance and frees any cached or still running executions.
Definition: action.cpp:496
Kross::ActionCollectionEditor::collection
ActionCollection * collection() const
Definition: view.cpp:127
QTreeView::setModel
virtual void setModel(QAbstractItemModel *model)
QTreeView::selectionChanged
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Kross::Action::isEnabled
bool isEnabled() const
Return true if this Action is enabled else false is returned.
Definition: action.cpp:306
Kross::ActionCollection::description
QString description() const
Definition: actioncollection.cpp:88
QAction
KAction
QWidget::QWidget
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
Kross::ActionCollectionView::setModel
virtual void setModel(QAbstractItemModel *model)
Set the model this view should use to model .
Definition: view.cpp:345
QWidget::setCaption
void setCaption(const QString &c)
KComboBox
kpagedialog.h
QAbstractItemModel
Kross::ActionCollectionView::slotSelectionChanged
virtual void slotSelectionChanged()
This slot got called if the selected item changed.
Definition: view.cpp:411
QAbstractItemView::clicked
void clicked(const QModelIndex &index)
QStringList::indexOf
int indexOf(const QRegExp &rx, int from) const
Kross::Action::isFinalized
bool isFinalized() const
Definition: action.cpp:504
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
QTreeView::header
QHeaderView * header() const
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
klineedit.h
Kross::InterpreterInfo::mimeTypes
const QStringList mimeTypes() const
List of mimetypes this interpreter supports.
Definition: core/interpreter.cpp:86
Kross::ActionCollection::name
QString name() const
Definition: actioncollection.cpp:83
QLineEdit
Kross::Action
The Action class is an abstract container to deal with scripts like a single standalone script file...
Definition: action.h:94
QWidget::setToolTip
void setToolTip(const QString &)
QAbstractItemView::model
QAbstractItemModel * model() const
Kross::ActionCollectionEditor::isValid
virtual bool isValid()
Definition: view.cpp:239
Kross::ActionCollection
The ActionCollection class manages collections of Action instances.
Definition: actioncollection.h:45
QTreeView::setRootIsDecorated
void setRootIsDecorated(bool show)
kmessagebox.h
QItemSelectionModel
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QLabel
QObject::parent
QObject * parent() const
actioncollection.h
Kross::ActionCollectionView::itemSelection
QItemSelection itemSelection() const
This method provides us access to the QItemSelection.
Definition: view.cpp:379
QTreeView::setItemsExpandable
void setItemsExpandable(bool enable)
QAction::setEnabled
void setEnabled(bool)
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::ActionCollectionView::enabledChanged
void enabledChanged(const QString &actionname)
This signal is emitted if the enabled/disabled state of an action changed.
QAbstractItemView::setDropIndicatorShown
void setDropIndicatorShown(bool enable)
QComboBox
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:44 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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