KShutdown – graphical shutdown utility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.1KB

  1. /*
  2. msettingsdialog.h - A settings dialog
  3. Copyright (C) 2003 Konrad Twardowski <kdtonline@poczta.onet.pl>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. */
  16. #ifndef __MSETTINGSDIALOG_H__
  17. #define __MSETTINGSDIALOG_H__
  18. #include "actions.h"
  19. #include <kdialogbase.h>
  20. class TQCheckBox;
  21. class TQHButtonGroup;
  22. class TDEConfigDialogManager;
  23. class KIntNumInput;
  24. class KLineEdit;
  25. class TDEListView;
  26. class TDEListViewItem;
  27. class KPushButton;
  28. /** @short A settings dialog. */
  29. class MSettingsDialog: public KDialogBase
  30. {
  31. Q_OBJECT
  32. public:
  33. /**
  34. * Constructor. Creates a new modal settings dialog.
  35. * @param parent A parent widget
  36. */
  37. MSettingsDialog(TQWidget *parent);
  38. /**
  39. * Destructor.
  40. */
  41. virtual ~MSettingsDialog();
  42. inline static void freeInstance() {
  43. if (_instance) {
  44. delete _instance;
  45. _instance = 0;
  46. }
  47. }
  48. inline static bool isActive() {
  49. if (_instance) {
  50. _instance->raise();
  51. return true;
  52. }
  53. return false;
  54. }
  55. private:
  56. static int _lastPage;
  57. static MSettingsDialog *_instance;
  58. TDEConfigDialogManager *_configDialogManager;
  59. KIntNumInput *in_warningMessageDelay;
  60. KLineEdit *in_customMessageCommand;
  61. TDEListView *_actions;
  62. TDEListViewItem
  63. *_lockScreenItem,
  64. *_logoutItem,
  65. *_rebootItem,
  66. *_shutDownItem;
  67. KPushButton *b_enableAllMessages;
  68. TQCheckBox *c_autoLock;
  69. TQFrame
  70. *_actionsPage,
  71. *_advancedPage,
  72. *_generalPage,
  73. *_messagesPage;
  74. TQHButtonGroup *gb_systemTray;
  75. TQFrame *addPage(const TQString &itemName, const TQString &iconName);
  76. /**
  77. * Returns @c true if page has been disabled by the administrator (Kiosk mode).
  78. * @param key A configuration entry (in the @c kshutdownrc file)
  79. * @param page A dialog page
  80. * @param pageLayout A dialog page layout
  81. */
  82. bool disabledByAdmin(const TQString &key, TQFrame *page = 0, TQBoxLayout *pageLayout = 0) const;
  83. void initActionsPage();
  84. void initAdvancedPage();
  85. void initGeneralPage();
  86. void initMessagesPage();
  87. Action::Type itemToActionType(const TDEListViewItem *item) const;
  88. void updateActions();
  89. void updateItem(TDEListViewItem *item);
  90. private slots:
  91. void slotCheckSystemConfig();
  92. void slotConfigChanged();
  93. void slotCustomMessageTest();
  94. void slotEditAction();
  95. void slotEnableAllMessages();
  96. void slotKDESettings();
  97. void slotOKClicked();
  98. void slotSetAmorCustomMessage();
  99. void slotSetKDialogCustomMessage();
  100. void slotShutDownProblem();
  101. void slotTrayMessageProblem();
  102. void slotWarningMessageTest();
  103. protected slots:
  104. /**
  105. * Sets default values in a current page.
  106. */
  107. virtual void slotDefault();
  108. };
  109. #endif // __MSETTINGSDIALOG_H__