"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/exthistorycombo.cpp" between
krename-4.0.9.tar.gz and krename-4.90.90.tar.gz

About: KRename is a batch file-renamer (KDE).

exthistorycombo.cpp  (krename-4.0.9):exthistorycombo.cpp  (krename-4.90.90)
skipping to change at line 22 skipping to change at line 22
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#include "exthistorycombo.h" #include "exthistorycombo.h"
#include <kconfig.h> #include <kconfig.h>
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <kglobal.h> #include <KSharedConfig>
#include <QLineEdit> #include <QLineEdit>
#define EXT_HISTORY_COMBO_MAX_COUNT 10 #define EXT_HISTORY_COMBO_MAX_COUNT 10
#define EXT_HISTORY_COMBO_TIMER_DELAY 500 #define EXT_HISTORY_COMBO_TIMER_DELAY 500
ExtHistoryCombo::ExtHistoryCombo( QWidget* parent ) ExtHistoryCombo::ExtHistoryCombo(QWidget *parent)
: KHistoryComboBox( parent ) : KHistoryComboBox(parent)
{ {
connect( this, SIGNAL( activated( const QString& )), SLOT( addToHistory( con connect(this, static_cast<void (ExtHistoryCombo::*)(const QString &)>(&ExtHi
st QString& ))); storyCombo::activated),
connect( this, SIGNAL( editTextChanged(const QString &)), SLOT( slotTextChan this, &ExtHistoryCombo::addToHistory);
ged())); connect(this, &ExtHistoryCombo::editTextChanged,
connect( &m_timer, SIGNAL( timeout() ), this, SIGNAL( delayedTextChanged() ) this, &ExtHistoryCombo::slotTextChanged);
); connect(&m_timer, &QTimer::timeout,
this, &ExtHistoryCombo::delayedTextChanged);
this->setMaxCount( EXT_HISTORY_COMBO_MAX_COUNT ); this->setMaxCount(EXT_HISTORY_COMBO_MAX_COUNT);
this->setDuplicatesEnabled( false ); this->setDuplicatesEnabled(false);
m_timer.setSingleShot( true ); m_timer.setSingleShot(true);
} }
void ExtHistoryCombo::slotTextChanged() void ExtHistoryCombo::slotTextChanged()
{ {
m_timer.stop(); m_timer.stop();
m_timer.start( EXT_HISTORY_COMBO_TIMER_DELAY ); m_timer.start(EXT_HISTORY_COMBO_TIMER_DELAY);
} }
void ExtHistoryCombo::loadConfig() void ExtHistoryCombo::loadConfig()
{ {
QString currentText = this->currentText(); QString currentText = this->currentText();
QStringList history; QStringList history;
QStringList completion; QStringList completion;
KSharedConfigPtr config = KGlobal::config(); KSharedConfigPtr config = KSharedConfig::openConfig();
KConfigGroup groupGui = config->group( QString("ExtHistoryCombo") + this->ob KConfigGroup groupGui = config->group(QString("ExtHistoryCombo") + this->obj
jectName() ); ectName());
completion = groupGui.readEntry("CompletionList", QStringList()); completion = groupGui.readEntry("CompletionList", QStringList());
history = groupGui.readEntry("HistoryList", QStringList()); history = groupGui.readEntry("HistoryList", QStringList());
this->completionObject()->setItems(completion); this->completionObject()->setItems(completion);
this->setHistoryItems(history); this->setHistoryItems(history);
this->lineEdit()->setText(currentText); // Preserve current text this->lineEdit()->setText(currentText); // Preserve current text
} }
void ExtHistoryCombo::saveConfig() void ExtHistoryCombo::saveConfig()
{ {
addToHistory( currentText() ); addToHistory(currentText());
KSharedConfigPtr config = KGlobal::config(); KSharedConfigPtr config = KSharedConfig::openConfig();
KConfigGroup groupGui = config->group( QString("ExtHistoryCombo") + this->ob KConfigGroup groupGui = config->group(QString("ExtHistoryCombo") + this->obj
jectName() ); ectName());
groupGui.writeEntry("CompletionList", this->completionObject()->items()); groupGui.writeEntry("CompletionList", this->completionObject()->items());
groupGui.writeEntry("HistoryList", this->historyItems()); groupGui.writeEntry("HistoryList", this->historyItems());
config->sync(); config->sync();
} }
void ExtHistoryCombo::selectAll() void ExtHistoryCombo::selectAll()
{ {
this->lineEdit()->setSelection(0, this->lineEdit()->text().length()); this->lineEdit()->setSelection(0, this->lineEdit()->text().length());
} }
#include "exthistorycombo.moc"
 End of changes. 10 change blocks. 
20 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)