From 64df902cf71a8ee258fb85f6be26248f399aa01f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:05:15 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kalarm/CMakeLists.txt | 2 +- kalarm/Makefile.am | 4 +- kalarm/alarmcalendar.cpp | 8 +- kalarm/birthdaydlg.cpp | 2 +- kalarm/daemon.cpp | 2 +- kalarm/editdlg.cpp | 10 +-- kalarm/functions.cpp | 4 +- kalarm/kalarmapp.cpp | 4 +- kalarm/kalarmd/adcalendar.cpp | 4 +- kalarm/kalarmd/adconfigdata.cpp | 2 +- kalarm/kalarmd/alarmdaemon.cpp | 4 +- kalarm/kamail.cpp | 4 +- kalarm/lib/messagebox.cpp | 2 +- kalarm/mainwindow.cpp | 2 +- kalarm/messagewin.cpp | 4 +- kalarm/pickfileradio.cpp | 182 ---------------------------------------- kalarm/pickfileradio.h | 121 -------------------------- kalarm/pictdefileradio.cpp | 182 ++++++++++++++++++++++++++++++++++++++++ kalarm/pictdefileradio.h | 121 ++++++++++++++++++++++++++ kalarm/preferences.cpp | 2 +- kalarm/sounddlg.cpp | 2 +- kalarm/soundpicker.cpp | 2 +- kalarm/traywindow.cpp | 2 +- 23 files changed, 336 insertions(+), 336 deletions(-) delete mode 100644 kalarm/pickfileradio.cpp delete mode 100644 kalarm/pickfileradio.h create mode 100644 kalarm/pictdefileradio.cpp create mode 100644 kalarm/pictdefileradio.h (limited to 'kalarm') diff --git a/kalarm/CMakeLists.txt b/kalarm/CMakeLists.txt index b93cc671..cd7295a4 100644 --- a/kalarm/CMakeLists.txt +++ b/kalarm/CMakeLists.txt @@ -59,7 +59,7 @@ install( FILES uninstall.desktop DESTINATION ${APPS_INSTALL_DIR}/Applications RE tde_add_executable( kalarm AUTOMOC SOURCES birthdaydlg.cpp main.cpp alarmevent.cpp editdlg.cpp - emailidcombo.cpp find.cpp pickfileradio.cpp + emailidcombo.cpp find.cpp pictdefileradio.cpp calendarcompat.cpp eventlistviewbase.cpp alarmlistview.cpp kamail.cpp timeselector.cpp fontcolourbutton.cpp alarmtimewidget.cpp fontcolour.cpp soundpicker.cpp diff --git a/kalarm/Makefile.am b/kalarm/Makefile.am index a8e0e8bd..defbcce7 100644 --- a/kalarm/Makefile.am +++ b/kalarm/Makefile.am @@ -20,7 +20,7 @@ kalarm_SOURCES = birthdaydlg.cpp main.cpp alarmevent.cpp editdlg.cpp \ eventlistviewbase.cpp alarmlistview.cpp kamail.cpp timeselector.cpp \ templatelistview.cpp templatepickdlg.cpp templatedlg.cpp \ templatemenuaction.cpp latecancel.cpp repetition.cpp alarmtext.cpp \ - emailidcombo.cpp find.cpp pickfileradio.cpp calendarcompat.cpp + emailidcombo.cpp find.cpp pictdefileradio.cpp calendarcompat.cpp kalarm_LDFLAGS = $(all_libraries) $(KDE_RPATH) -L$(top_builddir)/libtdenetwork/qgpgme if include_ARTS ARTSLIB = -lartskde @@ -37,7 +37,7 @@ noinst_HEADERS = alarmcalendar.h alarmevent.h alarmlistview.h alarmtext.h \ editdlg.h editdlgprivate.h emailidcombo.h eventlistviewbase.h find.h \ fontcolour.h fontcolourbutton.h functions.h kalarm.h kalarmapp.h \ kamail.h karecurrence.h latecancel.h mainwindow.h mainwindowbase.h \ - messagewin.h pickfileradio.h prefdlg.h preferences.h recurrenceedit.h \ + messagewin.h pictdefileradio.h prefdlg.h preferences.h recurrenceedit.h \ recurrenceeditprivate.h reminder.h repetition.h sounddlg.h \ soundpicker.h specialactions.h startdaytimer.h templatedlg.h \ templatelistview.h templatemenuaction.h templatepickdlg.h timeselector.h \ diff --git a/kalarm/alarmcalendar.cpp b/kalarm/alarmcalendar.cpp index 1e64b046..26d2eb70 100644 --- a/kalarm/alarmcalendar.cpp +++ b/kalarm/alarmcalendar.cpp @@ -31,12 +31,12 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/kalarm/birthdaydlg.cpp b/kalarm/birthdaydlg.cpp index 0727507f..76b040da 100644 --- a/kalarm/birthdaydlg.cpp +++ b/kalarm/birthdaydlg.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/kalarm/daemon.cpp b/kalarm/daemon.cpp index 707865f8..1c37f974 100644 --- a/kalarm/daemon.cpp +++ b/kalarm/daemon.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/kalarm/editdlg.cpp b/kalarm/editdlg.cpp index 62c445ad..daf4406d 100644 --- a/kalarm/editdlg.cpp +++ b/kalarm/editdlg.cpp @@ -39,11 +39,11 @@ #include #include -#include -#include +#include +#include #include -#include -#include +#include +#include #include #include #include @@ -71,7 +71,7 @@ #include "latecancel.h" #include "lineedit.h" #include "mainwindow.h" -#include "pickfileradio.h" +#include "pictdefileradio.h" #include "preferences.h" #include "radiobutton.h" #include "recurrenceedit.h" diff --git a/kalarm/functions.cpp b/kalarm/functions.cpp index 4723c342..e637f22f 100644 --- a/kalarm/functions.cpp +++ b/kalarm/functions.cpp @@ -38,14 +38,14 @@ #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include diff --git a/kalarm/kalarmapp.cpp b/kalarm/kalarmapp.cpp index 29f498fc..5fa0d495 100644 --- a/kalarm/kalarmapp.cpp +++ b/kalarm/kalarmapp.cpp @@ -32,12 +32,12 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/kalarm/kalarmd/adcalendar.cpp b/kalarm/kalarmd/adcalendar.cpp index db2e4e3d..e499f481 100644 --- a/kalarm/kalarmd/adcalendar.cpp +++ b/kalarm/kalarmd/adcalendar.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include "adcalendar.moc" diff --git a/kalarm/kalarmd/adconfigdata.cpp b/kalarm/kalarmd/adconfigdata.cpp index 0253e320..3f728bdb 100644 --- a/kalarm/kalarmd/adconfigdata.cpp +++ b/kalarm/kalarmd/adconfigdata.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/kalarm/kalarmd/alarmdaemon.cpp b/kalarm/kalarmd/alarmdaemon.cpp index 75bb4d2d..4b2ff902 100644 --- a/kalarm/kalarmd/alarmdaemon.cpp +++ b/kalarm/kalarmd/alarmdaemon.cpp @@ -31,9 +31,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include diff --git a/kalarm/kamail.cpp b/kalarm/kamail.cpp index e0c50d3c..cc9c0248 100644 --- a/kalarm/kamail.cpp +++ b/kalarm/kamail.cpp @@ -37,8 +37,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/kalarm/lib/messagebox.cpp b/kalarm/lib/messagebox.cpp index 721ee5ea..4e78ef08 100644 --- a/kalarm/lib/messagebox.cpp +++ b/kalarm/lib/messagebox.cpp @@ -19,7 +19,7 @@ */ #include "kalarm.h" -#include +#include #include "messagebox.h" diff --git a/kalarm/mainwindow.cpp b/kalarm/mainwindow.cpp index 765678c6..08706246 100644 --- a/kalarm/mainwindow.cpp +++ b/kalarm/mainwindow.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kalarm/messagewin.cpp b/kalarm/messagewin.cpp index 0315b8f4..7c17edd0 100644 --- a/kalarm/messagewin.cpp +++ b/kalarm/messagewin.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #ifdef WITHOUT_ARTS diff --git a/kalarm/pickfileradio.cpp b/kalarm/pickfileradio.cpp deleted file mode 100644 index 15b56d94..00000000 --- a/kalarm/pickfileradio.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * pickfileradio.cpp - radio button with an associated file picker - * Program: kalarm - * Copyright (C) 2005 by David Jarvie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kalarm.h" - -#include -#include -#include - -#include - -#include "lineedit.h" -#include "pickfileradio.moc" - - -PickFileRadio::PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name) - : RadioButton(text, parent, name), - mGroup(parent), - mEdit(edit), - mButton(button), - mLastId(-1), // set to an invalid value - mRevertId(false) -{ - Q_ASSERT(parent); - Q_ASSERT(button); - mButton->setEnabled(false); - connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); - if (mEdit) - mEdit->setEnabled(false); - connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); -} - -PickFileRadio::PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name) - : RadioButton(text, parent, name), - mGroup(parent), - mEdit(0), - mButton(0), - mLastId(-1), // set to an invalid value - mRevertId(false) -{ - Q_ASSERT(parent); -} - -void PickFileRadio::init(TQPushButton* button, LineEdit* edit) -{ - Q_ASSERT(button); - mEdit = edit; - mButton = button; - mButton->setEnabled(false); - connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); - if (mEdit) - mEdit->setEnabled(false); - connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); - setReadOnly(RadioButton::isReadOnly()); -} - -void PickFileRadio::setReadOnly(bool ro) -{ - RadioButton::setReadOnly(ro); - if (mButton) - { - if (mEdit) - mEdit->setReadOnly(ro); - if (ro) - mButton->hide(); - else - mButton->show(); - } -} - -void PickFileRadio::setFile(const TQString& file) -{ - mFile = file; -} - -TQString PickFileRadio::file() const -{ - return mEdit ? mEdit->text() : mFile; -} - -/****************************************************************************** -* Set the radio button enabled or disabled. -* Adjusts the enabled/disabled state of other controls appropriately. -*/ -void PickFileRadio::setEnabled(bool enable) -{ - Q_ASSERT(mButton); - RadioButton::setEnabled(enable); - enable = enable && mGroup->selected() == this; - if (enable) - { - if (!pickFileIfNone()) - enable = false; // revert to previously selected type - } - mButton->setEnabled(enable); - if (mEdit) - mEdit->setEnabled(enable); -} - -/****************************************************************************** -* Called when the selected radio button changes. -*/ -void PickFileRadio::slotSelectionChanged(int id) -{ - if (id == mLastId || mRevertId) - return; - int radioId = mGroup->id(this); - if (mLastId == radioId) - { - mButton->setEnabled(false); - if (mEdit) - mEdit->setEnabled(false); - } - else if (id == radioId) - { - if (!pickFileIfNone()) - return; // revert to previously selected type - mButton->setEnabled(true); - if (mEdit) - mEdit->setEnabled(true); - } - mLastId = id; -} - -/****************************************************************************** -* Prompt for a file name if there is none currently entered. -*/ -bool PickFileRadio::pickFileIfNone() -{ - if (mEdit) - mFile = mEdit->text(); - if (!mFile.isEmpty()) - return true; - slotPickFile(); - return !mFile.isEmpty(); -} - -/****************************************************************************** -* Called when the file picker button is clicked. -*/ -void PickFileRadio::slotPickFile() -{ - mFile = pickFile(); - if (mEdit) - mEdit->setText(mFile); - if (mFile.isEmpty()) - { - // No file is selected, so revert to the previous radio button selection. - // But wait a moment before setting the radio button, or it won't work. - mRevertId = true; // prevent picker dialogue popping up twice - TQTimer::singleShot(0, this, TQT_SLOT(setLastId())); - } -} - -/****************************************************************************** -* Select the previously selected radio button in the group. -*/ -void PickFileRadio::setLastId() -{ - if (mLastId == -1) - setOn(false); // we don't know the previous selection, so just turn this button off - else - mGroup->setButton(mLastId); - mRevertId = false; -} diff --git a/kalarm/pickfileradio.h b/kalarm/pickfileradio.h deleted file mode 100644 index f30ca7f6..00000000 --- a/kalarm/pickfileradio.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * pickfileradio.h - radio button with an associated file picker - * Program: kalarm - * Copyright (C) 2005 by David Jarvie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef PICKFILERADIO_H -#define PICKFILERADIO_H - -/** @file pickfileradio.h - radio button with an associated file picker */ - -#include "radiobutton.h" - -class TQPushButton; -class LineEdit; - -/** - * @short Radio button with associated file picker controls. - * - * The PickFileRadio class is a radio button with an associated button to choose - * a file, and an optional file name edit box. Its purpose is to ensure that while - * the radio button is selected, the chosen file name is never blank. - * - * To achieve this, whenever the button is newly selected and the - * file name is currently blank, the file picker dialogue is displayed to choose a - * file. If the dialogue exits without a file being chosen, the radio button selection - * is reverted to the previously selected button in the parent button group. - * - * The class handles the activation of the file picker dialogue (via a virtual method - * which must be supplied by deriving a class from this one). It also handles all - * enabling and disabling of the browse button and edit box when the enable state of - * the radio button is changed, and when the radio button selection changes. - * - * @author David Jarvie - */ -class PickFileRadio : public RadioButton -{ - Q_OBJECT - - public: - /** Constructor. - * @param button Push button to invoke the file picker dialogue. - * @param edit File name edit widget, or null if there is none. - * @param text Radio button's text. - * @param parent Button group which is to be the parent object for the radio button. - * @param name The name of this widget. - */ - PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name = 0); - /** Constructor. - * The init() method must be called before the widget can be used. - * @param text Radio button's text. - * @param parent Button group which is to be the parent object for the radio button. - * @param name The name of this widget. - */ - PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name = 0); - /** Initialises the widget. - * @param button Push button to invoke the file picker dialogue. - * @param edit File name edit widget, or null if there is none. - */ - void init(TQPushButton* button, LineEdit* edit = 0); - /** Sets whether the radio button and associated widgets are read-only for the user. - * If read-only, their states cannot be changed by the user. - * @param readOnly True to set the widgets read-only, false to set them read-write. - */ - virtual void setReadOnly(bool readOnly); - /** Chooses a file, for example by displaying a file selection dialogue. - * This method is called when the push button is clicked - the client - * should not activate a file selection dialogue directly. - * @return Selected file name, or TQString() if no selection made. - */ - virtual TQString pickFile() = 0; - /** Notifies the widget of the currently selected file name. - * This should only be used when no file name edit box is used. - * It should be called to initialise the widget's data, and also any time the file - * name is changed without using the push button. - */ - void setFile(const TQString& file); - /** Returns the currently selected file name. */ - TQString file() const; - /** Returns the associated file name edit widget, or null if none. */ - LineEdit* fileEdit() const { return mEdit; } - /** Returns the associated file browse push button. */ - TQPushButton* pushButton() const { return mButton; } - - public slots: - /** Enables or disables the radio button, and adjusts the enabled state of the - * associated browse button and file name edit box. - */ - virtual void setEnabled(bool); - - private slots: - void slotSelectionChanged(int id); - void slotPickFile(); - void setLastId(); - - private: - bool pickFileIfNone(); - - TQButtonGroup* mGroup; // button group which radio button is in - LineEdit* mEdit; // file name edit box, or null if none - TQPushButton* mButton; // push button to pick a file - TQString mFile; // saved file name (if mEdit is null) - int mLastId; // previous radio button selected - bool mRevertId; // true to revert to the previous radio button selection -}; - -#endif // PICKFILERADIO_H diff --git a/kalarm/pictdefileradio.cpp b/kalarm/pictdefileradio.cpp new file mode 100644 index 00000000..80911c29 --- /dev/null +++ b/kalarm/pictdefileradio.cpp @@ -0,0 +1,182 @@ +/* + * pictdefileradio.cpp - radio button with an associated file picker + * Program: kalarm + * Copyright (C) 2005 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "kalarm.h" + +#include +#include +#include + +#include + +#include "lineedit.h" +#include "pictdefileradio.moc" + + +PickFileRadio::PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name) + : RadioButton(text, parent, name), + mGroup(parent), + mEdit(edit), + mButton(button), + mLastId(-1), // set to an invalid value + mRevertId(false) +{ + Q_ASSERT(parent); + Q_ASSERT(button); + mButton->setEnabled(false); + connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); + if (mEdit) + mEdit->setEnabled(false); + connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); +} + +PickFileRadio::PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name) + : RadioButton(text, parent, name), + mGroup(parent), + mEdit(0), + mButton(0), + mLastId(-1), // set to an invalid value + mRevertId(false) +{ + Q_ASSERT(parent); +} + +void PickFileRadio::init(TQPushButton* button, LineEdit* edit) +{ + Q_ASSERT(button); + mEdit = edit; + mButton = button; + mButton->setEnabled(false); + connect(mButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotPickFile())); + if (mEdit) + mEdit->setEnabled(false); + connect(mGroup, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotSelectionChanged(int))); + setReadOnly(RadioButton::isReadOnly()); +} + +void PickFileRadio::setReadOnly(bool ro) +{ + RadioButton::setReadOnly(ro); + if (mButton) + { + if (mEdit) + mEdit->setReadOnly(ro); + if (ro) + mButton->hide(); + else + mButton->show(); + } +} + +void PickFileRadio::setFile(const TQString& file) +{ + mFile = file; +} + +TQString PickFileRadio::file() const +{ + return mEdit ? mEdit->text() : mFile; +} + +/****************************************************************************** +* Set the radio button enabled or disabled. +* Adjusts the enabled/disabled state of other controls appropriately. +*/ +void PickFileRadio::setEnabled(bool enable) +{ + Q_ASSERT(mButton); + RadioButton::setEnabled(enable); + enable = enable && mGroup->selected() == this; + if (enable) + { + if (!pickFileIfNone()) + enable = false; // revert to previously selected type + } + mButton->setEnabled(enable); + if (mEdit) + mEdit->setEnabled(enable); +} + +/****************************************************************************** +* Called when the selected radio button changes. +*/ +void PickFileRadio::slotSelectionChanged(int id) +{ + if (id == mLastId || mRevertId) + return; + int radioId = mGroup->id(this); + if (mLastId == radioId) + { + mButton->setEnabled(false); + if (mEdit) + mEdit->setEnabled(false); + } + else if (id == radioId) + { + if (!pickFileIfNone()) + return; // revert to previously selected type + mButton->setEnabled(true); + if (mEdit) + mEdit->setEnabled(true); + } + mLastId = id; +} + +/****************************************************************************** +* Prompt for a file name if there is none currently entered. +*/ +bool PickFileRadio::pickFileIfNone() +{ + if (mEdit) + mFile = mEdit->text(); + if (!mFile.isEmpty()) + return true; + slotPickFile(); + return !mFile.isEmpty(); +} + +/****************************************************************************** +* Called when the file picker button is clicked. +*/ +void PickFileRadio::slotPickFile() +{ + mFile = pickFile(); + if (mEdit) + mEdit->setText(mFile); + if (mFile.isEmpty()) + { + // No file is selected, so revert to the previous radio button selection. + // But wait a moment before setting the radio button, or it won't work. + mRevertId = true; // prevent picker dialogue popping up twice + TQTimer::singleShot(0, this, TQT_SLOT(setLastId())); + } +} + +/****************************************************************************** +* Select the previously selected radio button in the group. +*/ +void PickFileRadio::setLastId() +{ + if (mLastId == -1) + setOn(false); // we don't know the previous selection, so just turn this button off + else + mGroup->setButton(mLastId); + mRevertId = false; +} diff --git a/kalarm/pictdefileradio.h b/kalarm/pictdefileradio.h new file mode 100644 index 00000000..ad6e0c25 --- /dev/null +++ b/kalarm/pictdefileradio.h @@ -0,0 +1,121 @@ +/* + * pictdefileradio.h - radio button with an associated file picker + * Program: kalarm + * Copyright (C) 2005 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PICKFILERADIO_H +#define PICKFILERADIO_H + +/** @file pictdefileradio.h - radio button with an associated file picker */ + +#include "radiobutton.h" + +class TQPushButton; +class LineEdit; + +/** + * @short Radio button with associated file picker controls. + * + * The PickFileRadio class is a radio button with an associated button to choose + * a file, and an optional file name edit box. Its purpose is to ensure that while + * the radio button is selected, the chosen file name is never blank. + * + * To achieve this, whenever the button is newly selected and the + * file name is currently blank, the file picker dialogue is displayed to choose a + * file. If the dialogue exits without a file being chosen, the radio button selection + * is reverted to the previously selected button in the parent button group. + * + * The class handles the activation of the file picker dialogue (via a virtual method + * which must be supplied by deriving a class from this one). It also handles all + * enabling and disabling of the browse button and edit box when the enable state of + * the radio button is changed, and when the radio button selection changes. + * + * @author David Jarvie + */ +class PickFileRadio : public RadioButton +{ + Q_OBJECT + + public: + /** Constructor. + * @param button Push button to invoke the file picker dialogue. + * @param edit File name edit widget, or null if there is none. + * @param text Radio button's text. + * @param parent Button group which is to be the parent object for the radio button. + * @param name The name of this widget. + */ + PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name = 0); + /** Constructor. + * The init() method must be called before the widget can be used. + * @param text Radio button's text. + * @param parent Button group which is to be the parent object for the radio button. + * @param name The name of this widget. + */ + PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name = 0); + /** Initialises the widget. + * @param button Push button to invoke the file picker dialogue. + * @param edit File name edit widget, or null if there is none. + */ + void init(TQPushButton* button, LineEdit* edit = 0); + /** Sets whether the radio button and associated widgets are read-only for the user. + * If read-only, their states cannot be changed by the user. + * @param readOnly True to set the widgets read-only, false to set them read-write. + */ + virtual void setReadOnly(bool readOnly); + /** Chooses a file, for example by displaying a file selection dialogue. + * This method is called when the push button is clicked - the client + * should not activate a file selection dialogue directly. + * @return Selected file name, or TQString() if no selection made. + */ + virtual TQString pickFile() = 0; + /** Notifies the widget of the currently selected file name. + * This should only be used when no file name edit box is used. + * It should be called to initialise the widget's data, and also any time the file + * name is changed without using the push button. + */ + void setFile(const TQString& file); + /** Returns the currently selected file name. */ + TQString file() const; + /** Returns the associated file name edit widget, or null if none. */ + LineEdit* fileEdit() const { return mEdit; } + /** Returns the associated file browse push button. */ + TQPushButton* pushButton() const { return mButton; } + + public slots: + /** Enables or disables the radio button, and adjusts the enabled state of the + * associated browse button and file name edit box. + */ + virtual void setEnabled(bool); + + private slots: + void slotSelectionChanged(int id); + void slotPickFile(); + void setLastId(); + + private: + bool pickFileIfNone(); + + TQButtonGroup* mGroup; // button group which radio button is in + LineEdit* mEdit; // file name edit box, or null if none + TQPushButton* mButton; // push button to pick a file + TQString mFile; // saved file name (if mEdit is null) + int mLastId; // previous radio button selected + bool mRevertId; // true to revert to the previous radio button selection +}; + +#endif // PICKFILERADIO_H diff --git a/kalarm/preferences.cpp b/kalarm/preferences.cpp index 24669fbe..2e057eaf 100644 --- a/kalarm/preferences.cpp +++ b/kalarm/preferences.cpp @@ -21,7 +21,7 @@ #include "kalarm.h" #include -#include +#include #include #include #include diff --git a/kalarm/sounddlg.cpp b/kalarm/sounddlg.cpp index 1f386f30..d93a3b68 100644 --- a/kalarm/sounddlg.cpp +++ b/kalarm/sounddlg.cpp @@ -44,7 +44,7 @@ #include #endif #include -#include +#include #include #include "checkbox.h" diff --git a/kalarm/soundpicker.cpp b/kalarm/soundpicker.cpp index 00f31893..1ae3a6a8 100644 --- a/kalarm/soundpicker.cpp +++ b/kalarm/soundpicker.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #ifndef WITHOUT_ARTS diff --git a/kalarm/traywindow.cpp b/kalarm/traywindow.cpp index 58e8232c..8bcad17e 100644 --- a/kalarm/traywindow.cpp +++ b/kalarm/traywindow.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include "alarmcalendar.h" -- cgit v1.2.3