summaryrefslogtreecommitdiffstats
path: root/kbugbuster/backend/kbbprefs.cpp
blob: 73a6be54ea115e007c14eb981bb76483acd65f39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
    This file is part of KBugBuster.

    Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>

    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.

    As a special exception, permission is given to link this program
    with any edition of TQt, and distribute the resulting executable,
    without including the source code for TQt in the source distribution.
*/

#include <tqstring.h>
#include <tqstringlist.h>

#include <tdelocale.h>
#include <kdebug.h>
#include <tdeconfig.h>

#include "bugsystem.h"
#include "bugserver.h"
#include "bugserverconfig.h"

#include "kbbprefs.h"

KBBPrefs *KBBPrefs::mInstance = 0;

KBBPrefs::KBBPrefs() : TDEConfigSkeleton()
{
  setCurrentGroup("History");

  addItemInt("RecentPackagesCount",mRecentPackagesCount,7);
  addItemIntList("Splitter1",mSplitter1);
  addItemIntList("Splitter2",mSplitter2);


  setCurrentGroup("Personal Settings");

  addItemInt("MailClient",mMailClient,MailSender::KMail,"Mail Client");
  addItemBool("ShowClosedBugs",mShowClosedBugs,false);
  addItemBool("ShowWishes",mShowWishes,true);
  addItemBool("ShowVotes", mShowVoted, false);
  addItemInt("MinimumVotes", mMinVotes, 0);
  addItemBool("SendBCC",mSendBCC,false);
  addItemString("OverrideRecipient",mOverrideRecipient,TQString());
  addItemInt("WrapColumn",mWrapColumn,90);


  setCurrentGroup("MsgInputDlg");

  addItemInt("MsgDialogWidth",mMsgDlgWidth);
  addItemInt("MsgDialogHeight",mMsgDlgHeight);
  addItemIntList("MsgDialogSplitter",mMsgDlgSplitter);


  setCurrentGroup( "Debug" );

  addItemBool( "DebugMode", mDebugMode, false );


  setCurrentGroup( "Servers" );

  addItemString("CurrentServer",mCurrentServer);
}


KBBPrefs::~KBBPrefs()
{
  delete mInstance;
  mInstance = 0;
}


KBBPrefs *KBBPrefs::instance()
{
  if (!mInstance) {
    mInstance = new KBBPrefs();
    mInstance->readConfig();
  }

  return mInstance;
}

void KBBPrefs::usrSetDefaults()
{
  setMessageButtonsDefault();
}

void KBBPrefs::usrReadConfig()
{
  mMessageButtons.clear();

  config()->setGroup("MessageButtons");
  TQStringList buttonList = config()->readListEntry("ButtonList");
  if (buttonList.isEmpty()) {
    setMessageButtonsDefault();
  } else {
    TQStringList::ConstIterator it;
    for(it = buttonList.begin(); it != buttonList.end(); ++it) {
      TQString text = config()->readEntry(*it);
      mMessageButtons.insert(*it,text);
    }
  }

  BugSystem::self()->readConfig( config() );
}

void KBBPrefs::usrWriteConfig()
{
  config()->setGroup("MessageButtons");
  TQStringList buttonList;
  TQMap<TQString,TQString>::ConstIterator it;
  for(it = mMessageButtons.begin();it != mMessageButtons.end();++it) {
    buttonList.append(it.key());
    config()->writeEntry(it.key(),it.data());
  }
  config()->writeEntry("ButtonList",buttonList);

  BugSystem::self()->writeConfig( config() );
}

void KBBPrefs::setMessageButtonsDefault()
{
  mMessageButtons.clear();
  mMessageButtons.insert(i18n("Bug Fixed in GIT"),"Thank you for your bug report.\n"
  "The bug that you reported has been identified and has been fixed in the\n"
  "latest development version of TDE. The bug report will be closed.\n");
  mMessageButtons.insert(i18n("Duplicate Report"),"Thank you for your bug report.\n"
  "This bug/feature request has already been reported and this report will\n"
  "be marked as a duplicate.\n");
  mMessageButtons.insert(i18n("Packaging Bug"),"Thank you for your bug report.\n"
  "The bug that you reported appears to be a packaging bug, due to a\n"
  "problem in the way in which your distribution/vendor has packaged\n"
  "TDE for distribution.\n"
  "The bug report will be closed since it is not a TDE problem.\n"
  "Please send the bug report to your distribution/vendor instead.\n");
  mMessageButtons.insert(i18n("Feature Implemented in GIT"),"Thank you for your bug report.\n"
  "The feature that you requested has been implemented in the latest\n"
  "development version of TDE. The feature request will be closed.\n");
  mMessageButtons.insert(i18n("More Information Required"),"Thank you for your bug report.\n"
  "You have not provided enough information for us to be able to reproduce\n"
  "the bug. Please provide a detailed account of the steps required to\n"
  "trigger and reproduce the bug. Without this information, we will not be\n"
  "able to reproduce, identify and fix the bug.\n");
  mMessageButtons.insert(i18n("No Longer Applicable"),"Thank you for your bug report.\n"
  "The bug that your reported no longer applies to the latest development\n"
  "version of TDE. This is most probably because it has been fixed,\n"
  "the application has been substantially modified or the application no\n"
  "longer exists. The bug report will be closed.\n");
  mMessageButtons.insert(i18n("Won't Fix Bug"),"Thank you for your bug report/feature request.\n"
  "Unfortunately, this bug will never be fixed or the feature never\n"
  "implemented. The bug report/feature request will be closed.\n");
  mMessageButtons.insert(i18n("Cannot Reproduce Bug"),"Thank you for your bug report.\n"
  "This bug can not be reproduced using the current development (GIT)\n"
  "version of TDE. This suggests that the bug has already been fixed.\n"
  "The bug report will be closed.\n");
}