From aa3a1ca934bc541bddd3fa136a85f106f7da266e Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:25:18 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1157635 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcron/kttask.cpp | 226 +++++++++++++++++++++++++++---------------------------- 1 file changed, 113 insertions(+), 113 deletions(-) (limited to 'kcron/kttask.cpp') diff --git a/kcron/kttask.cpp b/kcron/kttask.cpp index 500cab4..88e5567 100644 --- a/kcron/kttask.cpp +++ b/kcron/kttask.cpp @@ -11,15 +11,15 @@ #include "kttask.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -36,37 +36,37 @@ class KTPushButton : public QPushButton { public: - KTPushButton(QWidget * parent, const char * name = 0 ) - : QPushButton(parent, name), isSelected(false), isDirty(false) + KTPushButton(TQWidget * parent, const char * name = 0 ) + : TQPushButton(parent, name), isSelected(false), isDirty(false) { updatePalette(); } void updatePalette() { - palNormal = ((QWidget *)parent())->palette(); + palNormal = ((TQWidget *)parent())->palette(); palSelected = palNormal; - for(int cg = (int) QPalette::Disabled; cg < (int) QPalette::NColorGroups; cg++) + for(int cg = (int) TQPalette::Disabled; cg < (int) TQPalette::NColorGroups; cg++) { - palSelected.setColor((QPalette::ColorGroup)cg, QColorGroup::Button, - palSelected.color((QPalette::ColorGroup)cg, QColorGroup::Highlight)); - palSelected.setColor((QPalette::ColorGroup)cg, QColorGroup::ButtonText, - palSelected.color((QPalette::ColorGroup)cg, QColorGroup::HighlightedText)); + palSelected.setColor((TQPalette::ColorGroup)cg, TQColorGroup::Button, + palSelected.color((TQPalette::ColorGroup)cg, TQColorGroup::Highlight)); + palSelected.setColor((TQPalette::ColorGroup)cg, TQColorGroup::ButtonText, + palSelected.color((TQPalette::ColorGroup)cg, TQColorGroup::HighlightedText)); } isDirty = true; } - bool event( QEvent *e) + bool event( TQEvent *e) { - if (e->type() == QEvent::ParentPaletteChange) + if (e->type() == TQEvent::ParentPaletteChange) { updatePalette(); update(); } - return QPushButton::event(e); + return TQPushButton::event(e); } - void drawButton ( QPainter *p ) + void drawButton ( TQPainter *p ) { if (isDirty || (isOn() != isSelected)) // Prevent infinite recursion { @@ -77,48 +77,48 @@ public: else setPalette(palNormal); } - QPushButton::drawButton(p); + TQPushButton::drawButton(p); } - void drawButtonLabel ( QPainter *p ) + void drawButtonLabel ( TQPainter *p ) { p->save(); if (isOn()) { - QFont f = p->font(); + TQFont f = p->font(); f.setUnderline(true); p->setFont(f); } - QPushButton::drawButtonLabel(p); + TQPushButton::drawButtonLabel(p); p->restore(); } bool isSelected; bool isDirty; - QPalette palSelected; - QPalette palNormal; + TQPalette palSelected; + TQPalette palNormal; }; -KTTask::KTTask(CTTask* _cttask, const QString & _caption) +KTTask::KTTask(CTTask* _cttask, const TQString & _caption) :KDialog( 0, "kttask", true, WStyle_DialogBorder ) { cttask = _cttask; bool everyDay(true); - QVBoxLayout *ml = new QVBoxLayout( this, KDialogBase::spacingHint() ); + TQVBoxLayout *ml = new TQVBoxLayout( this, KDialogBase::spacingHint() ); - QHBoxLayout *h1 = new QHBoxLayout( ml, KDialogBase::spacingHint() ); + TQHBoxLayout *h1 = new TQHBoxLayout( ml, KDialogBase::spacingHint() ); // user - labUser = new QLabel( i18n("&Run as:"), this, "labUser" ); + labUser = new TQLabel( i18n("&Run as:"), this, "labUser" ); h1->addWidget( labUser ); - leUser = new QLineEdit( this, "leUser"); + leUser = new TQLineEdit( this, "leUser"); labUser->setBuddy(leUser); h1->addWidget( leUser ); if (cttask->system()) { - leUser->setText(QString::fromLocal8Bit(cttask->user.c_str())); + leUser->setText(TQString::fromLocal8Bit(cttask->user.c_str())); } else { @@ -127,92 +127,92 @@ KTTask::KTTask(CTTask* _cttask, const QString & _caption) } // icon - labIcon = new QLabel(this, "labIcon"); + labIcon = new TQLabel(this, "labIcon"); labIcon->setFixedSize(32, 32); h1->addStretch( 1 ); h1->addWidget( labIcon ); // comment - QHBoxLayout *h2 = new QHBoxLayout( ml, KDialogBase::spacingHint() ); + TQHBoxLayout *h2 = new TQHBoxLayout( ml, KDialogBase::spacingHint() ); - labComment = new QLabel( i18n("&Comment:"), this, "labComment" ); + labComment = new TQLabel( i18n("&Comment:"), this, "labComment" ); h2->addWidget( labComment ); - leComment = new QLineEdit(this, "leComment"); + leComment = new TQLineEdit(this, "leComment"); labComment->setBuddy(leComment); h2->addWidget( leComment ); - leComment->setText(QString::fromLocal8Bit(cttask->comment.c_str())); + leComment->setText(TQString::fromLocal8Bit(cttask->comment.c_str())); // command - QHBoxLayout *h3 = new QHBoxLayout( ml, KDialogBase::spacingHint() ); + TQHBoxLayout *h3 = new TQHBoxLayout( ml, KDialogBase::spacingHint() ); - labCommand = new QLabel( i18n("&Program:"), this, "labCommand" ); + labCommand = new TQLabel( i18n("&Program:"), this, "labCommand" ); h3->addWidget( labCommand ); - leCommand = new QLineEdit(this, "leCommand"); + leCommand = new TQLineEdit(this, "leCommand"); labCommand->setBuddy(leCommand); h3->addWidget( leCommand ); - leCommand->setText(QString::fromLocal8Bit(cttask->command.c_str())); + leCommand->setText(TQString::fromLocal8Bit(cttask->command.c_str())); labComment->setFixedWidth( QMAX( labComment->width(), labCommand->width()) ); labCommand->setFixedWidth( QMAX( labComment->width(), labCommand->width()) ); slotCommandChanged(); - pbBrowse = new QPushButton(this, "pbBrowse"); + pbBrowse = new TQPushButton(this, "pbBrowse"); pbBrowse->setText(i18n("&Browse...")); h3->addWidget( pbBrowse ); - QHBoxLayout *h3a = new QHBoxLayout( ml, KDialogBase::spacingHint() ); + TQHBoxLayout *h3a = new TQHBoxLayout( ml, KDialogBase::spacingHint() ); // enabled - chkEnabled = new QCheckBox(i18n("&Enabled"), this, "chkEnabled"); + chkEnabled = new TQCheckBox(i18n("&Enabled"), this, "chkEnabled"); chkEnabled->setChecked(cttask->enabled); h3a->addWidget( chkEnabled ); - QHBoxLayout *h4 = new QHBoxLayout( ml, KDialogBase::spacingHint() ); + TQHBoxLayout *h4 = new TQHBoxLayout( ml, KDialogBase::spacingHint() ); ml->addSpacing( 2 * KDialogBase::spacingHint() ); // months - bgMonth = new QButtonGroup( i18n("Months"), this, "bgMonth"); + bgMonth = new TQButtonGroup( i18n("Months"), this, "bgMonth"); h4->addWidget( bgMonth ); - QVBoxLayout *vmonths = new QVBoxLayout( bgMonth, KDialogBase::spacingHint() ); + TQVBoxLayout *vmonths = new TQVBoxLayout( bgMonth, KDialogBase::spacingHint() ); vmonths->addSpacing( 2 * KDialogBase::spacingHint() ); for (int mo = 1; mo <= 12; mo++) { - cbMonth[mo] = new QCheckBox(bgMonth, "cbMonth"); - cbMonth[mo]->setText(QString::fromLocal8Bit(cttask->month.getName(mo).c_str())); + cbMonth[mo] = new TQCheckBox(bgMonth, "cbMonth"); + cbMonth[mo]->setText(TQString::fromLocal8Bit(cttask->month.getName(mo).c_str())); cbMonth[mo]->setChecked(cttask->month.get(mo)); vmonths->addWidget( cbMonth[mo], AlignLeft ); if (!cttask->month.get(mo)) everyDay = false; } - pbAllMonths = new QPushButton(bgMonth, "pbAllMonths"); + pbAllMonths = new TQPushButton(bgMonth, "pbAllMonths"); pbAllMonths->setText( i18n("Set All") ); vmonths->addWidget( pbAllMonths, AlignLeft ); - QVBoxLayout *v1 = new QVBoxLayout( h4, KDialogBase::spacingHint() ); + TQVBoxLayout *v1 = new TQVBoxLayout( h4, KDialogBase::spacingHint() ); // days of the month - bgDayOfMonth = new QButtonGroup( i18n("Days of Month"), this, "bgDayOfMonth"); + bgDayOfMonth = new TQButtonGroup( i18n("Days of Month"), this, "bgDayOfMonth"); v1->addWidget( bgDayOfMonth ); - QPushButton* day; - QString tmp; + TQPushButton* day; + TQString tmp; - QVBoxLayout *vdays = new QVBoxLayout( bgDayOfMonth, KDialogBase::spacingHint() ); + TQVBoxLayout *vdays = new TQVBoxLayout( bgDayOfMonth, KDialogBase::spacingHint() ); vdays->addSpacing( 2 * KDialogBase::spacingHint() ); - QHBoxLayout *hdays = 0; + TQHBoxLayout *hdays = 0; for (int dm = 1; dm <= 31; dm++) { if( (dm % 7) == 1 ) - hdays = new QHBoxLayout( vdays, KDialogBase::spacingHint() ); + hdays = new TQHBoxLayout( vdays, KDialogBase::spacingHint() ); day = new KTPushButton(bgDayOfMonth); day->setFixedSize(25, 25); @@ -225,50 +225,50 @@ KTTask::KTTask(CTTask* _cttask, const QString & _caption) hdays->addWidget( day, AlignLeft ); } hdays->addStretch( 1 ); - pbAllDaysOfMonth = new QPushButton(bgDayOfMonth, "pbAllDaysOfMonth"); + pbAllDaysOfMonth = new TQPushButton(bgDayOfMonth, "pbAllDaysOfMonth"); pbAllDaysOfMonth->setText( i18n("Set All") ); hdays->addWidget( pbAllDaysOfMonth, AlignLeft ); // days of the week - bgDayOfWeek = new QButtonGroup( i18n("Days of Week"), this, "bgDayOfWeek"); + bgDayOfWeek = new TQButtonGroup( i18n("Days of Week"), this, "bgDayOfWeek"); v1->addWidget( bgDayOfWeek ); - QVBoxLayout *v3 = new QVBoxLayout( bgDayOfWeek, KDialogBase::spacingHint() ); + TQVBoxLayout *v3 = new TQVBoxLayout( bgDayOfWeek, KDialogBase::spacingHint() ); v3->addSpacing( 2 * KDialogBase::spacingHint() ); for (int dw = 1; dw <= 7; dw++) { - cbDayOfWeek[dw] = new QCheckBox(bgDayOfWeek); - cbDayOfWeek[dw]->setText(QString::fromLocal8Bit(cttask->dayOfWeek.getName(dw).c_str())); + cbDayOfWeek[dw] = new TQCheckBox(bgDayOfWeek); + cbDayOfWeek[dw]->setText(TQString::fromLocal8Bit(cttask->dayOfWeek.getName(dw).c_str())); cbDayOfWeek[dw]->setChecked(cttask->dayOfWeek.get(dw)); v3->addWidget( cbDayOfWeek[dw] ); if (!cttask->dayOfWeek.get(dw)) everyDay = false; } - pbAllDaysOfWeek = new QPushButton(bgDayOfWeek, "pbAllDaysOfWeek"); + pbAllDaysOfWeek = new TQPushButton(bgDayOfWeek, "pbAllDaysOfWeek"); pbAllDaysOfWeek->setText( i18n("Set All") ); v3->addWidget( pbAllDaysOfWeek, AlignLeft ); - QVBoxLayout *v2 = new QVBoxLayout( h4, KDialogBase::spacingHint() ); + TQVBoxLayout *v2 = new TQVBoxLayout( h4, KDialogBase::spacingHint() ); // daily - bgEveryDay = new QButtonGroup( i18n("Daily"), this, "bgEveryDay"); + bgEveryDay = new TQButtonGroup( i18n("Daily"), this, "bgEveryDay"); v2->addWidget( bgEveryDay ); - QVBoxLayout *v9 = new QVBoxLayout( bgEveryDay, KDialogBase::spacingHint() ); + TQVBoxLayout *v9 = new TQVBoxLayout( bgEveryDay, KDialogBase::spacingHint() ); v9->addSpacing( 2 * KDialogBase::spacingHint() ); - cbEveryDay = new QCheckBox( i18n("Run every day"), bgEveryDay, "cbEveryDay"); + cbEveryDay = new TQCheckBox( i18n("Run every day"), bgEveryDay, "cbEveryDay"); cbEveryDay->setChecked(everyDay); v9->addWidget( cbEveryDay ); // hours - bgHour = new QButtonGroup( i18n("Hours"), this, "bgHour"); + bgHour = new TQButtonGroup( i18n("Hours"), this, "bgHour"); v2->addWidget( bgHour ); - QVBoxLayout *v4 = new QVBoxLayout( bgHour, KDialogBase::spacingHint() ); + TQVBoxLayout *v4 = new TQVBoxLayout( bgHour, KDialogBase::spacingHint() ); v4->addSpacing( 2 * KDialogBase::spacingHint() ); - labAM = new QLabel( i18n("AM"), bgHour, "labAM"); + labAM = new TQLabel( i18n("AM"), bgHour, "labAM"); labAM->setAlignment(AlignRight | AlignVCenter); v4->addWidget( labAM ); @@ -282,37 +282,37 @@ KTTask::KTTask(CTTask* _cttask, const QString & _caption) pbHour[ho]->setFixedSize(25, 25); } - QHBoxLayout *hhours = new QHBoxLayout( v4, KDialogBase::spacingHint() ); + TQHBoxLayout *hhours = new TQHBoxLayout( v4, KDialogBase::spacingHint() ); for (int ho1 = 0; ho1 <= 11; ho1++) { if( ho1 == 6 ) - hhours = new QHBoxLayout( v4, KDialogBase::spacingHint() ); + hhours = new TQHBoxLayout( v4, KDialogBase::spacingHint() ); hhours->addWidget( pbHour[ho1] ); } - labPM = new QLabel( i18n("PM"), bgHour, "labPM"); + labPM = new TQLabel( i18n("PM"), bgHour, "labPM"); labPM->setAlignment(AlignRight | AlignVCenter); v4->addWidget( labPM ); - hhours = new QHBoxLayout( v4, KDialogBase::spacingHint() ); + hhours = new TQHBoxLayout( v4, KDialogBase::spacingHint() ); for (int ho1 = 12; ho1 <= 23; ho1++) { if( ho1 == 18 ) - hhours = new QHBoxLayout( v4, KDialogBase::spacingHint() ); + hhours = new TQHBoxLayout( v4, KDialogBase::spacingHint() ); hhours->addWidget( pbHour[ho1] ); } - hhours = new QHBoxLayout( v4, KDialogBase::spacingHint() ); - pbAllHours = new QPushButton(bgHour, "pbAllHours"); + hhours = new TQHBoxLayout( v4, KDialogBase::spacingHint() ); + pbAllHours = new TQPushButton(bgHour, "pbAllHours"); pbAllHours->setText( i18n("Set All") ); hhours->addWidget( pbAllHours, AlignLeft ); // minutes - bgMinute = new QButtonGroup( i18n("Minutes"), this, "bgMinute"); + bgMinute = new TQButtonGroup( i18n("Minutes"), this, "bgMinute"); v2->addWidget( bgMinute ); - QVBoxLayout *vmin = new QVBoxLayout( bgMinute, KDialogBase::spacingHint() ); + TQVBoxLayout *vmin = new TQVBoxLayout( bgMinute, KDialogBase::spacingHint() ); vmin->addSpacing( 2 * KDialogBase::spacingHint() ); for (int mi = 0; mi <= 55; mi+=5) @@ -324,21 +324,21 @@ KTTask::KTTask(CTTask* _cttask, const QString & _caption) pbMinute[mi]->setFixedSize(25, 25); } - QHBoxLayout *hmin = new QHBoxLayout( vmin, KDialogBase::spacingHint() ); + TQHBoxLayout *hmin = new TQHBoxLayout( vmin, KDialogBase::spacingHint() ); for (int mi1 = 0; mi1 <= 55; mi1+=5) { if( mi1 == 30 ) - hmin = new QHBoxLayout( vmin, KDialogBase::spacingHint() ); + hmin = new TQHBoxLayout( vmin, KDialogBase::spacingHint() ); hmin->addWidget( pbMinute[mi1] ); } - hmin = new QHBoxLayout( vmin, KDialogBase::spacingHint() ); - pbAllMinutes = new QPushButton(bgMinute, "pbAllMinutes"); + hmin = new TQHBoxLayout( vmin, KDialogBase::spacingHint() ); + pbAllMinutes = new TQPushButton(bgMinute, "pbAllMinutes"); pbAllMinutes->setText( i18n("Set All") ); hmin->addWidget( pbAllMinutes, AlignLeft ); - QHBoxLayout *h5 = new QHBoxLayout( ml, KDialogBase::spacingHint() ); + TQHBoxLayout *h5 = new TQHBoxLayout( ml, KDialogBase::spacingHint() ); h5->addStretch( 1 ); // OK @@ -365,42 +365,42 @@ KTTask::KTTask(CTTask* _cttask, const QString & _caption) } // connect them up - connect(pbBrowse, SIGNAL(clicked()), SLOT(slotBrowse())); - connect(leCommand, SIGNAL(textChanged(const QString&)), - SLOT(slotCommandChanged())); - connect(cbEveryDay, SIGNAL(clicked()), SLOT(slotDailyChanged())); - connect(pbOk, SIGNAL(clicked()), SLOT(slotOK())); - connect(pbCancel, SIGNAL(clicked()), SLOT(slotCancel())); - connect(pbAllMonths, SIGNAL(clicked()), SLOT(slotAllMonths())); + connect(pbBrowse, TQT_SIGNAL(clicked()), TQT_SLOT(slotBrowse())); + connect(leCommand, TQT_SIGNAL(textChanged(const TQString&)), + TQT_SLOT(slotCommandChanged())); + connect(cbEveryDay, TQT_SIGNAL(clicked()), TQT_SLOT(slotDailyChanged())); + connect(pbOk, TQT_SIGNAL(clicked()), TQT_SLOT(slotOK())); + connect(pbCancel, TQT_SIGNAL(clicked()), TQT_SLOT(slotCancel())); + connect(pbAllMonths, TQT_SIGNAL(clicked()), TQT_SLOT(slotAllMonths())); for (int mo = 1; mo <= 12; mo++) { - connect(cbMonth[mo], SIGNAL(clicked()), SLOT(slotMonthChanged())); + connect(cbMonth[mo], TQT_SIGNAL(clicked()), TQT_SLOT(slotMonthChanged())); } - connect(pbAllDaysOfMonth, SIGNAL(clicked()), SLOT(slotAllDaysOfMonth())); + connect(pbAllDaysOfMonth, TQT_SIGNAL(clicked()), TQT_SLOT(slotAllDaysOfMonth())); for (int dm = 1; dm <= 31; dm++) { - connect(pbDayOfMonth[dm], SIGNAL(clicked()), SLOT(slotDayOfMonthChanged())); + connect(pbDayOfMonth[dm], TQT_SIGNAL(clicked()), TQT_SLOT(slotDayOfMonthChanged())); } - connect(pbAllDaysOfWeek, SIGNAL(clicked()), SLOT(slotAllDaysOfWeek())); + connect(pbAllDaysOfWeek, TQT_SIGNAL(clicked()), TQT_SLOT(slotAllDaysOfWeek())); for (int dw = 1; dw <= 7; dw++) { - connect(cbDayOfWeek[dw], SIGNAL(clicked()), SLOT(slotDayOfWeekChanged())); + connect(cbDayOfWeek[dw], TQT_SIGNAL(clicked()), TQT_SLOT(slotDayOfWeekChanged())); } - connect(pbAllHours, SIGNAL(clicked()), SLOT(slotAllHours())); + connect(pbAllHours, TQT_SIGNAL(clicked()), TQT_SLOT(slotAllHours())); for (int ho = 0; ho <= 23; ho++) { - connect(pbHour[ho], SIGNAL(clicked()), SLOT(slotHourChanged())); + connect(pbHour[ho], TQT_SIGNAL(clicked()), TQT_SLOT(slotHourChanged())); } - connect(pbAllMinutes, SIGNAL(clicked()), SLOT(slotAllMinutes())); + connect(pbAllMinutes, TQT_SIGNAL(clicked()), TQT_SLOT(slotAllMinutes())); for (int mi = 0; mi <= 55; mi+=5) { - connect(pbMinute[mi], SIGNAL(clicked()), SLOT(slotMinuteChanged())); + connect(pbMinute[mi], TQT_SIGNAL(clicked()), TQT_SLOT(slotMinuteChanged())); } // key acceleration key_accel = new KAccel(this); - key_accel->insert(KStdAccel::Open, this, SLOT(slotOK())); - key_accel->insert(KStdAccel::Close, this, SLOT(slotCancel())); - key_accel->insert(KStdAccel::Quit, this, SLOT(slotCancel())); + key_accel->insert(KStdAccel::Open, this, TQT_SLOT(slotOK())); + key_accel->insert(KStdAccel::Close, this, TQT_SLOT(slotCancel())); + key_accel->insert(KStdAccel::Quit, this, TQT_SLOT(slotCancel())); key_accel->readSettings(); setFixedSize( minimumSize() ); @@ -419,7 +419,7 @@ KTTask::~KTTask() void KTTask::slotCommandChanged() { /* - QString qs(leCommand->text()); + TQString qs(leCommand->text()); int beginPos(qs.findRev("/", qs.length()) + 1); if (beginPos < 0) beginPos = 0; @@ -427,9 +427,9 @@ void KTTask::slotCommandChanged() int endPos(qs.findRev(" ", qs.length())); if (endPos < 0) endPos = qs.length(); - QString iconName(qs.mid(beginPos, endPos-beginPos) + ".xpm"); + TQString iconName(qs.mid(beginPos, endPos-beginPos) + ".xpm"); - QPixmap qp(KTIcon::getIcon(iconName)); + TQPixmap qp(KTIcon::getIcon(iconName)); if (qp.isNull()) labIcon->setPixmap(KTIcon::task(false)); else @@ -520,8 +520,8 @@ void KTTask::slotOK() } // Now validate - QString message(i18n("Please enter the following to schedule the task:\n")); - QString sep("\n- "); + TQString message(i18n("Please enter the following to schedule the task:\n")); + TQString sep("\n- "); bool showMessage(false); if (leCommand->text().isEmpty()) @@ -608,13 +608,13 @@ void KTTask::slotOK() // make sure the file name is a good one if we have an // absolute path - QString qs(leCommand->text()); + TQString qs(leCommand->text()); if (qs.find("/") == 0) { int spacePos(qs.find(" ")); if (spacePos < 0) spacePos = qs.length(); - QString programName(qs.left(spacePos)); - QFileInfo file(programName); + TQString programName(qs.left(spacePos)); + TQFileInfo file(programName); if (!file.isReadable()) { @@ -636,7 +636,7 @@ void KTTask::slotOK() // save work in process if (!cttask->user.empty()) { - cttask->user = QFile::encodeName(leUser->text()); + cttask->user = TQFile::encodeName(leUser->text()); } else { -- cgit v1.2.1