From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/clock/dtime.cpp | 138 +++++++++++++++++++++++------------------------ kcontrol/clock/dtime.h | 44 +++++++-------- kcontrol/clock/main.cpp | 16 +++--- kcontrol/clock/main.h | 4 +- kcontrol/clock/tzone.cpp | 44 +++++++-------- kcontrol/clock/tzone.h | 6 +-- 6 files changed, 126 insertions(+), 126 deletions(-) (limited to 'kcontrol/clock') diff --git a/kcontrol/clock/dtime.cpp b/kcontrol/clock/dtime.cpp index ba8330c7a..109e436c4 100644 --- a/kcontrol/clock/dtime.cpp +++ b/kcontrol/clock/dtime.cpp @@ -22,15 +22,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -42,22 +42,22 @@ #include "dtime.h" #include "dtime.moc" -HMSTimeWidget::HMSTimeWidget(QWidget *parent, const char *name) : +HMSTimeWidget::HMSTimeWidget(TQWidget *parent, const char *name) : KIntSpinBox(parent, name) { } -QString HMSTimeWidget::mapValueToText(int value) +TQString HMSTimeWidget::mapValueToText(int value) { - QString s = QString::number(value); + TQString s = TQString::number(value); if( value < 10 ) { s = "0" + s; } return s; } -Dtime::Dtime(QWidget * parent, const char *name) - : QWidget(parent, name) +Dtime::Dtime(TQWidget * parent, const char *name) + : TQWidget(parent, name) { // ************************************************************* // Start Dialog @@ -65,51 +65,51 @@ Dtime::Dtime(QWidget * parent, const char *name) // Time Server - privateLayoutWidget = new QWidget( this, "layout1" ); - QHBoxLayout *layout1 = new QHBoxLayout( privateLayoutWidget, 0, 0, "ntplayout"); + privateLayoutWidget = new TQWidget( this, "layout1" ); + TQHBoxLayout *layout1 = new TQHBoxLayout( privateLayoutWidget, 0, 0, "ntplayout"); - setDateTimeAuto = new QCheckBox( privateLayoutWidget, "setDateTimeAuto" ); + setDateTimeAuto = new TQCheckBox( privateLayoutWidget, "setDateTimeAuto" ); setDateTimeAuto->setText(i18n("Set date and time &automatically:")); - connect(setDateTimeAuto, SIGNAL(toggled(bool)), this, SLOT(serverTimeCheck())); - connect(setDateTimeAuto, SIGNAL(toggled(bool)), SLOT(configChanged())); + connect(setDateTimeAuto, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(serverTimeCheck())); + connect(setDateTimeAuto, TQT_SIGNAL(toggled(bool)), TQT_SLOT(configChanged())); layout1->addWidget( setDateTimeAuto ); - timeServerList = new QComboBox( false, privateLayoutWidget, "timeServerList" ); - connect(timeServerList, SIGNAL(activated(int)), SLOT(configChanged())); - connect(timeServerList, SIGNAL(textChanged(const QString &)), SLOT(configChanged())); - connect(setDateTimeAuto, SIGNAL(toggled(bool)), timeServerList, SLOT(setEnabled(bool))); + timeServerList = new TQComboBox( false, privateLayoutWidget, "timeServerList" ); + connect(timeServerList, TQT_SIGNAL(activated(int)), TQT_SLOT(configChanged())); + connect(timeServerList, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(configChanged())); + connect(setDateTimeAuto, TQT_SIGNAL(toggled(bool)), timeServerList, TQT_SLOT(setEnabled(bool))); timeServerList->setEnabled(false); timeServerList->setEditable(true); layout1->addWidget( timeServerList ); findNTPutility(); // Date box - QGroupBox* dateBox = new QGroupBox( this, "dateBox" ); + TQGroupBox* dateBox = new TQGroupBox( this, "dateBox" ); - QVBoxLayout *l1 = new QVBoxLayout( dateBox, KDialog::spacingHint() ); + TQVBoxLayout *l1 = new TQVBoxLayout( dateBox, KDialog::spacingHint() ); cal = new KDatePicker( dateBox ); cal->setMinimumSize(cal->sizeHint()); l1->addWidget( cal ); - QWhatsThis::add( cal, i18n("Here you can change the system date's day of the month, month and year.") ); + TQWhatsThis::add( cal, i18n("Here you can change the system date's day of the month, month and year.") ); // Time frame - QGroupBox* timeBox = new QGroupBox( this, "timeBox" ); + TQGroupBox* timeBox = new TQGroupBox( this, "timeBox" ); - QVBoxLayout *v2 = new QVBoxLayout( timeBox, KDialog::spacingHint() ); + TQVBoxLayout *v2 = new TQVBoxLayout( timeBox, KDialog::spacingHint() ); kclock = new Kclock( timeBox, "kclock" ); kclock->setMinimumSize(150,150); v2->addWidget( kclock ); - QGridLayout *v3 = new QGridLayout( v2, 2, 9 ); + TQGridLayout *v3 = new TQGridLayout( v2, 2, 9 ); // Even if the module's widgets are reversed (usually when using RTL // languages), the placing of the time fields must always be H:M:S, from // left to right. - bool isRTL = QApplication::reverseLayout(); + bool isRTL = TQApplication::reverseLayout(); - QSpacerItem *spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + TQSpacerItem *spacer1 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); v3->addMultiCell(spacer1, 0, 1, 1, 1); hour = new HMSTimeWidget( timeBox ); @@ -118,9 +118,9 @@ Dtime::Dtime(QWidget * parent, const char *name) hour->setValidator(new KStrictIntValidator(0, 23, hour)); v3->addMultiCellWidget(hour, 0, 1, isRTL ? 6 : 2, isRTL ? 6 : 2 ); - QLabel *dots1 = new QLabel(":", timeBox); + TQLabel *dots1 = new TQLabel(":", timeBox); dots1->setMinimumWidth( 7 ); - dots1->setAlignment( QLabel::AlignCenter ); + dots1->setAlignment( TQLabel::AlignCenter ); v3->addMultiCellWidget(dots1, 0, 1, 3, 3 ); minute = new HMSTimeWidget( timeBox ); @@ -130,9 +130,9 @@ Dtime::Dtime(QWidget * parent, const char *name) minute->setValidator(new KStrictIntValidator(0, 59, minute)); v3->addMultiCellWidget(minute, 0, 1, 4, 4 ); - QLabel *dots2 = new QLabel(":", timeBox); + TQLabel *dots2 = new TQLabel(":", timeBox); dots2->setMinimumWidth( 7 ); - dots2->setAlignment( QLabel::AlignCenter ); + dots2->setAlignment( TQLabel::AlignCenter ); v3->addMultiCellWidget(dots2, 0, 1, 5, 5 ); second = new HMSTimeWidget( timeBox ); @@ -144,17 +144,17 @@ Dtime::Dtime(QWidget * parent, const char *name) v3->addColSpacing(7, 7); - QString wtstr = i18n("Here you can change the system time. Click into the" + TQString wtstr = i18n("Here you can change the system time. Click into the" " hours, minutes or seconds field to change the relevant value, either" " using the up and down buttons to the right or by entering a new value."); - QWhatsThis::add( hour, wtstr ); - QWhatsThis::add( minute, wtstr ); - QWhatsThis::add( second, wtstr ); + TQWhatsThis::add( hour, wtstr ); + TQWhatsThis::add( minute, wtstr ); + TQWhatsThis::add( second, wtstr ); - QSpacerItem *spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + TQSpacerItem *spacer3 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); v3->addMultiCell(spacer3, 0, 1, 9, 9); - QGridLayout *top = new QGridLayout( this, 2,2, KDialog::spacingHint() ); + TQGridLayout *top = new TQGridLayout( this, 2,2, KDialog::spacingHint() ); top->addWidget(dateBox, 1,0); top->addWidget(timeBox, 1,1); @@ -164,12 +164,12 @@ Dtime::Dtime(QWidget * parent, const char *name) // End Dialog // ************************************************************* - connect( hour, SIGNAL(valueChanged(int)), SLOT(set_time()) ); - connect( minute, SIGNAL(valueChanged(int)), SLOT(set_time()) ); - connect( second, SIGNAL(valueChanged(int)), SLOT(set_time()) ); - connect( cal, SIGNAL(dateChanged(QDate)), SLOT(changeDate(QDate))); + connect( hour, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(set_time()) ); + connect( minute, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(set_time()) ); + connect( second, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(set_time()) ); + connect( cal, TQT_SIGNAL(dateChanged(TQDate)), TQT_SLOT(changeDate(TQDate))); - connect( &internalTimer, SIGNAL(timeout()), SLOT(timeout()) ); + connect( &internalTimer, TQT_SIGNAL(timeout()), TQT_SLOT(timeout()) ); load(); @@ -228,7 +228,7 @@ void Dtime::set_time() emit timeChanged( TRUE ); } -void Dtime::changeDate(QDate d) +void Dtime::changeDate(TQDate d) { date = d; emit timeChanged( TRUE ); @@ -242,7 +242,7 @@ void Dtime::load() { KConfig config("kcmclockrc", true, false); config.setGroup("NTP"); - timeServerList->insertStringList(QStringList::split(',', config.readEntry("servers", + timeServerList->insertStringList(TQStringList::split(',', config.readEntry("servers", i18n("Public Time Server (pool.ntp.org),\ asia.pool.ntp.org,\ europe.pool.ntp.org,\ @@ -251,8 +251,8 @@ oceania.pool.ntp.org")))); setDateTimeAuto->setChecked(config.readBoolEntry("enabled", false)); // Reset to the current date and time - time = QTime::currentTime(); - date = QDate::currentDate(); + time = TQTime::currentTime(); + date = TQDate::currentDate(); cal->setDate(date); // start internal timer @@ -267,11 +267,11 @@ void Dtime::save() config.setGroup("NTP"); // Save the order, but don't duplicate! - QStringList list; + TQStringList list; if( timeServerList->count() != 0) list.append(timeServerList->currentText()); for ( int i=0; icount();i++ ) { - QString text = timeServerList->text(i); + TQString text = timeServerList->text(i); if( list.find(text) == list.end()) list.append(text); // Limit so errors can go away and not stored forever @@ -283,17 +283,17 @@ void Dtime::save() if(setDateTimeAuto->isChecked() && !ntpUtility.isEmpty()){ // NTP Time setting - QString timeServer = timeServerList->currentText(); - if( timeServer.find( QRegExp(".*\\(.*\\)$") ) != -1 ) { - timeServer.replace( QRegExp(".*\\("), "" ); - timeServer.replace( QRegExp("\\).*"), "" ); + TQString timeServer = timeServerList->currentText(); + if( timeServer.find( TQRegExp(".*\\(.*\\)$") ) != -1 ) { + timeServer.replace( TQRegExp(".*\\("), "" ); + timeServer.replace( TQRegExp("\\).*"), "" ); // Would this be better?: s/^.*\(([^)]*)\).*$/\1/ } KProcess proc; proc << ntpUtility << timeServer; proc.start( KProcess::Block ); if( proc.exitStatus() != 0 ){ - KMessageBox::error( this, i18n(QString("Unable to contact time server: %1.").arg(timeServer).latin1())); + KMessageBox::error( this, i18n(TQString("Unable to contact time server: %1.").arg(timeServer).latin1())); setDateTimeAuto->setChecked( false ); } else { @@ -345,7 +345,7 @@ void Dtime::save() void Dtime::timeout() { // get current time - time = QTime::currentTime(); + time = TQTime::currentTime(); ontimeout = TRUE; second->setValue(time.second()); @@ -356,7 +356,7 @@ void Dtime::timeout() kclock->setTime( time ); } -QString Dtime::quickHelp() const +TQString Dtime::quickHelp() const { return i18n("

Date & Time

This control module can be used to set the system date and" " time. As these settings do not only affect you as a user, but rather the whole system, you" @@ -365,32 +365,32 @@ QString Dtime::quickHelp() const " administrator."); } -void Kclock::setTime(const QTime &time) +void Kclock::setTime(const TQTime &time) { this->time = time; repaint(); } -void Kclock::paintEvent( QPaintEvent * ) +void Kclock::paintEvent( TQPaintEvent * ) { if ( !isVisible() ) return; - QPainter paint; + TQPainter paint; paint.begin( this ); - QPointArray pts; - QPoint cp = rect().center(); + TQPointArray pts; + TQPoint cp = rect().center(); int d = QMIN(width(),height()); - QColor hands = colorGroup().dark(); - QColor shadow = colorGroup().text(); + TQColor hands = colorGroup().dark(); + TQColor shadow = colorGroup().text(); paint.setPen( shadow ); paint.setBrush( shadow ); paint.setViewport(4,4,width(),height()); for ( int c=0 ; c < 2 ; c++ ) { - QWMatrix matrix; + TQWMatrix matrix; matrix.translate( cp.x(), cp.y() ); matrix.scale( d/1000.0F, d/1000.0F ); @@ -435,12 +435,12 @@ void Kclock::paintEvent( QPaintEvent * ) paint.end(); } -QValidator::State KStrictIntValidator::validate( QString & input, int & d ) const +TQValidator::State KStrictIntValidator::validate( TQString & input, int & d ) const { if( input.isEmpty() ) return Valid; - State st = QIntValidator::validate( input, d ); + State st = TQIntValidator::validate( input, d ); if( st == Intermediate ) return Invalid; diff --git a/kcontrol/clock/dtime.h b/kcontrol/clock/dtime.h index 5fcbb62df..cf6cccc63 100644 --- a/kcontrol/clock/dtime.h +++ b/kcontrol/clock/dtime.h @@ -22,14 +22,14 @@ #ifndef dtime_included #define dtime_included -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -40,21 +40,21 @@ class HMSTimeWidget : public KIntSpinBox { Q_OBJECT public: - HMSTimeWidget(QWidget *parent=0, const char *name=0); + HMSTimeWidget(TQWidget *parent=0, const char *name=0); protected: - QString mapValueToText(int); + TQString mapValueToText(int); }; class Dtime : public QWidget { Q_OBJECT public: - Dtime( QWidget *parent=0, const char* name=0 ); + Dtime( TQWidget *parent=0, const char* name=0 ); void save(); void load(); - QString quickHelp() const; + TQString quickHelp() const; signals: void timeChanged(bool); @@ -64,13 +64,13 @@ signals: void serverTimeCheck(); void timeout(); void set_time(); - void changeDate(QDate); + void changeDate(TQDate); private: void findNTPutility(); QString ntpUtility; - QWidget* privateLayoutWidget; + TQWidget* privateLayoutWidget; QCheckBox *setDateTimeAuto; QComboBox *timeServerList; @@ -99,27 +99,27 @@ class Kclock : public QWidget Q_OBJECT public: - Kclock( QWidget *parent=0, const char *name=0 ) - : QWidget(parent, name) {}; + Kclock( TQWidget *parent=0, const char *name=0 ) + : TQWidget(parent, name) {}; - void setTime(const QTime&); + void setTime(const TQTime&); protected: - virtual void paintEvent( QPaintEvent *event ); + virtual void paintEvent( TQPaintEvent *event ); private: QTime time; }; -class KStrictIntValidator : public QIntValidator +class KStrictIntValidator : public TQIntValidator { public: - KStrictIntValidator(int bottom, int top, QWidget * parent, + KStrictIntValidator(int bottom, int top, TQWidget * parent, const char * name = 0 ) - : QIntValidator(bottom, top, parent, name) {}; + : TQIntValidator(bottom, top, parent, name) {}; - QValidator::State validate( QString & input, int & d ) const; + TQValidator::State validate( TQString & input, int & d ) const; }; #endif // dtime_included diff --git a/kcontrol/clock/main.cpp b/kcontrol/clock/main.cpp index 8522973a1..86e47e7ad 100644 --- a/kcontrol/clock/main.cpp +++ b/kcontrol/clock/main.cpp @@ -20,8 +20,8 @@ */ #include -#include -#include +#include +#include #include @@ -36,10 +36,10 @@ #include "tzone.h" #include "dtime.h" -typedef KGenericFactory KlockModuleFactory; +typedef KGenericFactory KlockModuleFactory; K_EXPORT_COMPONENT_FACTORY( kcm_clock, KlockModuleFactory("kcmkclock")) -KclockModule::KclockModule(QWidget *parent, const char *name, const QStringList &) +KclockModule::KclockModule(TQWidget *parent, const char *name, const TQStringList &) : KCModule(KlockModuleFactory::instance(), parent, name) { KAboutData *about = @@ -59,15 +59,15 @@ KclockModule::KclockModule(QWidget *parent, const char *name, const QStringList KGlobal::locale()->insertCatalogue("timezones"); // For time zone translations - QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); + TQVBoxLayout *layout = new TQVBoxLayout(this, 0, KDialog::spacingHint()); dtime = new Dtime(this); layout->addWidget(dtime); - connect(dtime, SIGNAL(timeChanged(bool)), this, SIGNAL(changed(bool))); + connect(dtime, TQT_SIGNAL(timeChanged(bool)), this, TQT_SIGNAL(changed(bool))); tzone = new Tzone(this); layout->addWidget(tzone); - connect(tzone, SIGNAL(zoneChanged(bool)), this, SIGNAL(changed(bool))); + connect(tzone, TQT_SIGNAL(zoneChanged(bool)), this, TQT_SIGNAL(changed(bool))); layout->addStretch(); @@ -84,7 +84,7 @@ void KclockModule::save() tzone->save(); // Tell the clock applet about the change so that it can update its timezone - kapp->dcopClient()->send( "kicker", "ClockApplet", "reconfigure()", QByteArray() ); + kapp->dcopClient()->send( "kicker", "ClockApplet", "reconfigure()", TQByteArray() ); } void KclockModule::load() diff --git a/kcontrol/clock/main.h b/kcontrol/clock/main.h index 3c57469f0..53a060674 100644 --- a/kcontrol/clock/main.h +++ b/kcontrol/clock/main.h @@ -33,13 +33,13 @@ class KclockModule : public KCModule Q_OBJECT public: - KclockModule(QWidget *parent, const char *name, const QStringList &); + KclockModule(TQWidget *parent, const char *name, const TQStringList &); void save(); void load(); private: - QTabWidget *tab; + TQTabWidget *tab; Tzone *tzone; Dtime *dtime; }; diff --git a/kcontrol/clock/tzone.cpp b/kcontrol/clock/tzone.cpp index fad22152a..506bde5b6 100644 --- a/kcontrol/clock/tzone.cpp +++ b/kcontrol/clock/tzone.cpp @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -46,15 +46,15 @@ #include #endif -Tzone::Tzone(QWidget * parent, const char *name) - : QVGroupBox(parent, name) +Tzone::Tzone(TQWidget * parent, const char *name) + : TQVGroupBox(parent, name) { setTitle(i18n("To change the timezone, select your area from the list below")); tzonelist = new KTimezoneWidget(this, "ComboBox_1", &m_zoneDb); - connect( tzonelist, SIGNAL(selectionChanged()), SLOT(handleZoneChange()) ); + connect( tzonelist, TQT_SIGNAL(selectionChanged()), TQT_SLOT(handleZoneChange()) ); - m_local = new QLabel(this); + m_local = new TQLabel(this); load(); @@ -71,8 +71,8 @@ void Tzone::load() void Tzone::currentZone() { - QString localZone(i18n("Current local timezone: %1 (%2)")); - QCString result(100); + TQString localZone(i18n("Current local timezone: %1 (%2)")); + TQCString result(100); time_t now = time(0); tzset(); @@ -84,33 +84,33 @@ void Tzone::currentZone() // on non-Solaris systems which do not use /etc/timezone? void Tzone::save() { - QStringList selectedZones(tzonelist->selection()); + TQStringList selectedZones(tzonelist->selection()); if (selectedZones.count() > 0) { // Find untranslated selected zone - QString selectedzone(selectedZones[0]); + TQString selectedzone(selectedZones[0]); #if defined(USE_SOLARIS) // MARCO KTempFile tf( locateLocal( "tmp", "kde-tzone" ) ); tf.setAutoDelete( true ); - QTextStream *ts = tf.textStream(); + TQTextStream *ts = tf.textStream(); # ifndef INITFILE # define INITFILE "/etc/default/init" # endif - QFile fTimezoneFile(INITFILE); + TQFile fTimezoneFile(INITFILE); bool updatedFile = false; if (tf.status() == 0 && fTimezoneFile.open(IO_ReadOnly)) { bool found = false; - QTextStream is(&fTimezoneFile); + TQTextStream is(&fTimezoneFile); - for (QString line = is.readLine(); !line.isNull(); + for (TQString line = is.readLine(); !line.isNull(); line = is.readLine()) { if (line.find("TZ=") == 0) @@ -140,9 +140,9 @@ void Tzone::save() if (fTimezoneFile.open(IO_WriteOnly | IO_Truncate)) { - QTextStream os(&fTimezoneFile); + TQTextStream os(&fTimezoneFile); - for (QString line = ts->readLine(); !line.isNull(); + for (TQString line = ts->readLine(); !line.isNull(); line = ts->readLine()) { os << line << endl; @@ -156,22 +156,22 @@ void Tzone::save() } - QString val = selectedzone; + TQString val = selectedzone; #else - QFile fTimezoneFile("/etc/timezone"); + TQFile fTimezoneFile("/etc/timezone"); if (fTimezoneFile.open(IO_WriteOnly | IO_Truncate) ) { - QTextStream t(&fTimezoneFile); + TQTextStream t(&fTimezoneFile); t << selectedzone; fTimezoneFile.close(); } - QString tz = "/usr/share/zoneinfo/" + selectedzone; + TQString tz = "/usr/share/zoneinfo/" + selectedzone; kdDebug() << "Set time zone " << tz << endl; - if (!QFile::remove("/etc/localtime")) + if (!TQFile::remove("/etc/localtime")) { //After the KDE 3.2 release, need to add an error message } @@ -180,7 +180,7 @@ void Tzone::save() KMessageBox::error( 0, i18n("Error setting new timezone."), i18n("Timezone Error")); - QString val = ":" + tz; + TQString val = ":" + tz; #endif // !USE_SOLARIS setenv("TZ", val.ascii(), 1); diff --git a/kcontrol/clock/tzone.h b/kcontrol/clock/tzone.h index 618cb10c6..fe9119773 100644 --- a/kcontrol/clock/tzone.h +++ b/kcontrol/clock/tzone.h @@ -24,7 +24,7 @@ #include #include -#include +#include class QComboBox; class QLabel; @@ -34,7 +34,7 @@ class Tzone : public QVGroupBox Q_OBJECT public: - Tzone( QWidget *parent=0, const char* name=0 ); + Tzone( TQWidget *parent=0, const char* name=0 ); void save(); void load(); @@ -48,7 +48,7 @@ protected slots: private: void currentZone(); KTimezones m_zoneDb; - QLabel *m_local; + TQLabel *m_local; KTimezoneWidget *tzonelist; }; -- cgit v1.2.3