~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to kbugbuster/gui/kbbmainwindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 ***************************************************************************/
16
16
 
17
17
#include "kbbmainwindow.h"
18
 
 
 
18
#include <kselectaction.h>
 
19
#include <ktoggleaction.h>
 
20
#include <kactionmenu.h>
19
21
#include <qlabel.h>
20
22
#include <qlayout.h>
21
 
#include <qmultilineedit.h>
22
 
#include <qprogressbar.h>
23
23
#include <qpushbutton.h>
24
 
#include <qtextview.h>
25
 
#include <qwidgetstack.h>
 
24
#include <QTextEdit>
 
25
//Added by qt3to4:
 
26
#include <QVBoxLayout>
 
27
#include <QBoxLayout>
26
28
 
27
29
#include <kaction.h>
 
30
#include <kactioncollection.h>
28
31
#include <kbookmarkmenu.h>
29
32
#include <kcombobox.h>
30
33
#include <kconfig.h>
32
35
#include <kdialog.h>
33
36
#include <kinputdialog.h>
34
37
#include <klineedit.h>
35
 
#include <klistview.h>
 
38
#include <k3listview.h>
36
39
#include <klocale.h>
37
40
#include <kmenubar.h>
38
41
#include <kmessagebox.h>
39
42
#include <kstatusbar.h>
40
 
#include <kstdaction.h>
41
 
#include <kstdguiitem.h>
 
43
#include <kstandardaction.h>
 
44
#include <kstandardguiitem.h>
42
45
#include <kedittoolbar.h>
43
 
 
 
46
#include <QProgressBar>
 
47
#include <kicon.h>
44
48
 
45
49
#include "bugcommand.h"
46
50
#include "bugserver.h"
58
62
 
59
63
using namespace KBugBusterMainWindow;
60
64
 
61
 
class TextViewer : public KDialogBase
 
65
class TextViewer : public KDialog
62
66
{
63
67
  public:
64
68
    TextViewer( const QString &title, QWidget *parent = 0 )
65
 
      : KDialogBase( Plain, title, Ok, Ok, parent, 0,
66
 
                     false )
 
69
      : KDialog( parent)
67
70
    {
68
 
      QFrame *topFrame = plainPage();
 
71
        setCaption( title );
 
72
        setButtons( Ok );
 
73
        setDefaultButton( Ok );
 
74
        setModal( false );
 
75
      QFrame *topFrame = new QFrame( this );
 
76
      setMainWidget( topFrame );
69
77
 
70
78
      QBoxLayout *topLayout = new QVBoxLayout( topFrame );
71
79
 
72
80
      mTextView = new QTextEdit( topFrame );
73
81
      mTextView->setReadOnly( true );
74
 
      mTextView->setTextFormat( PlainText );
 
82
      mTextView->setTextFormat( Qt::PlainText );
75
83
      topLayout->addWidget( mTextView );
76
84
 
77
85
      resize( 600, 400 );
88
96
 
89
97
KBookmarkManager* KBBBookmarkManager::s_bookmarkManager;
90
98
 
91
 
KBBMainWindow::KBBMainWindow( const QCString &initialPackage,
92
 
                              const QCString &initialComponent,
93
 
                              const QCString &initialBug,
 
99
KBBMainWindow::KBBMainWindow( const QByteArray &initialPackage,
 
100
                              const QByteArray &initialComponent,
 
101
                              const QByteArray &initialBug,
94
102
                              QWidget * , const char * name )
95
 
  : KMainWindow( 0, name ), mPreferencesDialog( 0 ), mResponseViewer( 0 ),
 
103
  : KXmlGuiWindow( 0 ), mPreferencesDialog( 0 ), mResponseViewer( 0 ),
96
104
    mBugSourceViewer( 0 ), mPackageSelectDialog( 0 )
97
105
{
 
106
    setObjectName( name );
98
107
    BugSystem::self()->setCurrentServer( KBBPrefs::instance()->mCurrentServer );
99
108
 
100
109
    m_statusLabel = new QLabel( i18n( "Welcome to <b>KBugBuster</b>." ), statusBar() );
108
117
 
109
118
    initActions();
110
119
 
111
 
    m_progressBar = new QProgressBar( 100, statusBar() );
112
 
    m_progressBar->setCenterIndicator( true );
 
120
    m_progressBar = new QProgressBar( statusBar() );
 
121
    m_progressBar->setMaximum(100);
 
122
    m_progressBar->setAlignment( Qt::AlignHCenter );
113
123
    m_progressBar->setMinimumWidth( 150 );
114
124
    m_progressBar->setMaximumHeight( statusBar()->fontMetrics().height() + 6 );
115
125
    statusBar()->addWidget( m_progressBar );
133
143
 
134
144
KBBMainWindow::~KBBMainWindow()
135
145
{
136
 
//    kdDebug() << "KBBMainWindow::~KBBMainWindow()" << endl;
 
146
//    kDebug() << "KBBMainWindow::~KBBMainWindow()";
137
147
    delete m_pBookmarkMenu;
138
148
 
139
149
    m_mainWidget->writeConfig();
144
154
void KBBMainWindow::initActions()
145
155
{
146
156
    // Prepare and create XML GUI
147
 
    fileQuit          = KStdAction::quit( this,
 
157
    fileQuit          = KStandardAction::quit( this,
148
158
                        SLOT( close() ), actionCollection() );
149
159
    fileQuit->setToolTip( i18n( "Quit KBugBuster" ) );
150
160
 
151
 
    new KAction( i18n("See &Pending Changes"), "contents", 0, this, SLOT( slotListChanges() ),
152
 
                 actionCollection(), "file_seechanges" );
153
 
    new KAction( i18n("&Submit Changes"), "mail_send", 0, this, SLOT( slotSubmit() ),
154
 
                 actionCollection(), "file_submit" );
155
 
 
156
 
    reloadpacklist = new KAction( i18n("Reload &Product List"), "reload", CTRL+Qt::Key_F5, m_mainWidget, SLOT( slotReloadPackageList() ),
157
 
                 actionCollection(), "reload_packagelist" );
158
 
    reloadpack= new KAction( i18n("Reload Bug &List (for current product)"), "reload", Qt::Key_F5, m_mainWidget, SLOT( slotReloadPackage() ),
159
 
                 actionCollection(), "reload_package" );
160
 
    reloadbug = new KAction( i18n("Reload Bug &Details (for current bug)"), "reload", SHIFT+Qt::Key_F5, m_mainWidget, SLOT( slotReloadBug() ),
161
 
                 actionCollection(), "reload_bug" );
162
 
    loadMyBugs = new KAction( i18n( "Load &My Bugs List" ), 0, m_mainWidget, SLOT( slotLoadMyBugs() ),
163
 
                 actionCollection(), "load_my_bugs" );
164
 
    reloadall = new KAction( i18n("Load All Bug Details (for current product)"), Qt::Key_F6, m_mainWidget, SLOT( slotRetrieveAllBugDetails() ), actionCollection(), "load_allbugs" );
165
 
    new KAction( i18n("Extract &Attachments"), "filesave", Qt::Key_F4, m_mainWidget, SLOT( slotExtractAttachments() ),
166
 
                 actionCollection(), "extract_attachments" );
167
 
 
168
 
    new KAction( i18n("Clear Cache"), 0, this, SLOT( clearCache() ),
169
 
                 actionCollection(), "clear_cache" );
170
 
 
171
 
    new KAction( i18n("&Search by Product..."), "goto", CTRL+Qt::Key_P, this,
172
 
                 SLOT( searchPackage() ), actionCollection(), "search_package" );
173
 
    new KAction( i18n("Search by Bug &Number..."), "filefind", CTRL+Qt::Key_N, this,
174
 
                 SLOT( searchBugNumber() ), actionCollection(), "search_bugnumber" );
 
161
    QAction *action = actionCollection()->addAction( "file_seechanges" );
 
162
    action->setIcon( KIcon("document-preview") );
 
163
    action->setText( i18n("See &Pending Changes") );
 
164
    connect(action, SIGNAL(triggered(bool)), SLOT( slotListChanges() ));
 
165
    action = actionCollection()->addAction( "file_submit" );
 
166
    action->setIcon( KIcon("mail-send") );
 
167
    action->setText( i18n("&Submit Changes") );
 
168
    connect(action, SIGNAL(triggered(bool)), SLOT( slotSubmit() ));
 
169
 
 
170
    reloadpacklist = actionCollection()->addAction( "reload_packagelist" );
 
171
    reloadpacklist->setIcon( KIcon("view-refresh") );
 
172
    reloadpacklist->setText( i18n("Reload &Product List") );
 
173
    connect(reloadpacklist, SIGNAL(triggered(bool)), m_mainWidget, SLOT( slotReloadPackageList() ));
 
174
    reloadpacklist->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_F5));
 
175
    reloadpack = actionCollection()->addAction( "reload_package" );
 
176
    reloadpack->setIcon( KIcon("view-refresh") );
 
177
    reloadpack->setText( i18n("Reload Bug &List (for current product)") );
 
178
    connect(reloadpack, SIGNAL(triggered(bool)), m_mainWidget, SLOT( slotReloadPackage() ));
 
179
    reloadpack->setShortcut(QKeySequence(Qt::Key_F5));
 
180
    reloadbug = actionCollection()->addAction( "reload_bug" );
 
181
    reloadbug->setIcon( KIcon("view-refresh") );
 
182
    reloadbug->setText( i18n("Reload Bug &Details (for current bug)") );
 
183
    connect(reloadbug, SIGNAL(triggered(bool)), m_mainWidget, SLOT( slotReloadBug() ));
 
184
    reloadbug->setShortcut(QKeySequence(Qt::SHIFT+Qt::Key_F5));
 
185
    loadMyBugs = actionCollection()->addAction( "load_my_bugs" );
 
186
    loadMyBugs->setText( i18n( "Load &My Bugs List" ) );
 
187
    connect(loadMyBugs, SIGNAL(triggered(bool) ), m_mainWidget, SLOT( slotLoadMyBugs() ));
 
188
    reloadall = actionCollection()->addAction( "load_allbugs" );
 
189
    reloadall->setText( i18n("Load All Bug Details (for current product)") );
 
190
    connect(reloadall, SIGNAL(triggered(bool) ), m_mainWidget, SLOT( slotRetrieveAllBugDetails() ));
 
191
    reloadall->setShortcut(QKeySequence(Qt::Key_F6));
 
192
    action = actionCollection()->addAction( "extract_attachments" );
 
193
    action->setIcon( KIcon("document-save") );
 
194
    action->setText( i18n("Extract &Attachments") );
 
195
    connect(action, SIGNAL(triggered(bool)), m_mainWidget, SLOT( slotExtractAttachments() ));
 
196
    action->setShortcut(QKeySequence(Qt::Key_F4));
 
197
 
 
198
    action = actionCollection()->addAction( "clear_cache" );
 
199
    action->setText( i18n("Clear Cache") );
 
200
    connect(action, SIGNAL(triggered(bool) ), SLOT( clearCache() ));
 
201
 
 
202
    action = actionCollection()->addAction( "search_package" );
 
203
    action->setIcon( KIcon("go-jump") );
 
204
    action->setText( i18n("&Search by Product...") );
 
205
    connect(action, SIGNAL(triggered(bool)), SLOT( searchPackage() ));
 
206
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_P));
 
207
    action = actionCollection()->addAction( "search_bugnumber" );
 
208
    action->setIcon( KIcon("edit-find") );
 
209
    action->setText( i18n("Search by Bug &Number...") );
 
210
    connect(action, SIGNAL(triggered(bool)), SLOT( searchBugNumber() ));
 
211
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N));
175
212
    // For now "Description" searches by title. Maybe later we can have a
176
213
    // full-text search interfacing bugs.kde.org and rename the current one to "By Title".
177
 
    new KAction( i18n("Search by &Description...") ,"find", CTRL+Qt::Key_D, this,
178
 
                 SLOT( searchDescription() ), actionCollection(), "search_description" );
 
214
    action = actionCollection()->addAction( "search_description" );
 
215
    action->setIcon( KIcon("edit-find") );
 
216
    action->setText( i18n("Search by &Description...") );
 
217
    connect(action, SIGNAL(triggered(bool)), SLOT( searchDescription() ));
 
218
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_D));
179
219
 
180
 
//    new KAction( i18n("&Merge"), "view_remove", CTRL+Qt::Key_M, m_mainWidget,
 
220
//    new KAction( i18n("&Merge"), "view-close", CTRL+Qt::Key_M, m_mainWidget,
181
221
//                 SLOT( mergeBugs() ), actionCollection(), "cmd_merge" );
182
 
//    new KAction( i18n("&Unmerge"), "view_top_bottom", CTRL+SHIFT+Qt::Key_M, m_mainWidget,
 
222
//    new KAction( i18n("&Unmerge"), "view-split-top-bottom", CTRL+SHIFT+Qt::Key_M, m_mainWidget,
183
223
//                 SLOT( unmergeBugs() ), actionCollection(), "cmd_unmerge" );
184
 
    new KAction( i18n("C&lose..."), "edittrash", CTRL+Qt::Key_L, m_mainWidget,
185
 
                 SLOT( closeBug() ), actionCollection(), "cmd_close" );
186
 
//    new KAction( i18n("Clos&e Silently"), "edittrash", CTRL+Qt::Key_E, m_mainWidget,
 
224
    action = actionCollection()->addAction( "cmd_close" );
 
225
    action->setIcon( KIcon("user-trash") );
 
226
    action->setText( i18n("C&lose...") );
 
227
    connect(action, SIGNAL(triggered(bool)), m_mainWidget, SLOT( closeBug() ));
 
228
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_L));
 
229
//    new KAction( i18n("Clos&e Silently"), "user-trash", CTRL+Qt::Key_E, m_mainWidget,
187
230
//                 SLOT( closeBugSilently() ), actionCollection(), "cmd_close_silently" );
188
 
    new KAction( i18n("Re&open"), "idea", CTRL+Qt::Key_O, m_mainWidget,
189
 
                 SLOT( reopenBug() ), actionCollection(), "cmd_reopen" );
190
 
//    new KAction( i18n("Re&assign..."), "folder_new", CTRL+Qt::Key_A, m_mainWidget,
 
231
    action = actionCollection()->addAction( "cmd_reopen" );
 
232
    action->setIcon( KIcon("edit-redo") );
 
233
    action->setText( i18n("Re&open") );
 
234
    connect(action, SIGNAL(triggered(bool)), m_mainWidget, SLOT( reopenBug() ));
 
235
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_O));
 
236
//    new KAction( i18n("Re&assign..."), "folder-new", CTRL+Qt::Key_A, m_mainWidget,
191
237
//                 SLOT( reassignBug() ), actionCollection(), "cmd_reassign" );
192
 
//    new KAction( i18n("Change &Title..."), "text_under", CTRL+Qt::Key_T, m_mainWidget,
 
238
//    new KAction( i18n("Change &Title..."), "edit-rename", CTRL+Qt::Key_T, m_mainWidget,
193
239
//                 SLOT( titleBug() ), actionCollection(), "cmd_title" );
194
 
//    new KAction( i18n("Change &Severity..."), "edit", CTRL+Qt::Key_S, m_mainWidget,
 
240
//    new KAction( i18n("Change &Severity..."), "document-properties", CTRL+Qt::Key_S, m_mainWidget,
195
241
//                 SLOT( severityBug() ), actionCollection(), "cmd_severity" );
196
 
    new KAction( i18n("&Reply..."), "mail_replyall",CTRL+Qt::Key_R , m_mainWidget,
197
 
                 SLOT( replyBug() ), actionCollection(), "cmd_reply" );
198
 
    new KAction( i18n("Reply &Privately..."), "mail_reply", CTRL+Qt::Key_I, m_mainWidget,
199
 
                 SLOT( replyPrivateBug() ), actionCollection(), "cmd_replyprivate" );
 
242
    action = actionCollection()->addAction( "cmd_reply" );
 
243
    action->setIcon( KIcon("mail-reply-all") );
 
244
    action->setText( i18n("&Reply...") );
 
245
    connect(action, SIGNAL(triggered(bool)), m_mainWidget, SLOT( replyBug() ));
 
246
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_R));
 
247
    action = actionCollection()->addAction( "cmd_replyprivate" );
 
248
    action->setIcon( KIcon("mail-reply-sender") );
 
249
    action->setText( i18n("Reply &Privately...") );
 
250
    connect(action, SIGNAL(triggered(bool)), m_mainWidget, SLOT( replyPrivateBug() ));
 
251
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_I));
200
252
 
201
 
    KStdAction::showMenubar(this, SLOT( slotToggleMenubar() ), actionCollection() );
202
 
#if KDE_IS_VERSION( 3, 1, 90 )
 
253
    KStandardAction::showMenubar(this, SLOT( slotToggleMenubar() ), actionCollection() );
203
254
    createStandardStatusBarAction();
204
255
    setStandardToolBarMenuEnabled(true);
205
 
#endif
206
256
 
207
 
    m_disconnectedAction = new KToggleAction( i18n("&Disconnected Mode"), 0,
208
 
                                              this,
209
 
                                              SLOT( slotDisconnectedAction() ),
210
 
                                              actionCollection(),
211
 
                                              "settings_disconnected" );
 
257
    m_disconnectedAction = actionCollection()->add<KToggleAction>( "settings_disconnected" );
 
258
    m_disconnectedAction->setText( i18n("&Disconnected Mode") );
 
259
    connect(m_disconnectedAction, SIGNAL(triggered(bool)), SLOT( slotDisconnectedAction() ));
212
260
    m_disconnectedAction->setChecked( BugSystem::self()->disconnected() );
213
261
 
214
262
    // Bookmarks menu
215
 
    m_pamBookmarks = new KActionMenu( i18n( "&Bookmarks" ), "bookmark", actionCollection(), "bookmarks" );
216
 
    m_pBookmarkMenu = new KBookmarkMenu( KBBBookmarkManager::self(), this, m_pamBookmarks->popupMenu(), actionCollection(), true );
217
 
 
218
 
    KStdAction::preferences( this, SLOT(preferences()), actionCollection() );
219
 
 
220
 
    KToggleAction *toggleTmp =  new KToggleAction( i18n("Show Closed Bugs"), "recycled", 0, this, SLOT( slotToggleDone() ),
221
 
                 actionCollection(), "cmd_toggle_done" );
222
 
#if KDE_IS_VERSION( 3, 2, 90 )
223
 
    toggleTmp->setCheckedState(i18n("Hide Closed Bugs"));
224
 
#endif
 
263
    m_pamBookmarks = actionCollection()->add<KActionMenu>( "bookmarks" );
 
264
    m_pamBookmarks->setText( i18n( "&Bookmarks" ) );
 
265
    m_pBookmarkMenu = new KBookmarkMenu( KBBBookmarkManager::self(), this, m_pamBookmarks->menu(), actionCollection() );
 
266
 
 
267
    KStandardAction::preferences( this, SLOT(preferences()), actionCollection() );
 
268
 
 
269
    KToggleAction *toggleTmp = actionCollection()->add<KToggleAction>( "cmd_toggle_done" );
 
270
    toggleTmp->setIcon( KIcon("view-filter") );
 
271
    toggleTmp->setText( i18n("Show Closed Bugs") );
 
272
    connect(toggleTmp, SIGNAL(triggered(bool) ), SLOT( slotToggleDone() ));
 
273
    toggleTmp->setCheckedState(KGuiItem(i18n("Hide Closed Bugs")));
225
274
    toggleTmp->setChecked( KBBPrefs::instance()->mShowClosedBugs );
226
275
 
227
 
    toggleTmp =new KToggleAction( i18n("Show Wishes"), "bookmark", 0, this, SLOT( slotToggleWishes() ),
228
 
                 actionCollection(), "cmd_toggle_wishes" );
229
 
#if KDE_IS_VERSION( 3, 2, 90 )
230
 
    toggleTmp->setCheckedState(i18n("Hide Wishes"));
231
 
#endif
 
276
    toggleTmp = actionCollection()->add<KToggleAction>( "cmd_toggle_wishes" );
 
277
    toggleTmp->setIcon( KIcon("view-history") );
 
278
    toggleTmp->setText( i18n("Show Wishes") );
 
279
    connect(toggleTmp, SIGNAL(triggered(bool) ), SLOT( slotToggleWishes() ));
 
280
    toggleTmp->setCheckedState(KGuiItem(i18n("Hide Wishes")));
232
281
    toggleTmp->setChecked(KBBPrefs::instance()->mShowWishes);
233
282
 
234
 
    mSelectServerAction = new KSelectAction( i18n( "Select Server" ), 0, 0,
235
 
                                             this,
236
 
                                             SLOT( slotSelectServer() ),
237
 
                                             actionCollection(),
238
 
                                             "select_server" );
239
 
 
 
283
    mSelectServerAction = actionCollection()->add<KSelectAction>( "select_server", this, SLOT( slotSelectServer() ) );
 
284
    mSelectServerAction->setText( i18n( "Select Server" ) );
240
285
    setupSelectServerAction();
241
286
 
242
287
    if ( KBBPrefs::instance()->mDebugMode ) {
243
 
      new KAction( i18n("Show Last Server Response..."), 0 , this,
244
 
                   SLOT( showLastResponse() ), actionCollection(),
245
 
                   "debug_lastresponse" );
246
 
      new KAction( i18n("Show Bug HTML Source..."), 0 , this,
247
 
                   SLOT( showBugSource() ), actionCollection(),
248
 
                   "debug_showbugsource" );
 
288
      action = actionCollection()->addAction( "debug_lastresponse" );
 
289
      action->setText( i18n("Show Last Server Response...") );
 
290
      connect(action, SIGNAL(triggered(bool) ), SLOT( showLastResponse() ));
 
291
      action = actionCollection()->addAction( "debug_showbugsource" );
 
292
      action->setText( i18n("Show Bug HTML Source...") );
 
293
      connect(action, SIGNAL(triggered(bool) ), SLOT( showBugSource() ));
249
294
    }
250
295
 
251
 
#if KDE_IS_VERSION( 3, 2, 90 )
252
296
    setupGUI( (ToolBar | Keys | StatusBar | Save | Create ), "kbugbusterui.rc" );
253
 
#else
254
 
    createGUI();
255
 
#endif
256
297
}
257
298
 
258
299
void KBBMainWindow::slotToggleMenubar()
270
311
{
271
312
    QStringList servers;
272
313
    int current = -1;
273
 
    QValueList<BugServer *> serverList = BugSystem::self()->serverList();
274
 
    QValueList<BugServer *>::ConstIterator it;
 
314
    QList<BugServer *> serverList = BugSystem::self()->serverList();
 
315
    QList<BugServer *>::ConstIterator it;
275
316
    for ( it = serverList.begin(); it != serverList.end(); ++it ) {
276
317
      QString name = (*it)->serverConfig().name();
277
318
      servers.append( name );
285
326
    }
286
327
}
287
328
 
288
 
QString KBBMainWindow::currentURL() const
 
329
QString KBBMainWindow::currentUrl() const
289
330
{
290
331
  QString number=m_mainWidget->currentNumber();
291
332
 
297
338
 
298
339
QString KBBMainWindow::currentTitle() const
299
340
{
300
 
  return "#"+m_mainWidget->currentNumber()+": "+m_mainWidget->currentTitle();
 
341
  return '#'+m_mainWidget->currentNumber()+": "+m_mainWidget->currentTitle();
301
342
}
302
343
 
303
 
void KBBMainWindow::openBookmarkURL( const QString & url )
 
344
void KBBMainWindow::openBookmark(const KBookmark & bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km)
304
345
{
 
346
    const QString & url = bm.url().url();
305
347
    if ( url.left(4)=="bug:" ) {
306
348
      QString bugnumber = url.mid(4);
307
349
      m_mainWidget->slotRetrieveBugDetails( Bug::fromNumber( bugnumber ) );
342
384
    if (list.count() > 0)
343
385
    {
344
386
       int ret = KMessageBox::questionYesNoList( this, i18n("List of pending commands:"),
345
 
                                              list, QString::null, KStdGuiItem::clear(), KStdGuiItem::close() );
 
387
                                              list, QString(), KStandardGuiItem::clear(), KStandardGuiItem::close() );
346
388
       if ( ret == KMessageBox::Yes )
347
389
       {
348
390
           // Ask for confirmation, it's too easy to click the wrong button in the above dlg box
349
391
           if ( KMessageBox::warningContinueCancel( this, i18n("Do you really want to delete all commands?"),
350
 
                               i18n("Confirmation Required"), KGuiItem( i18n("&Delete"), "editdelete"), "clearcommands", true)
 
392
                               i18n("Confirmation Required"), KGuiItem( i18n("&Delete"), "edit-delete"), KStandardGuiItem::cancel(), "clearcommands", KMessageBox::Notify)
351
393
                   == KMessageBox::Continue )
352
394
               BugSystem::self()->clearCommands();
353
395
       }
361
403
void KBBMainWindow::slotSetPercent( unsigned long percent )
362
404
{
363
405
    // KIO::Job::percent() shouldn't return an unsigned long. - Frerich
364
 
    m_progressBar->setProgress( percent );
 
406
    m_progressBar->setValue( percent );
365
407
}
366
408
 
367
409
void KBBMainWindow::searchPackage()
372
414
    mPackageSelectDialog->setPackages( BugSystem::self()->packageList() );
373
415
    BugServerConfig cfg = BugSystem::self()->server()->serverConfig();
374
416
    QStringList recent = cfg.recentPackages();
375
 
    kdDebug() << "MainWindow RECENT: " << recent.join(",") << endl;
 
417
    kDebug() << "MainWindow RECENT: " << recent.join(",");
376
418
    mPackageSelectDialog->setRecentPackages( recent );
377
419
 
378
420
    mPackageSelectDialog->exec();
391
433
    bool ok = false;
392
434
    QString result = KInputDialog::getText( i18n("Search for Bug Number"),
393
435
                                            i18n("Please enter a bug number:"),
394
 
                                            QString::null, &ok, this );
 
436
                                            QString(), &ok, this );
395
437
    if ( ok ) {
396
438
      //Strip whitespace and # if needed
397
 
      result = result.stripWhiteSpace();
 
439
      result = result.trimmed();
398
440
      if (result[0]=='#')
399
441
        result = result.mid(1);
400
442
    }
408
450
 
409
451
void KBBMainWindow::searchDescription()
410
452
{
411
 
    kdDebug() << "KBBMainWindow::searchDescription()." << endl;
 
453
    kDebug() << "KBBMainWindow::searchDescription().";
412
454
    //KMessageBox::sorry(this,i18n("searchDescription(): to be implemented."),i18n("Not implemented"));
413
455
    KFindDialog dlg( this );
414
 
    if ( dlg.exec() == KDialogBase::Accepted )
 
456
    if ( dlg.exec() == KDialog::Accepted )
415
457
        m_mainWidget->searchBugByTitle( dlg.options(), dlg.pattern() );
416
458
}
417
459
 
420
462
    if ( ! BugSystem::self()->server()->commandsPending() ) return true;
421
463
 
422
464
    int result = KMessageBox::warningYesNoCancel(this,i18n("There are unsent bug commands."
423
 
                                                           " Do you want to send them now?"), QString::null, i18n("Send"), i18n("Do Not Send"));
 
465
                                                           " Do you want to send them now?"), QString(), KGuiItem(i18n("Send")), KGuiItem(i18n("Do Not Send")));
424
466
    if ( result == KMessageBox::Cancel ) return false;
425
467
    if ( result == KMessageBox::Yes ) {
426
468
        BugSystem::self()->sendCommands();