Beispiel #1
0
Autoreplace_Config::Autoreplace_Config(QWidget* parent, const char* name)
 : Autoreplace_ConfigUI(parent, name)
{
  // reset flag to defined state (used to block signals when just selecting a new item)
  m_newItemSelected=false;

  //Check if the regexp editor is installed
  bool installed = !KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty();

  if(installed)
  {
      regExpEditorButton->setEnabled(true);
      QToolTip::add(regExpEditorButton, i18n("Click to run Regular Expression Editor (KRegExpEditor)"));
  }
  else
  {
      regExpEditorButton->setEnabled(false);
      QToolTip::add(regExpEditorButton, i18n("The Regular Expression Editor (KRegExpEditor) is not installed"));
  }

  // populate combobox
  directionCombo->insertItem(i18n("Outgoing"),DIRECTION_OUTPUT);
  directionCombo->insertItem(i18n("Incoming"),DIRECTION_INPUT);
  directionCombo->insertItem(i18n("Both"),DIRECTION_BOTH);

  // make items react to drag & drop
  patternListView->setSorting(-1,false);
  patternListView->setShowSortIndicator(true);
  patternListView->setShadeSortColumn(true);
  patternListView->header()->setMovingEnabled(false);

  // populate listview
  loadSettings();

  connect(patternListView, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(entrySelected(QListViewItem*)));
  connect(patternListView, SIGNAL(clicked(QListViewItem*)), this, SLOT(entrySelected(QListViewItem*)));
  connect(patternListView, SIGNAL(moved()), SIGNAL(modified()));

  connect(patternListView, SIGNAL(aboutToMove()), SLOT(disableSort()));
  connect(patternListView->header(), SIGNAL(clicked(int)), SLOT(sort(int)));

  connect(directionCombo, SIGNAL(activated(int)), this, SLOT(directionChanged(int)));

  connect(patternInput, SIGNAL(textChanged(const QString&)), this, SLOT(patternChanged(const QString&)));
  connect(regExpEditorButton, SIGNAL(clicked()), this, SLOT(showRegExpEditor()));
  connect(replacementInput, SIGNAL(textChanged(const QString&)), this, SLOT(replacementChanged(const QString&)));

  connect(newButton, SIGNAL(clicked()), this, SLOT(addEntry()));
  connect(removeButton, SIGNAL(clicked()), this, SLOT(removeEntry()));
}
Beispiel #2
0
Autoreplace_Config::Autoreplace_Config(QWidget* parent, const char* name)
 : QWidget(parent)
{
  setObjectName(QString::fromLatin1(name));
  setupUi(this);

  // reset flag to defined state (used to block signals when just selecting a new item)
  m_newItemSelected=false;
  //Check if the regexp editor is installed
// it does not make sense to port / enable this since KRegExpEditor is in a very bad shape. just keep this
// code here because it will probably help at a later point to port it when KRegExpEditor is again usable.
// 2009-02-06, uwolfer
  bool installed = false;//( KServiceTypeTrader::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor", QString(), this )!= 0 );
  regExpEditorButton->setVisible(false);

  if(installed)
  {
      regExpEditorButton->setEnabled(true);
      regExpEditorButton->setStatusTip(i18n("Click to run Regular Expression Editor (KRegExpEditor)"));
  }
  else
  {
      regExpEditorButton->setEnabled(false);
      regExpEditorButton->setStatusTip(i18n("The Regular Expression Editor (KRegExpEditor) is not installed"));
  }
  // populate combobox
  directionCombo->insertItem(DIRECTION_OUTPUT, i18n("Outgoing"));
  directionCombo->insertItem(DIRECTION_INPUT, i18n("Incoming"));
  directionCombo->insertItem(DIRECTION_BOTH, i18n("Both"));

  // populate listview
  loadSettings();

  connect(patternListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(entrySelected(QTreeWidgetItem*)));

  connect(directionCombo, SIGNAL(activated(int)), this, SLOT(directionChanged(int)));

  connect(patternInput, SIGNAL(textChanged(QString)), this, SLOT(patternChanged(QString)));
  connect(regExpEditorButton, SIGNAL(clicked()), this, SLOT(showRegExpEditor()));
  connect(replacementInput, SIGNAL(textChanged(QString)), this, SLOT(replacementChanged(QString)));

  connect(newButton, SIGNAL(clicked()), this, SLOT(addEntry()));
  connect(removeButton, SIGNAL(clicked()), this, SLOT(removeEntry()));
}