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.

81 lines
3.2KB

  1. /*
  2. configuration.cpp - A configuration
  3. Copyright (C) 2004 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. #include "actions.h"
  17. #include "configuration.h"
  18. #include "mmainwindow.h"
  19. #include "msystemtray.h"
  20. Config *Config::_instance = 0;
  21. // public
  22. Config::Config()
  23. {
  24. // automation
  25. setCurrentGroup("Automation");
  26. i_cdTrayClose = addItemBool("cd_tray_close", cdTrayClose, false, "CDTrayClose");
  27. #ifdef Q_OS_FREEBSD
  28. i_cdTrayCloseCommand = addItemString("cd_tray_close_command", cdTrayCloseCommand, "cdcontrol close", "CDTrayCloseCommand");
  29. #else
  30. i_cdTrayCloseCommand = addItemString("cd_tray_close_command", cdTrayCloseCommand, "eject -t", "CDTrayCloseCommand");
  31. #endif
  32. // custom message
  33. setCurrentGroup("Custom Message");
  34. i_customMessageEnabled = addItemBool("custom_message_enabled", customMessageEnabled, true, "Enabled");
  35. i_customMessageCommand = addItemString("custom_message_command", customMessageCommand, KS_CONFIG_KDIALOG_MESSAGE);
  36. // general
  37. setCurrentGroup("General");
  38. ItemInt *i;
  39. i = addItemInt("general_action", generalAction, Action::ShutDown, "Action");
  40. i->setMinValue(Action::ShutDown);
  41. i->setMaxValue(Action::Extras);
  42. i = addItemInt("general_delay_type", generalDelayType, MMainWindow::DelayType_TimeFromNow, "DelayType");
  43. i->setMinValue(MMainWindow::DelayType_Now);
  44. i->setMaxValue(MMainWindow::DelayType_OnAppExit);
  45. addItemDateTime("general_date_time", generalDateTime, TQDateTime::currentDateTime(), "DelayTime");
  46. // progress bar
  47. setCurrentGroup("Progress Bar");
  48. i_progressBarEnabled = addItemBool("progress_bar_enabled", progressBarEnabled, false, "Enabled");
  49. i_progressBarPosition = addItemInt("progress_bar_position", progressBarPosition, 0, "Position");
  50. // statistics
  51. setCurrentGroup("Statistics");
  52. i_statsLongFormat = addItemBool("stats_long_format", statsLongFormat, false, "LongFormat");
  53. i_statsToggleFromField = addItemBool("stats_toggle_from_field", statsToggleFromField, false, "ToggleFromField");
  54. // system tray
  55. setCurrentGroup("System Tray");
  56. i_systemTray = addItemInt("system_tray", systemTray, MSystemTray::Always, "Always");
  57. i_systemTray->setMinValue(MSystemTray::Always);
  58. i_systemTray->setMaxValue(MSystemTray::Never);
  59. // warning message
  60. setCurrentGroup("Warning Message");
  61. i_warningMessageEnabled = addItemBool("warning_message_enabled", warningMessageEnabled, true, "Enabled");
  62. i_warningMessageDelay = addItemInt("warning_message_delay", warningMessageDelay, 2, "Delay");
  63. i_warningMessageDelay->setMinValue(1);
  64. i_warningMessageDelay->setMaxValue(60);
  65. readConfig();
  66. }