From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/libkopete/kautoconfig.cpp | 224 +++++++++++++++++++-------------------- 1 file changed, 112 insertions(+), 112 deletions(-) (limited to 'kopete/libkopete/kautoconfig.cpp') diff --git a/kopete/libkopete/kautoconfig.cpp b/kopete/libkopete/kautoconfig.cpp index a1885537..d54e3123 100644 --- a/kopete/libkopete/kautoconfig.cpp +++ b/kopete/libkopete/kautoconfig.cpp @@ -21,8 +21,8 @@ #include "kautoconfig.h" #include -#include -#include +#include +#include #include #include #include @@ -63,12 +63,12 @@ public: { init(); } // Widgets to parse - QPtrList widgets; + TQPtrList widgets; // Name of the group that KConfig should be set to for each widget. - QMap groups; + TQMap groups; // Child widgets of widgets to ignore - QPtrList ignore; + TQPtrList ignore; // Reset to false after saveSettings returns true. bool changed; @@ -79,18 +79,18 @@ public: #endif // Known widgets that can be configured - QMap > autoWidgets; + TQMap > autoWidgets; // Default values for the widgets. - QMap defaultValues; - // Widgets to not get properties on (QLabel etc) - QAsciiDict ignoreTheseWidgets; + TQMap defaultValues; + // Widgets to not get properties on (TQLabel etc) + TQAsciiDict ignoreTheseWidgets; void init(){ - ignoreTheseWidgets.insert("QLabel", new int(1)); - ignoreTheseWidgets.insert("QFrame", new int(2)); - ignoreTheseWidgets.insert("QGroupBox", new int(3)); - ignoreTheseWidgets.insert("QButtonGroup", new int(4)); - ignoreTheseWidgets.insert("QWidget", new int(5)); + ignoreTheseWidgets.insert("TQLabel", new int(1)); + ignoreTheseWidgets.insert("TQFrame", new int(2)); + ignoreTheseWidgets.insert("TQGroupBox", new int(3)); + ignoreTheseWidgets.insert("TQButtonGroup", new int(4)); + ignoreTheseWidgets.insert("TQWidget", new int(5)); ignoreTheseWidgets.setAutoDelete(true); static bool defaultKDEPropertyMapInstalled = false; @@ -101,13 +101,13 @@ public: } }; -KAutoConfig::KAutoConfig(KConfig *kconfig, QObject *parent, - const char *name) : QObject(parent, name), config(kconfig) { +KAutoConfig::KAutoConfig(KConfig *kconfig, TQObject *parent, + const char *name) : TQObject(parent, name), config(kconfig) { d = new KAutoConfigPrivate(); } -KAutoConfig::KAutoConfig(QObject *parent, const char *name) : - QObject(parent, name), config(KGlobal::config()) { +KAutoConfig::KAutoConfig(TQObject *parent, const char *name) : + TQObject(parent, name), config(KGlobal::config()) { d = new KAutoConfigPrivate(); } @@ -115,15 +115,15 @@ KAutoConfig::~KAutoConfig(){ delete d; } -void KAutoConfig::addWidget(QWidget *widget, const QString &group){ +void KAutoConfig::addWidget(TQWidget *widget, const TQString &group){ functionCallPostOrderCheck("addWidget",); d->groups.insert(widget, group); d->widgets.append(widget); - QPtrList newAutoConfigWidget; + TQPtrList newAutoConfigWidget; d->autoWidgets.insert(widget, newAutoConfigWidget ); } -void KAutoConfig::ignoreSubWidget(QWidget *widget){ +void KAutoConfig::ignoreSubWidget(TQWidget *widget){ functionCallPostOrderCheck("ignoreSubWidget",); d->ignore.append(widget); } @@ -141,51 +141,51 @@ bool KAutoConfig::retrieveSettings(bool trackChanges){ if(trackChanges){ // QT - changedMap.insert(QString::fromLatin1("QButton"), SIGNAL(stateChanged(int))); - changedMap.insert(QString::fromLatin1("QCheckBox"), SIGNAL(stateChanged(int))); - changedMap.insert(QString::fromLatin1("QPushButton"), SIGNAL(stateChanged(int))); - changedMap.insert(QString::fromLatin1("QRadioButton"), SIGNAL(stateChanged(int))); - changedMap.insert(QString::fromLatin1("QComboBox"), SIGNAL(activated (int))); + changedMap.insert(TQString::fromLatin1("TQButton"), TQT_SIGNAL(stateChanged(int))); + changedMap.insert(TQString::fromLatin1("TQCheckBox"), TQT_SIGNAL(stateChanged(int))); + changedMap.insert(TQString::fromLatin1("TQPushButton"), TQT_SIGNAL(stateChanged(int))); + changedMap.insert(TQString::fromLatin1("TQRadioButton"), TQT_SIGNAL(stateChanged(int))); + changedMap.insert(TQString::fromLatin1("TQComboBox"), TQT_SIGNAL(activated (int))); //qsqlproperty map doesn't store the text, but the value! - //changedMap.insert(QString::fromLatin1("QComboBox"), SIGNAL(textChanged(const QString &))); - changedMap.insert(QString::fromLatin1("QDateEdit"), SIGNAL(valueChanged(const QDate &))); - changedMap.insert(QString::fromLatin1("QDateTimeEdit"), SIGNAL(valueChanged(const QDateTime &))); - changedMap.insert(QString::fromLatin1("QDial"), SIGNAL(valueChanged (int))); - changedMap.insert(QString::fromLatin1("QLineEdit"), SIGNAL(textChanged(const QString &))); - changedMap.insert(QString::fromLatin1("QSlider"), SIGNAL(valueChanged(int))); - changedMap.insert(QString::fromLatin1("QSpinBox"), SIGNAL(valueChanged(int))); - changedMap.insert(QString::fromLatin1("QTimeEdit"), SIGNAL(valueChanged(const QTime &))); - changedMap.insert(QString::fromLatin1("QTextEdit"), SIGNAL(textChanged())); - changedMap.insert(QString::fromLatin1("QTextBrowser"), SIGNAL(sourceChanged(const QString &))); - changedMap.insert(QString::fromLatin1("QMultiLineEdit"), SIGNAL(textChanged())); - changedMap.insert(QString::fromLatin1("QListBox"), SIGNAL(selectionChanged())); - changedMap.insert(QString::fromLatin1("QTabWidget"), SIGNAL(currentChanged(QWidget *))); + //changedMap.insert(TQString::fromLatin1("TQComboBox"), TQT_SIGNAL(textChanged(const TQString &))); + changedMap.insert(TQString::fromLatin1("QDateEdit"), TQT_SIGNAL(valueChanged(const TQDate &))); + changedMap.insert(TQString::fromLatin1("QDateTimeEdit"), TQT_SIGNAL(valueChanged(const TQDateTime &))); + changedMap.insert(TQString::fromLatin1("TQDial"), TQT_SIGNAL(valueChanged (int))); + changedMap.insert(TQString::fromLatin1("TQLineEdit"), TQT_SIGNAL(textChanged(const TQString &))); + changedMap.insert(TQString::fromLatin1("TQSlider"), TQT_SIGNAL(valueChanged(int))); + changedMap.insert(TQString::fromLatin1("TQSpinBox"), TQT_SIGNAL(valueChanged(int))); + changedMap.insert(TQString::fromLatin1("QTimeEdit"), TQT_SIGNAL(valueChanged(const TQTime &))); + changedMap.insert(TQString::fromLatin1("TQTextEdit"), TQT_SIGNAL(textChanged())); + changedMap.insert(TQString::fromLatin1("TQTextBrowser"), TQT_SIGNAL(sourceChanged(const TQString &))); + changedMap.insert(TQString::fromLatin1("TQMultiLineEdit"), TQT_SIGNAL(textChanged())); + changedMap.insert(TQString::fromLatin1("TQListBox"), TQT_SIGNAL(selectionChanged())); + changedMap.insert(TQString::fromLatin1("TQTabWidget"), TQT_SIGNAL(currentChanged(TQWidget *))); // KDE - changedMap.insert( QString::fromLatin1("KComboBox"), SIGNAL(activated (int))); - changedMap.insert( QString::fromLatin1("KFontCombo"), SIGNAL(activated (int))); - changedMap.insert( QString::fromLatin1("KFontRequester"), SIGNAL(fontSelected(const QFont &))); - changedMap.insert( QString::fromLatin1("KFontChooser"), SIGNAL(fontSelected(const QFont &))); - changedMap.insert( QString::fromLatin1("KHistoryCombo"), SIGNAL(activated (int))); - - changedMap.insert( QString::fromLatin1("KColorButton"), SIGNAL(changed(const QColor &))); - changedMap.insert( QString::fromLatin1("KDatePicker"), SIGNAL(dateSelected (QDate))); - changedMap.insert( QString::fromLatin1("KEditListBox"), SIGNAL(changed())); - changedMap.insert( QString::fromLatin1("KListBox"), SIGNAL(selectionChanged())); - changedMap.insert( QString::fromLatin1("KLineEdit"), SIGNAL(textChanged(const QString &))); - changedMap.insert( QString::fromLatin1("KPasswordEdit"), SIGNAL(textChanged(const QString &))); - changedMap.insert( QString::fromLatin1("KRestrictedLine"), SIGNAL(textChanged(const QString &))); - changedMap.insert( QString::fromLatin1("KTextBrowser"), SIGNAL(sourceChanged(const QString &))); - changedMap.insert( QString::fromLatin1("KTextEdit"), SIGNAL(textChanged())); - changedMap.insert( QString::fromLatin1("KURLRequester"), SIGNAL(textChanged (const QString& ))); - changedMap.insert( QString::fromLatin1("KIntNumInput"), SIGNAL(valueChanged (int))); - changedMap.insert( QString::fromLatin1("KIntSpinBox"), SIGNAL(valueChanged (int))); - changedMap.insert( QString::fromLatin1("KDoubleNumInput"), SIGNAL(valueChanged (double))); + changedMap.insert( TQString::fromLatin1("KComboBox"), TQT_SIGNAL(activated (int))); + changedMap.insert( TQString::fromLatin1("KFontCombo"), TQT_SIGNAL(activated (int))); + changedMap.insert( TQString::fromLatin1("KFontRequester"), TQT_SIGNAL(fontSelected(const TQFont &))); + changedMap.insert( TQString::fromLatin1("KFontChooser"), TQT_SIGNAL(fontSelected(const TQFont &))); + changedMap.insert( TQString::fromLatin1("KHistoryCombo"), TQT_SIGNAL(activated (int))); + + changedMap.insert( TQString::fromLatin1("KColorButton"), TQT_SIGNAL(changed(const TQColor &))); + changedMap.insert( TQString::fromLatin1("KDatePicker"), TQT_SIGNAL(dateSelected (TQDate))); + changedMap.insert( TQString::fromLatin1("KEditListBox"), TQT_SIGNAL(changed())); + changedMap.insert( TQString::fromLatin1("KListBox"), TQT_SIGNAL(selectionChanged())); + changedMap.insert( TQString::fromLatin1("KLineEdit"), TQT_SIGNAL(textChanged(const TQString &))); + changedMap.insert( TQString::fromLatin1("KPasswordEdit"), TQT_SIGNAL(textChanged(const TQString &))); + changedMap.insert( TQString::fromLatin1("KRestrictedLine"), TQT_SIGNAL(textChanged(const TQString &))); + changedMap.insert( TQString::fromLatin1("KTextBrowser"), TQT_SIGNAL(sourceChanged(const TQString &))); + changedMap.insert( TQString::fromLatin1("KTextEdit"), TQT_SIGNAL(textChanged())); + changedMap.insert( TQString::fromLatin1("KURLRequester"), TQT_SIGNAL(textChanged (const TQString& ))); + changedMap.insert( TQString::fromLatin1("KIntNumInput"), TQT_SIGNAL(valueChanged (int))); + changedMap.insert( TQString::fromLatin1("KIntSpinBox"), TQT_SIGNAL(valueChanged (int))); + changedMap.insert( TQString::fromLatin1("KDoubleNumInput"), TQT_SIGNAL(valueChanged (double))); } // Go through all of the children of the widgets and find all known widgets - QPtrListIterator it( d->widgets ); - QWidget *widget; + TQPtrListIterator it( d->widgets ); + TQWidget *widget; bool usingDefaultValues = false; while ( (widget = it.current()) != 0 ) { ++it; @@ -198,30 +198,30 @@ bool KAutoConfig::retrieveSettings(bool trackChanges){ bool KAutoConfig::saveSettings() { functionCallPreOrderCheck("saveSettings", false); - QSqlPropertyMap *propertyMap = QSqlPropertyMap::defaultMap(); + TQSqlPropertyMap *propertyMap = TQSqlPropertyMap::defaultMap(); // Go through all of the widgets - QPtrListIterator it( d->widgets ); - QWidget *widget; + TQPtrListIterator it( d->widgets ); + TQWidget *widget; while ( (widget = it.current()) != 0 ) { ++it; config->setGroup(d->groups[widget]); // Go through the known autowidgets of this widget and save - QPtrListIterator it( d->autoWidgets[widget] ); - QWidget *groupWidget; + TQPtrListIterator it( d->autoWidgets[widget] ); + TQWidget *groupWidget; bool widgetChanged = false; while ( (groupWidget = it.current()) != 0 ){ ++it; - QVariant defaultValue = d->defaultValues[groupWidget]; - QVariant currentValue = propertyMap->property(groupWidget); + TQVariant defaultValue = d->defaultValues[groupWidget]; + TQVariant currentValue = propertyMap->property(groupWidget); #if KDE_IS_VERSION( 3, 1, 90 ) - if(!config->hasDefault(QString::fromLatin1(groupWidget->name())) && currentValue == defaultValue){ - config->revertToDefault(QString::fromLatin1(groupWidget->name())); + if(!config->hasDefault(TQString::fromLatin1(groupWidget->name())) && currentValue == defaultValue){ + config->revertToDefault(TQString::fromLatin1(groupWidget->name())); widgetChanged = true; } else{ #endif - QVariant savedValue = config->readPropertyEntry(groupWidget->name(), + TQVariant savedValue = config->readPropertyEntry(groupWidget->name(), defaultValue); if(savedValue != currentValue){ config->writeEntry(groupWidget->name(), currentValue); @@ -248,21 +248,21 @@ bool KAutoConfig::saveSettings() { bool KAutoConfig::hasChanged() const { functionCallPreOrderCheck("hasChanged", false); - QSqlPropertyMap *propertyMap = QSqlPropertyMap::defaultMap(); + TQSqlPropertyMap *propertyMap = TQSqlPropertyMap::defaultMap(); // Go through all of the widgets - QPtrListIterator it( d->widgets ); - QWidget *widget; + TQPtrListIterator it( d->widgets ); + TQWidget *widget; while ( (widget = it.current()) != 0 ) { ++it; config->setGroup(d->groups[widget]); // Go through the known autowidgets of this widget and save - QPtrListIterator it( d->autoWidgets[widget] ); - QWidget *groupWidget; + TQPtrListIterator it( d->autoWidgets[widget] ); + TQWidget *groupWidget; while ( (groupWidget = it.current()) != 0 ){ ++it; - QVariant defaultValue = d->defaultValues[groupWidget]; - QVariant currentValue = propertyMap->property(groupWidget); - QVariant savedValue = config->readPropertyEntry(groupWidget->name(), + TQVariant defaultValue = d->defaultValues[groupWidget]; + TQVariant currentValue = propertyMap->property(groupWidget); + TQVariant savedValue = config->readPropertyEntry(groupWidget->name(), defaultValue); // Return once just one item is found to have changed. @@ -277,20 +277,20 @@ bool KAutoConfig::hasChanged() const { bool KAutoConfig::isDefault() const { functionCallPreOrderCheck("isDefault", false); - QSqlPropertyMap *propertyMap = QSqlPropertyMap::defaultMap(); + TQSqlPropertyMap *propertyMap = TQSqlPropertyMap::defaultMap(); // Go through all of the widgets - QPtrListIterator it( d->widgets ); - QWidget *widget; + TQPtrListIterator it( d->widgets ); + TQWidget *widget; while ( (widget = it.current()) != 0 ) { ++it; config->setGroup(d->groups[widget]); // Go through the known autowidgets of this widget and save - QPtrListIterator it( d->autoWidgets[widget] ); - QWidget *groupWidget; + TQPtrListIterator it( d->autoWidgets[widget] ); + TQWidget *groupWidget; while ( (groupWidget = it.current()) != 0 ){ ++it; - QVariant defaultValue = d->defaultValues[groupWidget]; - QVariant currentValue = propertyMap->property(groupWidget); + TQVariant defaultValue = d->defaultValues[groupWidget]; + TQVariant currentValue = propertyMap->property(groupWidget); if(currentValue != defaultValue){ //qDebug("groupWidget %s, has changed: default: %s new: %s", groupWidget->name(), defaultValue.toString().latin1(), currentValue.toString().latin1()); return false; @@ -303,20 +303,20 @@ bool KAutoConfig::isDefault() const { void KAutoConfig::resetSettings() const { functionCallPreOrderCheck("resetSettings",); - QSqlPropertyMap *propertyMap = QSqlPropertyMap::defaultMap(); + TQSqlPropertyMap *propertyMap = TQSqlPropertyMap::defaultMap(); // Go through all of the widgets - QPtrListIterator it( d->widgets ); - QWidget *widget; + TQPtrListIterator it( d->widgets ); + TQWidget *widget; while ( (widget = it.current()) != 0 ) { ++it; config->setGroup(d->groups[widget]); // Go through the known autowidgets of this widget and save - QPtrListIterator it( d->autoWidgets[widget] ); - QWidget *groupWidget; + TQPtrListIterator it( d->autoWidgets[widget] ); + TQWidget *groupWidget; while ( (groupWidget = it.current()) != 0 ){ ++it; - QVariant defaultValue = d->defaultValues[groupWidget]; + TQVariant defaultValue = d->defaultValues[groupWidget]; if(defaultValue != propertyMap->property(groupWidget)){ propertyMap->setProperty(groupWidget, defaultValue); d->changed = true; @@ -328,21 +328,21 @@ void KAutoConfig::resetSettings() const { void KAutoConfig::reloadSettings() const { functionCallPreOrderCheck("reloadSettings", ); - QSqlPropertyMap *propertyMap = QSqlPropertyMap::defaultMap(); + TQSqlPropertyMap *propertyMap = TQSqlPropertyMap::defaultMap(); // Go through all of the widgets - QPtrListIterator it( d->widgets ); - QWidget *pageWidget; + TQPtrListIterator it( d->widgets ); + TQWidget *pageWidget; while ( (pageWidget = it.current()) != 0 ) { ++it; config->setGroup(d->groups[pageWidget]); // Go through the known widgets of this page and reload - QPtrListIterator it( d->autoWidgets[pageWidget] ); - QWidget *widget; + TQPtrListIterator it( d->autoWidgets[pageWidget] ); + TQWidget *widget; while ( (widget = it.current()) != 0 ){ ++it; - QVariant defaultSetting = d->defaultValues[widget]; - QVariant setting = + TQVariant defaultSetting = d->defaultValues[widget]; + TQVariant setting = config->readPropertyEntry(widget->name(), defaultSetting); propertyMap->setProperty(widget, setting); } @@ -350,23 +350,23 @@ void KAutoConfig::reloadSettings() const { d->changed = false; } -bool KAutoConfig::parseChildren(const QWidget *widget, - QPtrList& currentGroup, bool trackChanges){ +bool KAutoConfig::parseChildren(const TQWidget *widget, + TQPtrList& currentGroup, bool trackChanges){ bool valueChanged = false; - const QPtrList *listOfChildren = widget->children(); + const TQPtrList *listOfChildren = widget->children(); if(!listOfChildren) return valueChanged; - QSqlPropertyMap *propertyMap = QSqlPropertyMap::defaultMap(); - QPtrListIterator it( *listOfChildren ); - QObject *object; + TQSqlPropertyMap *propertyMap = TQSqlPropertyMap::defaultMap(); + TQPtrListIterator it( *listOfChildren ); + TQObject *object; while ( (object = it.current()) != 0 ) { ++it; if(!object->isWidgetType()){ continue; } - QWidget *childWidget = (QWidget *)object; + TQWidget *childWidget = (TQWidget *)object; if(d->ignore.containsRef(childWidget)){ continue; } @@ -385,12 +385,12 @@ bool KAutoConfig::parseChildren(const QWidget *widget, if( d->ignoreTheseWidgets[childWidget->className()] == 0 && childWidget->name(0) != NULL ) { - QVariant defaultSetting = propertyMap->property(childWidget); + TQVariant defaultSetting = propertyMap->property(childWidget); if(defaultSetting.isValid()) { parseTheChildren = false; // Disable the widget if it is immutable? - if(config->entryIsImmutable( QString::fromLatin1(childWidget->name()))) + if(config->entryIsImmutable( TQString::fromLatin1(childWidget->name()))) childWidget->setEnabled(false); else { @@ -401,22 +401,22 @@ bool KAutoConfig::parseChildren(const QWidget *widget, d->defaultValues.insert(childWidget, defaultSetting); } // Get/Set settings and connect up the changed signal - QVariant setting = + TQVariant setting = config->readPropertyEntry(childWidget->name(), defaultSetting); if(setting != defaultSetting) { propertyMap->setProperty(childWidget, setting); valueChanged = true; } - if(trackChanges && changedMap.find(QString::fromLatin1(childWidget->className())) != + if(trackChanges && changedMap.find(TQString::fromLatin1(childWidget->className())) != changedMap.end()) { - connect(childWidget, changedMap[QString::fromLatin1(childWidget->className())], - this, SIGNAL(widgetModified())); + connect(childWidget, changedMap[TQString::fromLatin1(childWidget->className())], + this, TQT_SIGNAL(widgetModified())); } #ifndef NDEBUG else if(trackChanges && - changedMap.find(QString::fromLatin1(childWidget->className())) == changedMap.end()) + changedMap.find(TQString::fromLatin1(childWidget->className())) == changedMap.end()) { // Without a signal kautoconfigdialog could incorectly // enable/disable the buttons -- cgit v1.2.1