diff options
Diffstat (limited to 'kbiff/setupdlg.h')
-rw-r--r-- | kbiff/setupdlg.h | 308 |
1 files changed, 308 insertions, 0 deletions
diff --git a/kbiff/setupdlg.h b/kbiff/setupdlg.h new file mode 100644 index 0000000..bf423d9 --- /dev/null +++ b/kbiff/setupdlg.h @@ -0,0 +1,308 @@ +/* + * setupdlg.h + * Copyright (C) 1999-2001 Kurt Granroth <granroth@kde.org> + * + * This file contains the setup dialog and related widgets + * for KBiff. All user configuration is done here. + * + * $Id$ + */ +#ifndef SETUPDLG_H +#define SETUPDLG_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif //HAVE_CONFIG_H + +#include <kbiffurl.h> + +#include <qlistview.h> + +#include <qwidget.h> +#include <kdialog.h> +#include <qdict.h> +#include <qlineedit.h> + +class QLineEdit; +class QCheckBox; +class QPushButton; +class QComboBox; + +#include <kicondialog.h> + +struct KBiffMailbox +{ + KBiffURL url; + bool store; + QString key; +}; + +class KBiffGeneralTab; +class KBiffNewMailTab; +class KBiffMailboxTab; +class KBiffAboutTab; +class KBiffNewDlg; + +class KBiffSetup : public KDialog +{ + Q_OBJECT +public: + KBiffSetup(const QString& name = QString::null, bool secure = false); + virtual ~KBiffSetup(); + + const QString getProfile() const; + const KBiffURL getCurrentMailbox() const; + const QList<KBiffMailbox> getMailboxList() const; + + const QString getMailClient() const; + const QString getRunCommandPath() const; + const QString getRunResetCommandPath() const; + const QString getPlaySoundPath() const; + const QString getNoMailIcon() const; + const QString getNewMailIcon() const; + const QString getOldMailIcon() const; + const QString getNoConnIcon() const; + const QString getStoppedIcon() const; + bool getSystemBeep() const; + bool getRunCommand() const; + bool getRunResetCommand() const; + bool getPlaySound() const; + bool getNotify() const; + bool getStatus() const; + bool getDock() const; + bool getSessionManagement() const; + bool getCheckStartup() const; + bool getSecure() const; + unsigned int getPoll() const; + +public slots: + void invokeHelp(); + + void readConfig(const QString& profile); + void saveConfig(); + +protected: + QString getSomeProfile() const; + +protected slots: + void slotDone(); + void slotAddNewProfile(); + void slotRenameProfile(); + void slotDeleteProfile(); + +private: + bool isSecure; + + // "outer" dialog + QComboBox *comboProfile; + + // tabs + KBiffGeneralTab *generalTab; + KBiffNewMailTab *newmailTab; + KBiffMailboxTab *mailboxTab; + KBiffAboutTab *aboutTab; +}; + +class KBiffGeneralTab : public QWidget +{ + Q_OBJECT +public: + KBiffGeneralTab(const QString& profile = QString::null, QWidget *parent=0); + virtual ~KBiffGeneralTab(); + + const QString getButtonNewMail() const; + const QString getButtonOldMail() const; + const QString getButtonNoMail() const; + const QString getButtonNoConn() const; + const QString getButtonStopped() const; + const QString getMailClient() const; + int getPoll() const; + bool getDock() const; + bool getSessionManagement() const; + bool getCheckStartup() const; + +public slots: + void readConfig(const QString& profile); + void saveConfig(const QString& profile); + +private: + QLineEdit* editPoll; + QLineEdit* editCommand; + QCheckBox* checkDock; + QCheckBox* checkNoSession; + QCheckBox* checkNoStartup; + + KIconButton *buttonNoMail; + KIconButton *buttonOldMail; + KIconButton *buttonNewMail; + KIconButton *buttonNoConn; + KIconButton *buttonStopped; +}; + +class KBiffNewMailTab : public QWidget +{ + Q_OBJECT +public: + KBiffNewMailTab(const QString& profile = QString::null, QWidget *parent=0); + virtual ~KBiffNewMailTab(); + + bool getRunCommand() const; + const QString getRunCommandPath() const; + bool getRunResetCommand() const; + const QString getRunResetCommandPath() const; + bool getPlaySound() const; + const QString getPlaySoundPath() const; + bool getSystemBeep() const; + bool getNotify() const; + bool getStatus() const; + +public slots: + void readConfig(const QString& profile); + void saveConfig(const QString& profile); + +protected slots: + void enableRunCommand(bool); + void enableRunResetCommand(bool); + void enablePlaySound(bool); + void browseRunCommand(); + void browseRunResetCommand(); + void browsePlaySound(); + void testPlaySound(); + +private: + QLineEdit *editRunCommand; + QLineEdit *editRunResetCommand; + QLineEdit *editPlaySound; + + QCheckBox *checkRunCommand; + QCheckBox *checkRunResetCommand; + QCheckBox *checkPlaySound; + QCheckBox *checkBeep; + QCheckBox *checkNotify; + QCheckBox *checkStatus; + + QPushButton *buttonBrowsePlaySound; + QPushButton *buttonTestPlaySound; + QPushButton *buttonBrowseRunCommand; + QPushButton *buttonBrowseRunResetCommand; +}; + +class KBiffMailboxAdvanced : public KDialog +{ + Q_OBJECT +public: + KBiffMailboxAdvanced(); + virtual ~KBiffMailboxAdvanced(); + + const KBiffURL getMailbox() const; + unsigned int getPort() const; + bool getPreauth() const; + + void setPort(unsigned int the_port, bool enable = true); + void setTimeout(unsigned int the_to, bool enable = true); + void setMailbox(const KBiffURL& url); + void setPreauth(bool on); + void setKeepalive(bool on); + void setAsync(bool on); + void setDisableApop(bool on); + +protected slots: + void portModified(const QString& text); + void timeoutModified(const QString& text); + void preauthModified(bool toggled); + void keepaliveModified(bool toggled); + void asyncModified(bool toggled); + void apopModified(bool toggled); + +private: + QString password; + QLineEdit *mailbox; + QLineEdit *port; + QLineEdit *timeout; + QCheckBox *preauth; + QCheckBox *keepalive; + QCheckBox *async; + QCheckBox *apop; +}; + +class KBiffMailboxTab : public QWidget +{ + Q_OBJECT +public: + KBiffMailboxTab(const QString& profile = QString::null, QWidget *parent=0); + virtual ~KBiffMailboxTab(); + + void setMailbox(const KBiffURL& url); + + const KBiffURL getMailbox() const; + const QList<KBiffMailbox> getMailboxList() const; + +public slots: + void readConfig(const QString& profile); + void saveConfig(const QString& profile); + +protected slots: + void slotDeleteMailbox(); + void slotNewMailbox(); + void slotMailboxSelected(QListViewItem *item); + + void protocolSelected(int protocol); + void browse(); + void advanced(); + + void enableFetchCommand(bool); + void browseFetchCommand(); + +protected: + const KBiffURL defaultMailbox() const; + +private: + QDict<KBiffMailbox> *mailboxHash; + QListViewItem *oldItem; + + unsigned int port; + unsigned int timeout; + bool preauth; + bool keepalive; + bool async; + bool useApop; + QComboBox *comboProtocol; + QLineEdit *editMailbox; + QLineEdit *editServer; + QLineEdit *editUser; + QLineEdit *editPassword; + QLineEdit *editFetchCommand; + QCheckBox *checkFetchCommand; + QCheckBox *checkStorePassword; + QPushButton *buttonBrowse; + QListView *mailboxes; + + QPushButton *buttonBrowseFetchCommand; +}; + +class KBiffAboutTab : public QWidget +{ + Q_OBJECT +public: + KBiffAboutTab(QWidget *parent=0); + virtual ~KBiffAboutTab(); + +protected slots: + void mailTo(const QString&); + void homepage(const QString&); +}; + +class KBiffNewDlg : public KDialog +{ + Q_OBJECT +public: + KBiffNewDlg(QWidget* parent = 0, const char * name = 0); + + const QString getName() const + { return editName->text(); } + +private: + QLineEdit *editName; +}; + +#endif // SETUPDLG_H |