diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kalarm/messagewin.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kalarm/messagewin.cpp')
-rw-r--r-- | kalarm/messagewin.cpp | 452 |
1 files changed, 226 insertions, 226 deletions
diff --git a/kalarm/messagewin.cpp b/kalarm/messagewin.cpp index acee6b9b3..35d769c50 100644 --- a/kalarm/messagewin.cpp +++ b/kalarm/messagewin.cpp @@ -23,16 +23,16 @@ #include <stdlib.h> #include <string.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qwhatsthis.h> -#include <qtooltip.h> -#include <qdragobject.h> -#include <qtextedit.h> -#include <qtimer.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> +#include <tqdragobject.h> +#include <tqtextedit.h> +#include <tqtimer.h> #include <kstandarddirs.h> #include <kaction.h> @@ -93,32 +93,32 @@ static bool wantModal(); class MessageText : public QTextEdit { public: - MessageText(const QString& text, const QString& context = QString::null, QWidget* parent = 0, const char* name = 0) - : QTextEdit(text, context, parent, name) + MessageText(const TQString& text, const TQString& context = TQString::null, TQWidget* parent = 0, const char* name = 0) + : TQTextEdit(text, context, parent, name) { setReadOnly(true); - setWordWrap(QTextEdit::NoWrap); + setWordWrap(TQTextEdit::NoWrap); } int scrollBarHeight() const { return horizontalScrollBar()->height(); } int scrollBarWidth() const { return verticalScrollBar()->width(); } - virtual QSize sizeHint() const { return QSize(contentsWidth() + scrollBarWidth(), contentsHeight() + scrollBarHeight()); } + virtual TQSize sizeHint() const { return TQSize(contentsWidth() + scrollBarWidth(), contentsHeight() + scrollBarHeight()); } }; class MWMimeSourceFactory : public QMimeSourceFactory { public: - MWMimeSourceFactory(const QString& absPath, KTextBrowser*); + MWMimeSourceFactory(const TQString& absPath, KTextBrowser*); virtual ~MWMimeSourceFactory(); - virtual const QMimeSource* data(const QString& abs_name) const; + virtual const TQMimeSource* data(const TQString& abs_name) const; private: // Prohibit the following methods - virtual void setData(const QString&, QMimeSource*) {} - virtual void setExtensionType(const QString&, const char*) {} + virtual void setData(const TQString&, TQMimeSource*) {} + virtual void setExtensionType(const TQString&, const char*) {} - QString mTextFile; - QCString mMimeType; - mutable const QMimeSource* mLast; + TQString mTextFile; + TQCString mMimeType; + mutable const TQMimeSource* mLast; }; @@ -133,8 +133,8 @@ enum { }; -QValueList<MessageWin*> MessageWin::mWindowList; -QMap<QString, unsigned> MessageWin::mErrorMessages; +TQValueList<MessageWin*> MessageWin::mWindowList; +TQMap<TQString, unsigned> MessageWin::mErrorMessages; /****************************************************************************** @@ -191,7 +191,7 @@ MessageWin::MessageWin(const KAEvent& event, const KAAlarm& alarm, bool reschedu kdDebug(5950) << "MessageWin::MessageWin(event)" << endl; // Set to save settings automatically, but don't save window size. // File alarm window size is saved elsewhere. - setAutoSaveSettings(QString::fromLatin1("MessageWin"), false); + setAutoSaveSettings(TQString::fromLatin1("MessageWin"), false); initView(); mWindowList.append(this); if (event.autoClose()) @@ -201,7 +201,7 @@ MessageWin::MessageWin(const KAEvent& event, const KAAlarm& alarm, bool reschedu /****************************************************************************** * Construct the message window for a specified error message. */ -MessageWin::MessageWin(const KAEvent& event, const DateTime& alarmDateTime, const QStringList& errmsgs) +MessageWin::MessageWin(const KAEvent& event, const DateTime& alarmDateTime, const TQStringList& errmsgs) : MainWindowBase(0, "MessageWin", WFLAGS | Qt::WGroupLeader | Qt::WStyle_ContextHelp), mMessage(event.cleanText()), mDateTime(alarmDateTime), @@ -290,38 +290,38 @@ void MessageWin::initView() bool reminder = (!mErrorWindow && (mAlarmType & KAAlarm::REMINDER_ALARM)); int leading = fontMetrics().leading(); setCaption((mAlarmType & KAAlarm::REMINDER_ALARM) ? i18n("Reminder") : i18n("Message")); - QWidget* topWidget = new QWidget(this, "messageWinTop"); + TQWidget* topWidget = new TQWidget(this, "messageWinTop"); setCentralWidget(topWidget); - QVBoxLayout* topLayout = new QVBoxLayout(topWidget, KDialog::marginHint(), KDialog::spacingHint()); + TQVBoxLayout* topLayout = new TQVBoxLayout(topWidget, KDialog::marginHint(), KDialog::spacingHint()); if (mDateTime.isValid()) { // Show the alarm date/time, together with an "Advance reminder" text where appropriate - QFrame* frame = 0; - QVBoxLayout* layout = topLayout; + TQFrame* frame = 0; + TQVBoxLayout* layout = topLayout; if (reminder) { - frame = new QFrame(topWidget); - frame->setFrameStyle(QFrame::Box | QFrame::Raised); + frame = new TQFrame(topWidget); + frame->setFrameStyle(TQFrame::Box | TQFrame::Raised); topLayout->addWidget(frame, 0, Qt::AlignHCenter); - layout = new QVBoxLayout(frame, leading + frame->frameWidth(), leading); + layout = new TQVBoxLayout(frame, leading + frame->frameWidth(), leading); } // Alarm date/time - QLabel* label = new QLabel(frame ? frame : topWidget); + TQLabel* label = new TQLabel(frame ? frame : topWidget); label->setText(mDateTime.isDateOnly() ? KGlobal::locale()->formatDate(mDateTime.date(), true) : KGlobal::locale()->formatDateTime(mDateTime.dateTime())); if (!frame) - label->setFrameStyle(QFrame::Box | QFrame::Raised); + label->setFrameStyle(TQFrame::Box | TQFrame::Raised); label->setFixedSize(label->sizeHint()); layout->addWidget(label, 0, Qt::AlignHCenter); - QWhatsThis::add(label, + TQWhatsThis::add(label, i18n("The scheduled date/time for the message (as opposed to the actual time of display).")); if (frame) { - label = new QLabel(frame); + label = new TQLabel(frame); label->setText(i18n("Reminder")); label->setFixedSize(label->sizeHint()); layout->addWidget(label, 0, Qt::AlignHCenter); @@ -337,21 +337,21 @@ void MessageWin::initView() case KAEvent::FILE: { // Display the file name - QLabel* label = new QLabel(mMessage, topWidget); - label->setFrameStyle(QFrame::Box | QFrame::Raised); + TQLabel* label = new TQLabel(mMessage, topWidget); + label->setFrameStyle(TQFrame::Box | TQFrame::Raised); label->setFixedSize(label->sizeHint()); - QWhatsThis::add(label, i18n("The file whose contents are displayed below")); + TQWhatsThis::add(label, i18n("The file whose contents are displayed below")); topLayout->addWidget(label, 0, Qt::AlignHCenter); // Display contents of file bool opened = false; bool dir = false; - QString tmpFile; + TQString tmpFile; KURL url(mMessage); if (KIO::NetAccess::download(url, tmpFile, MainWindow::mainMainWindow())) { - QFile qfile(tmpFile); - QFileInfo info(qfile); + TQFile qfile(tmpFile); + TQFileInfo info(qfile); if (!(dir = info.isDir())) { opened = true; @@ -365,8 +365,8 @@ void MessageWin::initView() // is overridden by the user-set default stored in the config file. // So there is no need to calculate an accurate size. int h = 20*view->fontMetrics().lineSpacing() + 2*view->frameWidth(); - view->resize(QSize(h, h).expandedTo(view->sizeHint())); - QWhatsThis::add(view, i18n("The contents of the file to be displayed")); + view->resize(TQSize(h, h).expandedTo(view->sizeHint())); + TQWhatsThis::add(view, i18n("The contents of the file to be displayed")); } KIO::NetAccess::removeTempFile(tmpFile); } @@ -381,19 +381,19 @@ void MessageWin::initView() case KAEvent::MESSAGE: { // Message label - // Using MessageText instead of QLabel allows scrolling and mouse copying - MessageText* text = new MessageText(mMessage, QString::null, topWidget); - text->setFrameStyle(QFrame::NoFrame); + // Using MessageText instead of TQLabel allows scrolling and mouse copying + MessageText* text = new MessageText(mMessage, TQString::null, topWidget); + text->setFrameStyle(TQFrame::NoFrame); text->setPaper(mBgColour); text->setPaletteForegroundColor(mFgColour); text->setFont(mFont); int lineSpacing = text->fontMetrics().lineSpacing(); - QSize s = text->sizeHint(); + TQSize s = text->sizeHint(); int h = s.height(); text->setMaximumHeight(h + text->scrollBarHeight()); text->setMinimumHeight(QMIN(h, lineSpacing*4)); text->setMaximumWidth(s.width() + text->scrollBarWidth()); - QWhatsThis::add(text, i18n("The alarm message")); + TQWhatsThis::add(text, i18n("The alarm message")); int vspace = lineSpacing/2; int hspace = lineSpacing - KDialog::marginHint(); topLayout->addSpacing(vspace); @@ -405,7 +405,7 @@ void MessageWin::initView() topLayout->addWidget(text, 1, Qt::AlignHCenter); else { - QBoxLayout* layout = new QHBoxLayout(topLayout); + TQBoxLayout* layout = new TQHBoxLayout(topLayout); layout->addSpacing(hspace); layout->addWidget(text, 1, Qt::AlignHCenter); layout->addSpacing(hspace); @@ -423,18 +423,18 @@ void MessageWin::initView() if (reminder) { // Reminder: show remaining time until the actual alarm - mRemainingText = new QLabel(topWidget); - mRemainingText->setFrameStyle(QFrame::Box | QFrame::Raised); + mRemainingText = new TQLabel(topWidget); + mRemainingText->setFrameStyle(TQFrame::Box | TQFrame::Raised); mRemainingText->setMargin(leading); - if (mDateTime.isDateOnly() || QDate::currentDate().daysTo(mDateTime.date()) > 0) + if (mDateTime.isDateOnly() || TQDate::currentDate().daysTo(mDateTime.date()) > 0) { setRemainingTextDay(); - MidnightTimer::connect(this, SLOT(setRemainingTextDay())); // update every day + MidnightTimer::connect(this, TQT_SLOT(setRemainingTextDay())); // update every day } else { setRemainingTextMinute(); - MinuteTimer::connect(this, SLOT(setRemainingTextMinute())); // update every minute + MinuteTimer::connect(this, TQT_SLOT(setRemainingTextMinute())); // update every minute } topLayout->addWidget(mRemainingText, 0, Qt::AlignHCenter); topLayout->addSpacing(KDialog::spacingHint()); @@ -449,23 +449,23 @@ void MessageWin::initView() case KAEvent::EMAIL: { // Display the email addresses and subject. - QFrame* frame = new QFrame(topWidget); - frame->setFrameStyle(QFrame::Box | QFrame::Raised); - QWhatsThis::add(frame, i18n("The email to send")); + TQFrame* frame = new TQFrame(topWidget); + frame->setFrameStyle(TQFrame::Box | TQFrame::Raised); + TQWhatsThis::add(frame, i18n("The email to send")); topLayout->addWidget(frame, 0, Qt::AlignHCenter); - QGridLayout* grid = new QGridLayout(frame, 2, 2, KDialog::marginHint(), KDialog::spacingHint()); + TQGridLayout* grid = new TQGridLayout(frame, 2, 2, KDialog::marginHint(), KDialog::spacingHint()); - QLabel* label = new QLabel(i18n("Email addressee", "To:"), frame); + TQLabel* label = new TQLabel(i18n("Email addressee", "To:"), frame); label->setFixedSize(label->sizeHint()); grid->addWidget(label, 0, 0, Qt::AlignLeft); - label = new QLabel(mEvent.emailAddresses("\n"), frame); + label = new TQLabel(mEvent.emailAddresses("\n"), frame); label->setFixedSize(label->sizeHint()); grid->addWidget(label, 0, 1, Qt::AlignLeft); - label = new QLabel(i18n("Email subject", "Subject:"), frame); + label = new TQLabel(i18n("Email subject", "Subject:"), frame); label->setFixedSize(label->sizeHint()); grid->addWidget(label, 1, 0, Qt::AlignLeft); - label = new QLabel(mEvent.emailSubject(), frame); + label = new TQLabel(mEvent.emailSubject(), frame); label->setFixedSize(label->sizeHint()); grid->addWidget(label, 1, 1, Qt::AlignLeft); break; @@ -484,24 +484,24 @@ void MessageWin::initView() else { setCaption(i18n("Error")); - QBoxLayout* layout = new QHBoxLayout(topLayout); + TQBoxLayout* layout = new TQHBoxLayout(topLayout); layout->setMargin(2*KDialog::marginHint()); layout->addStretch(); - QLabel* label = new QLabel(topWidget); + TQLabel* label = new TQLabel(topWidget); label->setPixmap(DesktopIcon("error")); label->setFixedSize(label->sizeHint()); layout->addWidget(label, 0, Qt::AlignRight); - QBoxLayout* vlayout = new QVBoxLayout(layout); - for (QStringList::Iterator it = mErrorMsgs.begin(); it != mErrorMsgs.end(); ++it) + TQBoxLayout* vlayout = new TQVBoxLayout(layout); + for (TQStringList::Iterator it = mErrorMsgs.begin(); it != mErrorMsgs.end(); ++it) { - label = new QLabel(*it, topWidget); + label = new TQLabel(*it, topWidget); label->setFixedSize(label->sizeHint()); vlayout->addWidget(label, 0, Qt::AlignLeft); } layout->addStretch(); } - QGridLayout* grid = new QGridLayout(1, 4); + TQGridLayout* grid = new TQGridLayout(1, 4); topLayout->addLayout(grid); grid->setColStretch(0, 1); // keep the buttons right-adjusted in the window int gridIndex = 1; @@ -510,32 +510,32 @@ void MessageWin::initView() mOkButton = new KPushButton(KStdGuiItem::close(), topWidget); // Prevent accidental acknowledgement of the message if the user is typing when the window appears mOkButton->clearFocus(); - mOkButton->setFocusPolicy(QWidget::ClickFocus); // don't allow keyboard selection + mOkButton->setFocusPolicy(TQWidget::ClickFocus); // don't allow keyboard selection mOkButton->setFixedSize(mOkButton->sizeHint()); - connect(mOkButton, SIGNAL(clicked()), SLOT(close())); + connect(mOkButton, TQT_SIGNAL(clicked()), TQT_SLOT(close())); grid->addWidget(mOkButton, 0, gridIndex++, AlignHCenter); - QWhatsThis::add(mOkButton, i18n("Acknowledge the alarm")); + TQWhatsThis::add(mOkButton, i18n("Acknowledge the alarm")); if (mShowEdit) { // Edit button - mEditButton = new QPushButton(i18n("&Edit..."), topWidget); - mEditButton->setFocusPolicy(QWidget::ClickFocus); // don't allow keyboard selection + mEditButton = new TQPushButton(i18n("&Edit..."), topWidget); + mEditButton->setFocusPolicy(TQWidget::ClickFocus); // don't allow keyboard selection mEditButton->setFixedSize(mEditButton->sizeHint()); - connect(mEditButton, SIGNAL(clicked()), SLOT(slotEdit())); + connect(mEditButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotEdit())); grid->addWidget(mEditButton, 0, gridIndex++, AlignHCenter); - QWhatsThis::add(mEditButton, i18n("Edit the alarm.")); + TQWhatsThis::add(mEditButton, i18n("Edit the alarm.")); } if (!mNoDefer) { // Defer button - mDeferButton = new QPushButton(i18n("&Defer..."), topWidget); - mDeferButton->setFocusPolicy(QWidget::ClickFocus); // don't allow keyboard selection + mDeferButton = new TQPushButton(i18n("&Defer..."), topWidget); + mDeferButton->setFocusPolicy(TQWidget::ClickFocus); // don't allow keyboard selection mDeferButton->setFixedSize(mDeferButton->sizeHint()); - connect(mDeferButton, SIGNAL(clicked()), SLOT(slotDefer())); + connect(mDeferButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotDefer())); grid->addWidget(mDeferButton, 0, gridIndex++, AlignHCenter); - QWhatsThis::add(mDeferButton, + TQWhatsThis::add(mDeferButton, i18n("Defer the alarm until later.\n" "You will be prompted to specify when the alarm should be redisplayed.")); @@ -546,14 +546,14 @@ void MessageWin::initView() if (!mAudioFile.isEmpty() && (mVolume || mFadeVolume > 0)) { // Silence button to stop sound repetition - QPixmap pixmap = MainBarIcon("player_stop"); - mSilenceButton = new QPushButton(topWidget); + TQPixmap pixmap = MainBarIcon("player_stop"); + mSilenceButton = new TQPushButton(topWidget); mSilenceButton->setPixmap(pixmap); mSilenceButton->setFixedSize(mSilenceButton->sizeHint()); - connect(mSilenceButton, SIGNAL(clicked()), SLOT(stopPlay())); + connect(mSilenceButton, TQT_SIGNAL(clicked()), TQT_SLOT(stopPlay())); grid->addWidget(mSilenceButton, 0, gridIndex++, AlignHCenter); - QToolTip::add(mSilenceButton, i18n("Stop sound")); - QWhatsThis::add(mSilenceButton, i18n("Stop playing the sound")); + TQToolTip::add(mSilenceButton, i18n("Stop sound")); + TQWhatsThis::add(mSilenceButton, i18n("Stop playing the sound")); // To avoid getting in a mess, disable the button until sound playing has been set up mSilenceButton->setEnabled(false); } @@ -563,28 +563,28 @@ void MessageWin::initView() if (mKMailSerialNumber) { // KMail button - QPixmap pixmap = iconLoader.loadIcon(QString::fromLatin1("kmail"), KIcon::MainToolbar); - mKMailButton = new QPushButton(topWidget); + TQPixmap pixmap = iconLoader.loadIcon(TQString::fromLatin1("kmail"), KIcon::MainToolbar); + mKMailButton = new TQPushButton(topWidget); mKMailButton->setPixmap(pixmap); mKMailButton->setFixedSize(mKMailButton->sizeHint()); - connect(mKMailButton, SIGNAL(clicked()), SLOT(slotShowKMailMessage())); + connect(mKMailButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotShowKMailMessage())); grid->addWidget(mKMailButton, 0, gridIndex++, AlignHCenter); - QToolTip::add(mKMailButton, i18n("Locate this email in KMail", "Locate in KMail")); - QWhatsThis::add(mKMailButton, i18n("Locate and highlight this email in KMail")); + TQToolTip::add(mKMailButton, i18n("Locate this email in KMail", "Locate in KMail")); + TQWhatsThis::add(mKMailButton, i18n("Locate and highlight this email in KMail")); } else mKMailButton = 0; // KAlarm button - QPixmap pixmap = iconLoader.loadIcon(QString::fromLatin1(kapp->aboutData()->appName()), KIcon::MainToolbar); - mKAlarmButton = new QPushButton(topWidget); + TQPixmap pixmap = iconLoader.loadIcon(TQString::fromLatin1(kapp->aboutData()->appName()), KIcon::MainToolbar); + mKAlarmButton = new TQPushButton(topWidget); mKAlarmButton->setPixmap(pixmap); mKAlarmButton->setFixedSize(mKAlarmButton->sizeHint()); - connect(mKAlarmButton, SIGNAL(clicked()), SLOT(displayMainWindow())); + connect(mKAlarmButton, TQT_SIGNAL(clicked()), TQT_SLOT(displayMainWindow())); grid->addWidget(mKAlarmButton, 0, gridIndex++, AlignHCenter); - QString actKAlarm = i18n("Activate KAlarm"); - QToolTip::add(mKAlarmButton, actKAlarm); - QWhatsThis::add(mKAlarmButton, actKAlarm); + TQString actKAlarm = i18n("Activate KAlarm"); + TQToolTip::add(mKAlarmButton, actKAlarm); + TQWhatsThis::add(mKAlarmButton, actKAlarm); // Disable all buttons initially, to prevent accidental clicking on if they happen to be // under the mouse just as the window appears. @@ -598,7 +598,7 @@ void MessageWin::initView() mKAlarmButton->setEnabled(false); topLayout->activate(); - setMinimumSize(QSize(grid->sizeHint().width() + 2*KDialog::marginHint(), sizeHint().height())); + setMinimumSize(TQSize(grid->sizeHint().width() + 2*KDialog::marginHint(), sizeHint().height())); bool modal = !(getWFlags() & Qt::WX11BypassWM); @@ -614,14 +614,14 @@ void MessageWin::initView() */ void MessageWin::setRemainingTextDay() { - QString text; - int days = QDate::currentDate().daysTo(mDateTime.date()); + TQString text; + int days = TQDate::currentDate().daysTo(mDateTime.date()); if (days <= 0 && !mDateTime.isDateOnly()) { // The alarm is due today, so start refreshing every minute - MidnightTimer::disconnect(this, SLOT(setRemainingTextDay())); + MidnightTimer::disconnect(this, TQT_SLOT(setRemainingTextDay())); setRemainingTextMinute(); - MinuteTimer::connect(this, SLOT(setRemainingTextMinute())); // update every minute + MinuteTimer::connect(this, TQT_SLOT(setRemainingTextMinute())); // update every minute } else { @@ -641,8 +641,8 @@ void MessageWin::setRemainingTextDay() */ void MessageWin::setRemainingTextMinute() { - QString text; - int mins = (QDateTime::currentDateTime().secsTo(mDateTime.dateTime()) + 59) / 60; + TQString text; + int mins = (TQDateTime::currentDateTime().secsTo(mDateTime.dateTime()) + 59) / 60; if (mins < 60) text = i18n("in 1 minute's time", "in %n minutes' time", (mins > 0 ? mins : 0)); else if (mins % 60 == 0) @@ -662,38 +662,38 @@ void MessageWin::saveProperties(KConfig* config) { if (mShown && !mErrorWindow) { - config->writeEntry(QString::fromLatin1("EventID"), mEventID); - config->writeEntry(QString::fromLatin1("AlarmType"), mAlarmType); - config->writeEntry(QString::fromLatin1("Message"), mMessage); - config->writeEntry(QString::fromLatin1("Type"), mAction); - config->writeEntry(QString::fromLatin1("Font"), mFont); - config->writeEntry(QString::fromLatin1("BgColour"), mBgColour); - config->writeEntry(QString::fromLatin1("FgColour"), mFgColour); - config->writeEntry(QString::fromLatin1("ConfirmAck"), mConfirmAck); + config->writeEntry(TQString::fromLatin1("EventID"), mEventID); + config->writeEntry(TQString::fromLatin1("AlarmType"), mAlarmType); + config->writeEntry(TQString::fromLatin1("Message"), mMessage); + config->writeEntry(TQString::fromLatin1("Type"), mAction); + config->writeEntry(TQString::fromLatin1("Font"), mFont); + config->writeEntry(TQString::fromLatin1("BgColour"), mBgColour); + config->writeEntry(TQString::fromLatin1("FgColour"), mFgColour); + config->writeEntry(TQString::fromLatin1("ConfirmAck"), mConfirmAck); if (mDateTime.isValid()) { - config->writeEntry(QString::fromLatin1("Time"), mDateTime.dateTime()); - config->writeEntry(QString::fromLatin1("DateOnly"), mDateTime.isDateOnly()); + config->writeEntry(TQString::fromLatin1("Time"), mDateTime.dateTime()); + config->writeEntry(TQString::fromLatin1("DateOnly"), mDateTime.isDateOnly()); } if (mCloseTime.isValid()) - config->writeEntry(QString::fromLatin1("Expiry"), mCloseTime); + config->writeEntry(TQString::fromLatin1("Expiry"), mCloseTime); #ifndef WITHOUT_ARTS if (mAudioRepeat && mSilenceButton && mSilenceButton->isEnabled()) { // Only need to restart sound file playing if it's being repeated - config->writePathEntry(QString::fromLatin1("AudioFile"), mAudioFile); - config->writeEntry(QString::fromLatin1("Volume"), static_cast<int>(mVolume * 100)); + config->writePathEntry(TQString::fromLatin1("AudioFile"), mAudioFile); + config->writeEntry(TQString::fromLatin1("Volume"), static_cast<int>(mVolume * 100)); } #endif - config->writeEntry(QString::fromLatin1("Speak"), mSpeak); - config->writeEntry(QString::fromLatin1("Height"), height()); - config->writeEntry(QString::fromLatin1("DeferMins"), mDefaultDeferMinutes); - config->writeEntry(QString::fromLatin1("NoDefer"), mNoDefer); - config->writeEntry(QString::fromLatin1("NoPostAction"), mNoPostAction); - config->writeEntry(QString::fromLatin1("KMailSerial"), mKMailSerialNumber); + config->writeEntry(TQString::fromLatin1("Speak"), mSpeak); + config->writeEntry(TQString::fromLatin1("Height"), height()); + config->writeEntry(TQString::fromLatin1("DeferMins"), mDefaultDeferMinutes); + config->writeEntry(TQString::fromLatin1("NoDefer"), mNoDefer); + config->writeEntry(TQString::fromLatin1("NoPostAction"), mNoPostAction); + config->writeEntry(TQString::fromLatin1("KMailSerial"), mKMailSerialNumber); } else - config->writeEntry(QString::fromLatin1("Invalid"), true); + config->writeEntry(TQString::fromLatin1("Invalid"), true); } /****************************************************************************** @@ -703,34 +703,34 @@ void MessageWin::saveProperties(KConfig* config) */ void MessageWin::readProperties(KConfig* config) { - mInvalid = config->readBoolEntry(QString::fromLatin1("Invalid"), false); - mEventID = config->readEntry(QString::fromLatin1("EventID")); - mAlarmType = KAAlarm::Type(config->readNumEntry(QString::fromLatin1("AlarmType"))); - mMessage = config->readEntry(QString::fromLatin1("Message")); - mAction = KAEvent::Action(config->readNumEntry(QString::fromLatin1("Type"))); - mFont = config->readFontEntry(QString::fromLatin1("Font")); - mBgColour = config->readColorEntry(QString::fromLatin1("BgColour")); - mFgColour = config->readColorEntry(QString::fromLatin1("FgColour")); - mConfirmAck = config->readBoolEntry(QString::fromLatin1("ConfirmAck")); - QDateTime invalidDateTime; - QDateTime dt = config->readDateTimeEntry(QString::fromLatin1("Time"), &invalidDateTime); - bool dateOnly = config->readBoolEntry(QString::fromLatin1("DateOnly")); + mInvalid = config->readBoolEntry(TQString::fromLatin1("Invalid"), false); + mEventID = config->readEntry(TQString::fromLatin1("EventID")); + mAlarmType = KAAlarm::Type(config->readNumEntry(TQString::fromLatin1("AlarmType"))); + mMessage = config->readEntry(TQString::fromLatin1("Message")); + mAction = KAEvent::Action(config->readNumEntry(TQString::fromLatin1("Type"))); + mFont = config->readFontEntry(TQString::fromLatin1("Font")); + mBgColour = config->readColorEntry(TQString::fromLatin1("BgColour")); + mFgColour = config->readColorEntry(TQString::fromLatin1("FgColour")); + mConfirmAck = config->readBoolEntry(TQString::fromLatin1("ConfirmAck")); + TQDateTime invalidDateTime; + TQDateTime dt = config->readDateTimeEntry(TQString::fromLatin1("Time"), &invalidDateTime); + bool dateOnly = config->readBoolEntry(TQString::fromLatin1("DateOnly")); mDateTime.set(dt, dateOnly); - mCloseTime = config->readDateTimeEntry(QString::fromLatin1("Expiry"), &invalidDateTime); + mCloseTime = config->readDateTimeEntry(TQString::fromLatin1("Expiry"), &invalidDateTime); #ifndef WITHOUT_ARTS - mAudioFile = config->readPathEntry(QString::fromLatin1("AudioFile")); - mVolume = static_cast<float>(config->readNumEntry(QString::fromLatin1("Volume"))) / 100; + mAudioFile = config->readPathEntry(TQString::fromLatin1("AudioFile")); + mVolume = static_cast<float>(config->readNumEntry(TQString::fromLatin1("Volume"))) / 100; mFadeVolume = -1; mFadeSeconds = 0; if (!mAudioFile.isEmpty()) mAudioRepeat = true; #endif - mSpeak = config->readBoolEntry(QString::fromLatin1("Speak")); - mRestoreHeight = config->readNumEntry(QString::fromLatin1("Height")); - mDefaultDeferMinutes = config->readNumEntry(QString::fromLatin1("DeferMins")); - mNoDefer = config->readBoolEntry(QString::fromLatin1("NoDefer")); - mNoPostAction = config->readBoolEntry(QString::fromLatin1("NoPostAction")); - mKMailSerialNumber = config->readUnsignedLongNumEntry(QString::fromLatin1("KMailSerial")); + mSpeak = config->readBoolEntry(TQString::fromLatin1("Speak")); + mRestoreHeight = config->readNumEntry(TQString::fromLatin1("Height")); + mDefaultDeferMinutes = config->readNumEntry(TQString::fromLatin1("DeferMins")); + mNoDefer = config->readBoolEntry(TQString::fromLatin1("NoDefer")); + mNoPostAction = config->readBoolEntry(TQString::fromLatin1("NoPostAction")); + mKMailSerialNumber = config->readUnsignedLongNumEntry(TQString::fromLatin1("KMailSerial")); mShowEdit = false; kdDebug(5950) << "MessageWin::readProperties(" << mEventID << ")" << endl; if (mAlarmType != KAAlarm::INVALID_ALARM) @@ -761,9 +761,9 @@ void MessageWin::readProperties(KConfig* config) * Returns the existing message window (if any) which is displaying the event * with the specified ID. */ -MessageWin* MessageWin::findEvent(const QString& eventID) +MessageWin* MessageWin::findEvent(const TQString& eventID) { - for (QValueList<MessageWin*>::Iterator it = mWindowList.begin(); it != mWindowList.end(); ++it) + for (TQValueList<MessageWin*>::Iterator it = mWindowList.begin(); it != mWindowList.end(); ++it) { MessageWin* w = *it; if (w->mEventID == eventID && !w->mErrorWindow) @@ -781,29 +781,29 @@ void MessageWin::playAudio() { // Beep using two methods, in case the sound card/speakers are switched off or not working KNotifyClient::beep(); // beep through the sound card & speakers - QApplication::beep(); // beep through the internal speaker + TQApplication::beep(); // beep through the internal speaker } if (!mAudioFile.isEmpty()) { if (!mVolume && mFadeVolume <= 0) return; // ensure zero volume doesn't play anything #ifdef WITHOUT_ARTS - QString play = mAudioFile; - QString file = QString::fromLatin1("file:"); + TQString play = mAudioFile; + TQString file = TQString::fromLatin1("file:"); if (mAudioFile.startsWith(file)) play = mAudioFile.mid(file.length()); - KAudioPlayer::play(QFile::encodeName(play)); + KAudioPlayer::play(TQFile::encodeName(play)); #else // An audio file is specified. Because loading it may take some time, // call it on a timer to allow the window to display first. - QTimer::singleShot(0, this, SLOT(slotPlayAudio())); + TQTimer::singleShot(0, this, TQT_SLOT(slotPlayAudio())); #endif } else if (mSpeak) { // The message is to be spoken. In case of error messges, // call it on a timer to allow the window to display first. - QTimer::singleShot(0, this, SLOT(slotSpeak())); + TQTimer::singleShot(0, this, TQT_SLOT(slotSpeak())); } } @@ -817,8 +817,8 @@ void MessageWin::slotSpeak() if (!client->isApplicationRegistered("kttsd")) { // kttsd is not running, so start it - QString error; - if (kapp->startServiceByDesktopName("kttsd", QStringList(), &error)) + TQString error; + if (kapp->startServiceByDesktopName("kttsd", TQStringList(), &error)) { kdDebug(5950) << "MessageWin::slotSpeak(): failed to start kttsd: " << error << endl; if (!haveErrorMessage(ErrMsg_Speak)) @@ -829,10 +829,10 @@ void MessageWin::slotSpeak() return; } } - QByteArray data; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data; + TQDataStream arg(data, IO_WriteOnly); arg << mMessage << ""; - if (!client->send("kttsd", "KSpeech", "sayMessage(QString,QString)", data)) + if (!client->send("kttsd", "KSpeech", "sayMessage(TQString,TQString)", data)) { kdDebug(5950) << "MessageWin::slotSpeak(): sayMessage() DCOP error" << endl; if (!haveErrorMessage(ErrMsg_Speak)) @@ -867,11 +867,11 @@ void MessageWin::slotPlayAudio() if (!mArtsDispatcher) { mFadeTimer = 0; - mPlayTimer = new QTimer(this); - connect(mPlayTimer, SIGNAL(timeout()), SLOT(checkAudioPlay())); + mPlayTimer = new TQTimer(this); + connect(mPlayTimer, TQT_SIGNAL(timeout()), TQT_SLOT(checkAudioPlay())); mArtsDispatcher = new KArtsDispatcher; mPlayedOnce = false; - mAudioFileStart = QTime::currentTime(); + mAudioFileStart = TQTime::currentTime(); initAudio(true); if (!mPlayObject->object().isNull()) checkAudioPlay(); @@ -883,7 +883,7 @@ void MessageWin::slotPlayAudio() if (!haveErrorMessage(ErrMsg_Volume)) { KMessageBox::information(this, i18n("Unable to set master volume\n(Error accessing KMix:\n%1)").arg(mKMixError), - QString::null, QString::fromLatin1("KMixError")); + TQString::null, TQString::fromLatin1("KMixError")); clearErrorMessage(ErrMsg_Volume); } } @@ -935,7 +935,7 @@ void MessageWin::initAudio(bool firstTime) } mSilenceButton->setEnabled(true); mPlayed = false; - connect(mPlayObject, SIGNAL(playObjectCreated()), SLOT(checkAudioPlay())); + connect(mPlayObject, TQT_SIGNAL(playObjectCreated()), TQT_SLOT(checkAudioPlay())); if (!mPlayObject->object().isNull()) checkAudioPlay(); } @@ -967,7 +967,7 @@ void MessageWin::checkAudioPlay() if (!mPlayedOnce) { // Start playing the file for the first time - QTime now = QTime::currentTime(); + TQTime now = TQTime::currentTime(); mAudioFileLoadSecs = mAudioFileStart.secsTo(now); if (mAudioFileLoadSecs < 0) mAudioFileLoadSecs += 86400; @@ -975,8 +975,8 @@ void MessageWin::checkAudioPlay() { // Set up volume fade mAudioFileStart = now; - mFadeTimer = new QTimer(this); - connect(mFadeTimer, SIGNAL(timeout()), SLOT(slotFade())); + mFadeTimer = new TQTimer(this); + connect(mFadeTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotFade())); mFadeTimer->start(1000); // adjust volume every second } mPlayedOnce = true; @@ -1058,7 +1058,7 @@ void MessageWin::stopPlay() if (!mLocalAudioFile.isEmpty()) { KIO::NetAccess::removeTempFile(mLocalAudioFile); // removes it only if it IS a temporary file - mLocalAudioFile = QString::null; + mLocalAudioFile = TQString::null; } if (mSilenceButton) mSilenceButton->setEnabled(false); @@ -1071,7 +1071,7 @@ void MessageWin::stopPlay() void MessageWin::slotFade() { #ifndef WITHOUT_ARTS - QTime now = QTime::currentTime(); + TQTime now = TQTime::currentTime(); int elapsed = mAudioFileStart.secsTo(now); if (elapsed < 0) elapsed += 86400; // it's the next day @@ -1114,14 +1114,14 @@ int MessageWin::getKMixVolume() { if (!KAlarm::runProgram(KMIX_APP_NAME, KMIX_DCOP_WINDOW, mKMixName, mKMixError)) // start KMix if it isn't already running return -1; - QByteArray data, replyData; - QCString replyType; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, replyData; + TQCString replyType; + TQDataStream arg(data, IO_WriteOnly); if (!kapp->dcopClient()->call(mKMixName, KMIX_DCOP_OBJECT, "masterVolume()", data, replyType, replyData) || replyType != "int") return -1; int result; - QDataStream reply(replyData, IO_ReadOnly); + TQDataStream reply(replyData, IO_ReadOnly); reply >> result; return (result >= 0) ? result : 0; } @@ -1135,8 +1135,8 @@ void MessageWin::setKMixVolume(int percent) return; if (!KAlarm::runProgram(KMIX_APP_NAME, KMIX_DCOP_WINDOW, mKMixName, mKMixError)) // start KMix if it isn't already running return; - QByteArray data; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data; + TQDataStream arg(data, IO_WriteOnly); arg << percent; if (!kapp->dcopClient()->send(mKMixName, KMIX_DCOP_OBJECT, "setMasterVolume(int)", data)) kdError(5950) << "MessageWin::setKMixVolume(): kmix dcop call failed\n"; @@ -1183,10 +1183,10 @@ void MessageWin::show() if (mCloseTime.isValid()) { // Set a timer to auto-close the window - int delay = QDateTime::currentDateTime().secsTo(mCloseTime); + int delay = TQDateTime::currentDateTime().secsTo(mCloseTime); if (delay < 0) delay = 0; - QTimer::singleShot(delay * 1000, this, SLOT(close())); + TQTimer::singleShot(delay * 1000, this, TQT_SLOT(close())); if (!delay) return; // don't show the window if auto-closing is already due } @@ -1200,16 +1200,16 @@ void MessageWin::show() * For message windows, the size if limited to fit inside the working area of * the desktop. */ -QSize MessageWin::sizeHint() const +TQSize MessageWin::sizeHint() const { if (mAction != KAEvent::MESSAGE) return MainWindowBase::sizeHint(); if (!mWinModule) mWinModule = new KWinModule(0, KWinModule::INFO_DESKTOP); - QSize frame = frameGeometry().size(); - QSize contents = geometry().size(); - QSize desktop = mWinModule->workArea().size(); - QSize maxSize(desktop.width() - (frame.width() - contents.width()), + TQSize frame = frameGeometry().size(); + TQSize contents = geometry().size(); + TQSize desktop = mWinModule->workArea().size(); + TQSize maxSize(desktop.width() - (frame.width() - contents.width()), desktop.height() - (frame.height() - contents.height())); return MainWindowBase::sizeHint().boundedTo(maxSize); } @@ -1219,7 +1219,7 @@ QSize MessageWin::sizeHint() const * The first time, output any required audio notification, and reschedule or * delete the event from the calendar file. */ -void MessageWin::showEvent(QShowEvent* se) +void MessageWin::showEvent(TQShowEvent* se) { MainWindowBase::showEvent(se); if (!mShown) @@ -1233,7 +1233,7 @@ void MessageWin::showEvent(QShowEvent* se) * method is called, so for large windows the size needs to be * set again later. */ - QSize s = sizeHint(); // fit the window round the message + TQSize s = sizeHint(); // fit the window round the message if (mAction == KAEvent::FILE && !mErrorMsgs.count()) KAlarm::readConfigWindowSize("FileMessage", s); resize(s); @@ -1258,18 +1258,18 @@ void MessageWin::showEvent(QShowEvent* se) * message is displayed on a screen other than that currently being * worked with, it might not be noticed.) */ - QPoint cursor = QCursor::pos(); + TQPoint cursor = TQCursor::pos(); if (!mWinModule) mWinModule = new KWinModule(0, KWinModule::INFO_DESKTOP); - QRect desk = mWinModule->workArea(); - QDesktopWidget* dw = QApplication::desktop(); + TQRect desk = mWinModule->workArea(); + TQDesktopWidget* dw = TQApplication::desktop(); if (dw->numScreens() > 1) desk &= dw->screenGeometry(dw->screenNumber(cursor)); - QRect frame = frameGeometry(); - QRect rect = geometry(); + TQRect frame = frameGeometry(); + TQRect rect = geometry(); // Find the offsets from the outside of the frame to the edges of the OK button - QRect button(mOkButton->mapToParent(QPoint(0, 0)), mOkButton->mapToParent(mOkButton->rect().bottomRight())); + TQRect button(mOkButton->mapToParent(TQPoint(0, 0)), mOkButton->mapToParent(mOkButton->rect().bottomRight())); int buttonLeft = button.left() + rect.left() - frame.left(); int buttonRight = width() - button.right() + frame.right() - rect.right(); int buttonTop = button.top() + rect.top() - frame.top(); @@ -1282,7 +1282,7 @@ void MessageWin::showEvent(QShowEvent* se) // Find the enclosing rectangle for the new button positions // and check if the cursor is too near - QRect buttons = mOkButton->geometry().unite(mKAlarmButton->geometry()); + TQRect buttons = mOkButton->geometry().unite(mKAlarmButton->geometry()); buttons.moveBy(rect.left() + x - frame.left(), rect.top() + y - frame.top()); int minDistance = proximityMultiple * mOkButton->height(); if ((abs(cursor.x() - buttons.left()) < minDistance @@ -1302,7 +1302,7 @@ void MessageWin::showEvent(QShowEvent* se) if (mAction == KAEvent::MESSAGE) { // Set the window size once the frame size is known - QTimer::singleShot(0, this, SLOT(setMaxSize())); + TQTimer::singleShot(0, this, TQT_SLOT(setMaxSize())); } } mShown = true; @@ -1312,7 +1312,7 @@ void MessageWin::showEvent(QShowEvent* se) /****************************************************************************** * Called when the window has been moved. */ -void MessageWin::moveEvent(QMoveEvent* e) +void MessageWin::moveEvent(TQMoveEvent* e) { MainWindowBase::moveEvent(e); if (mPositioning) @@ -1328,7 +1328,7 @@ void MessageWin::moveEvent(QMoveEvent* e) */ void MessageWin::setMaxSize() { - QSize s = sizeHint(); + TQSize s = sizeHint(); if (width() > s.width() || height() > s.height()) resize(s); } @@ -1345,7 +1345,7 @@ void MessageWin::displayComplete() // Enable the window's buttons either now or after the configured delay if (mButtonDelay > 0) - QTimer::singleShot(mButtonDelay, this, SLOT(enableButtons())); + TQTimer::singleShot(mButtonDelay, this, TQT_SLOT(enableButtons())); else enableButtons(); } @@ -1368,14 +1368,14 @@ void MessageWin::enableButtons() /****************************************************************************** * Called when the window's size has changed (before it is painted). */ -void MessageWin::resizeEvent(QResizeEvent* re) +void MessageWin::resizeEvent(TQResizeEvent* re) { if (mRestoreHeight) { // Restore the window height on session restoration if (mRestoreHeight != re->size().height()) { - QSize size = re->size(); + TQSize size = re->size(); size.setHeight(mRestoreHeight); resize(size); } @@ -1394,7 +1394,7 @@ void MessageWin::resizeEvent(QResizeEvent* re) * Called when a close event is received. * Only quits the application if there is no system tray icon displayed. */ -void MessageWin::closeEvent(QCloseEvent* ce) +void MessageWin::closeEvent(TQCloseEvent* ce) { // Don't prompt or delete the alarm from the display calendar if the session is closing if (!mErrorWindow && !theApp()->sessionClosingDown()) @@ -1428,21 +1428,21 @@ void MessageWin::slotShowKMailMessage() kdDebug(5950) << "MessageWin::slotShowKMailMessage()\n"; if (!mKMailSerialNumber) return; - QString err = KAlarm::runKMail(false); + TQString err = KAlarm::runKMail(false); if (!err.isNull()) { KMessageBox::sorry(this, err); return; } - QCString replyType; - QByteArray data, replyData; - QDataStream arg(data, IO_WriteOnly); - arg << (Q_UINT32)mKMailSerialNumber << QString::null; - if (kapp->dcopClient()->call("kmail", KMAIL_DCOP_OBJECT, "showMail(Q_UINT32,QString)", data, replyType, replyData) + TQCString replyType; + TQByteArray data, replyData; + TQDataStream arg(data, IO_WriteOnly); + arg << (Q_UINT32)mKMailSerialNumber << TQString::null; + if (kapp->dcopClient()->call("kmail", KMAIL_DCOP_OBJECT, "showMail(Q_UINT32,TQString)", data, replyType, replyData) && replyType == "bool") { bool result; - QDataStream replyStream(replyData, IO_ReadOnly); + TQDataStream replyStream(replyData, IO_ReadOnly); replyStream >> result; if (result) return; // success @@ -1459,7 +1459,7 @@ void MessageWin::slotEdit() { kdDebug(5950) << "MessageWin::slotEdit()" << endl; EditAlarmDlg editDlg(false, i18n("Edit Alarm"), this, "editDlg", &mEvent); - if (editDlg.exec() == QDialog::Accepted) + if (editDlg.exec() == TQDialog::Accepted) { KAEvent event; editDlg.getEvent(event); @@ -1497,7 +1497,7 @@ void MessageWin::setDeferralLimit(const KAEvent& event) if (mDeferButton) { mDeferLimit = event.deferralLimit().dateTime(); - MidnightTimer::connect(this, SLOT(checkDeferralLimit())); // check every day + MidnightTimer::connect(this, TQT_SLOT(checkDeferralLimit())); // check every day mDisableDeferral = false; checkDeferralLimit(); } @@ -1506,27 +1506,27 @@ void MessageWin::setDeferralLimit(const KAEvent& event) /****************************************************************************** * Check whether the deferral limit has been reached. * If so, disable the Defer button. -* N.B. Ideally, just a single QTimer::singleShot() call would be made to disable +* N.B. Ideally, just a single TQTimer::singleShot() call would be made to disable * the defer button at the corret time. But for a 32-bit integer, the * milliseconds parameter overflows in about 25 days, so instead a daily * check is done until the day when the deferral limit is reached, followed -* by a non-overflowing QTimer::singleShot() call. +* by a non-overflowing TQTimer::singleShot() call. */ void MessageWin::checkDeferralLimit() { if (!mDeferButton || !mDeferLimit.isValid()) return; - int n = QDate::currentDate().daysTo(mDeferLimit.date()); + int n = TQDate::currentDate().daysTo(mDeferLimit.date()); if (n > 0) return; - MidnightTimer::disconnect(this, SLOT(checkDeferralLimit())); + MidnightTimer::disconnect(this, TQT_SLOT(checkDeferralLimit())); if (n == 0) { // The deferral limit will be reached today - n = QTime::currentTime().secsTo(mDeferLimit.time()); + n = TQTime::currentTime().secsTo(mDeferLimit.time()); if (n > 0) { - QTimer::singleShot(n * 1000, this, SLOT(checkDeferralLimit())); + TQTimer::singleShot(n * 1000, this, TQT_SLOT(checkDeferralLimit())); return; } } @@ -1540,14 +1540,14 @@ void MessageWin::checkDeferralLimit() */ void MessageWin::slotDefer() { - mDeferDlg = new DeferAlarmDlg(i18n("Defer Alarm"), QDateTime::currentDateTime().addSecs(60), + mDeferDlg = new DeferAlarmDlg(i18n("Defer Alarm"), TQDateTime::currentDateTime().addSecs(60), false, this, "deferDlg"); if (mDefaultDeferMinutes > 0) mDeferDlg->setDeferMinutes(mDefaultDeferMinutes); mDeferDlg->setLimit(mEventID); if (!Preferences::modalMessages()) lower(); - if (mDeferDlg->exec() == QDialog::Accepted) + if (mDeferDlg->exec() == TQDialog::Accepted) { DateTime dateTime = mDeferDlg->getDateTime(); int delayMins = mDeferDlg->deferMinutes(); @@ -1664,16 +1664,16 @@ bool wantModal() /*============================================================================= = Class MWMimeSourceFactory * Gets the mime type of a text file from not only its extension (as per -* QMimeSourceFactory), but also from its contents. This allows the detection +* TQMimeSourceFactory), but also from its contents. This allows the detection * of plain text files without file name extensions. =============================================================================*/ -MWMimeSourceFactory::MWMimeSourceFactory(const QString& absPath, KTextBrowser* view) - : QMimeSourceFactory(), +MWMimeSourceFactory::MWMimeSourceFactory(const TQString& absPath, KTextBrowser* view) + : TQMimeSourceFactory(), mMimeType("text/plain"), mLast(0) { view->setMimeSourceFactory(this); - QString type = KMimeType::findByPath(absPath)->name(); + TQString type = KMimeType::findByPath(absPath)->name(); switch (KAlarm::fileType(type)) { case KAlarm::TextPlain: @@ -1684,18 +1684,18 @@ MWMimeSourceFactory::MWMimeSourceFactory(const QString& absPath, KTextBrowser* v default: // It's assumed to be a text file mTextFile = absPath; - view->QTextBrowser::setSource(absPath); + view->TQTextBrowser::setSource(absPath); break; case KAlarm::Image: // It's an image file - QString text = "<img source=\""; + TQString text = "<img source=\""; text += absPath; text += "\">"; view->setText(text); break; } - setFilePath(QFileInfo(absPath).dirPath(true)); + setFilePath(TQFileInfo(absPath).dirPath(true)); } MWMimeSourceFactory::~MWMimeSourceFactory() @@ -1703,19 +1703,19 @@ MWMimeSourceFactory::~MWMimeSourceFactory() delete mLast; } -const QMimeSource* MWMimeSourceFactory::data(const QString& abs_name) const +const TQMimeSource* MWMimeSourceFactory::data(const TQString& abs_name) const { if (abs_name == mTextFile) { - QFileInfo fi(abs_name); + TQFileInfo fi(abs_name); if (fi.isReadable()) { - QFile f(abs_name); + TQFile f(abs_name); if (f.open(IO_ReadOnly) && f.size()) { - QByteArray ba(f.size()); + TQByteArray ba(f.size()); f.readBlock(ba.data(), ba.size()); - QStoredDrag* sr = new QStoredDrag(mMimeType); + TQStoredDrag* sr = new TQStoredDrag(mMimeType); sr->setEncodedData(ba); delete mLast; mLast = sr; @@ -1723,5 +1723,5 @@ const QMimeSource* MWMimeSourceFactory::data(const QString& abs_name) const } } } - return QMimeSourceFactory::data(abs_name); + return TQMimeSourceFactory::data(abs_name); } |