~ubuntu-branches/ubuntu/trusty/kdevplatform/trusty-proposed

« back to all changes in this revision

Viewing changes to shell/mainwindow_p.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2013-12-09 17:24:43 UTC
  • mfrom: (0.3.25)
  • Revision ID: package-import@ubuntu.com-20131209172443-rstb3roh6fj0c5vw
Tags: 1.6.0-0ubuntu1
* New upstream release (LP: #1259220)
* Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <QBoxLayout>
26
26
#include <QLabel>
27
27
 
28
 
#include <KMenuBar>
29
28
#include <kmenu.h>
30
29
#include <kdebug.h>
31
 
#include <klocale.h>
32
 
#include <kstatusbar.h>
33
30
#include <kxmlguiclient.h>
34
31
#include <kxmlguifactory.h>
 
32
#include <kstandardaction.h>
 
33
#include <ktogglefullscreenaction.h>
 
34
#include <kactioncollection.h>
35
35
 
36
36
#include <kparts/part.h>
37
37
#include <ktexteditor/view.h>
38
38
#include <ktexteditor/document.h>
39
39
#include <ktexteditor/editor.h>
40
40
 
41
 
#include <kstandardaction.h>
42
 
#include <kselectaction.h>
43
 
#include <ktogglefullscreenaction.h>
44
 
#include <kactioncollection.h>
45
 
#include <ktoolbarpopupaction.h>
46
 
#include <knotifyconfigwidget.h>
47
 
#include <kxmlguiclient.h>
48
 
 
49
41
#include <sublime/area.h>
50
42
#include <sublime/view.h>
51
43
#include <sublime/document.h>
61
53
#include "uicontroller.h"
62
54
#include "statusbar.h"
63
55
#include "mainwindow.h"
64
 
#include "workingsetcontroller.h"
65
56
#include "textdocument.h"
66
57
#include "sessioncontroller.h"
67
58
 
236
227
    action = KStandardAction::preferences( this, SLOT(settingsDialog()),
237
228
                                      actionCollection());
238
229
    action->setToolTip( text );
239
 
    action->setWhatsThis( QString( "<b>%1</b><p>%2</p>" ).arg( text ).arg(
240
 
                              i18n( "Lets you customize %1.", app ) ) );
 
230
    action->setWhatsThis( i18n( "Lets you customize %1.", app ) );
241
231
 
242
232
    action = actionCollection()->addAction( "show_editorconfig", this, SLOT(showEditorConfig()) );
243
233
    action->setIcon( KIcon("preferences-other") );
246
236
 
247
237
    action =  KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection());
248
238
    action->setText( i18n("Configure Notifications...") );
249
 
    action->setToolTip( i18nc("@info:tooltip", "Configure Notifications") );
250
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Configure Notifications</b><p>Shows a dialog that lets you configure notifications.</p>" ) );
 
239
    action->setToolTip( i18nc("@info:tooltip", "Configure notifications") );
 
240
    action->setWhatsThis( i18nc( "@info:whatsthis", "Shows a dialog that lets you configure notifications." ) );
251
241
 
252
242
    action = actionCollection()->addAction( "about_platform", this, SLOT(showAboutPlatform()) );
253
243
    action->setText( i18n("About KDevelop Platform") );
254
244
    action->setStatusTip( i18n("Show Information about KDevelop Platform") );
255
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>About KDevelop Platform</b><p>Shows a dialog with information about KDevelop Platform.</p>" ) );
 
245
    action->setWhatsThis( i18nc( "@info:whatsthis", "Shows a dialog with information about KDevelop Platform." ) );
256
246
 
257
247
    action = actionCollection()->addAction( "loaded_plugins", this, SLOT(showLoadedPlugins()) );
258
248
    action->setText( i18n("Loaded Plugins") );
259
249
    action->setStatusTip( i18n("Show a list of all loaded plugins") );
260
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Loaded Plugins</b><p>Shows a dialog with information about all loaded plugins.</p>" ) );
261
 
    
262
 
//     KToolBarPopupAction *popupAction;
263
 
//     popupAction = new KToolBarPopupAction( KIcon( "process-stop" ),
264
 
//                                            i18n( "&Stop" ),
265
 
//                                            actionCollection()
266
 
//                                            );
267
 
//     actionCollection()->addAction( "stop_processes",popupAction );
268
 
 
269
 
//     popupAction->setShortcut( Qt::Key_Escape );
270
 
//     popupAction->setToolTip( i18n( "Stop" ) );
271
 
//     popupAction->setWhatsThis( i18n( "<b>Stop</b><p>Stops all running processes.</p>" ) );
272
 
//     popupAction->setEnabled( false );
273
 
//     connect( popupAction, SIGNAL(triggered()),
274
 
//              this, SLOT(stopButtonPressed()) );
275
 
//     connect( popupAction->menu(), SIGNAL(aboutToShow()),
276
 
//              this, SLOT(stopMenuAboutToShow()) );
277
 
//     connect( popupAction->menu(), SIGNAL(triggered(Action*)),
278
 
//              this, SLOT(stopPopupActivated(QAction*)) );
279
 
 
280
 
     action = actionCollection()->addAction( "view_next_window" );
281
 
     action->setText( i18n( "&Next Window" ) );
282
 
     connect( action, SIGNAL(triggered(bool)), SLOT(gotoNextWindow()) );
283
 
     action->setShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_Right );
284
 
     action->setToolTip( i18nc( "@info:tooltip", "Next window" ) );
285
 
     action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Next window</b><p>Switches to the next window.</p>" ) );
286
 
     action->setIcon(KIcon("go-next"));
287
 
 
288
 
     action = actionCollection()->addAction( "view_previous_window" );
289
 
     action->setText( i18n( "&Previous Window" ) );
290
 
     connect( action, SIGNAL(triggered(bool)), SLOT(gotoPreviousWindow()) );
291
 
     action->setShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_Left );
292
 
     action->setToolTip( i18nc( "@info:tooltip", "Previous window" ) );
293
 
     action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Previous window</b><p>Switches to the previous window.</p>" ) );
294
 
     action->setIcon(KIcon("go-previous"));
295
 
 
296
 
    /*action = actionCollection()->addAction( "new_window" );
297
 
    action->setIcon(KIcon( "window-new" ));
298
 
    action->setText( i18n( "&New Window" ) );
299
 
    action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_N );
300
 
    connect( action, SIGNAL(triggered(bool)), SLOT(newWindow()) );
301
 
    action->setToolTip( i18n( "New Window" ) );
302
 
    action->setWhatsThis( i18n( "<b>New Window</b><p>Creates a new window with a duplicate of the current area.</p>" ) );*/
 
250
    action->setWhatsThis( i18nc( "@info:whatsthis", "Shows a dialog with information about all loaded plugins." ) );
 
251
 
 
252
    action = actionCollection()->addAction( "view_next_window" );
 
253
    action->setText( i18n( "&Next Window" ) );
 
254
    connect( action, SIGNAL(triggered(bool)), SLOT(gotoNextWindow()) );
 
255
    action->setShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_Right );
 
256
    action->setToolTip( i18nc( "@info:tooltip", "Next window" ) );
 
257
    action->setWhatsThis( i18nc( "@info:whatsthis", "Switches to the next window." ) );
 
258
    action->setIcon(KIcon("go-next"));
 
259
 
 
260
    action = actionCollection()->addAction( "view_previous_window" );
 
261
    action->setText( i18n( "&Previous Window" ) );
 
262
    connect( action, SIGNAL(triggered(bool)), SLOT(gotoPreviousWindow()) );
 
263
    action->setShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_Left );
 
264
    action->setToolTip( i18nc( "@info:tooltip", "Previous window" ) );
 
265
    action->setWhatsThis( i18nc( "@info:whatsthis", "Switches to the previous window." ) );
 
266
    action->setIcon(KIcon("go-previous"));
303
267
 
304
268
    action = actionCollection()->addAction( "split_horizontal" );
305
269
    action->setIcon(KIcon( "view-split-top-bottom" ));
306
270
    action->setText( i18n( "Split View &Top/Bottom" ) );
307
271
    action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_T );
308
272
    connect( action, SIGNAL(triggered(bool)), SLOT(splitHorizontal()) );
309
 
    action->setToolTip( i18nc( "@info:tooltip", "Split Horizontal" ) );
310
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Split Horizontal</b><p>Splits the current view horizontally.</p>" ) );
 
273
    action->setToolTip( i18nc( "@info:tooltip", "Split horizontal" ) );
 
274
    action->setWhatsThis( i18nc( "@info:whatsthis", "Splits the current view horizontally." ) );
311
275
 
312
276
    action = actionCollection()->addAction( "split_vertical" );
313
277
    action->setIcon(KIcon( "view-split-left-right" ));
314
278
    action->setText( i18n( "Split View &Left/Right" ) );
315
279
    action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_L );
316
280
    connect( action, SIGNAL(triggered(bool)), SLOT(splitVertical()) );
317
 
    action->setToolTip( i18nc( "@info:tooltip", "Split Vertical" ) );
318
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Split Vertical</b><p>Splits the current view vertically.</p>" ) );
 
281
    action->setToolTip( i18nc( "@info:tooltip", "Split vertical" ) );
 
282
    action->setWhatsThis( i18nc( "@info:whatsthis", "Splits the current view vertically." ) );
 
283
 
 
284
    action = actionCollection()->addAction( "view_next_split" );
 
285
    action->setText( i18n( "&Next Split View" ) );
 
286
    connect( action, SIGNAL(triggered(bool)), SLOT(gotoNextSplit()) );
 
287
    action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_N );
 
288
    action->setToolTip( i18nc( "@info:tooltip", "Next split view" ) );
 
289
    action->setWhatsThis( i18nc( "@info:whatsthis", "Switches to the next split view." ) );
 
290
    action->setIcon(KIcon("go-next"));
 
291
 
 
292
    action = actionCollection()->addAction( "view_previous_split" );
 
293
    action->setText( i18n( "&Previous Split View" ) );
 
294
    connect( action, SIGNAL(triggered(bool)), SLOT(gotoPreviousSplit()) );
 
295
    action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
 
296
    action->setToolTip( i18nc( "@info:tooltip", "Previous split view" ) );
 
297
    action->setWhatsThis( i18nc( "@info:whatsthis", "Switches to the previous split view." ) );
 
298
    action->setIcon(KIcon("go-previous"));
319
299
 
320
300
    action = KStandardAction::fullScreen( this, SLOT(toggleFullScreen(bool)), m_mainWindow, actionCollection() );
321
301
 
325
305
    action->setText( i18n( "&New" ) );
326
306
    action->setIconText( i18nc( "Shorter Text for 'New File' shown in the toolbar", "New") );
327
307
    connect( action, SIGNAL(triggered(bool)), SLOT(fileNew()) );
328
 
    action->setToolTip( i18nc( "@info:tooltip", "New File" ) );
329
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>New File</b><p>Creates an empty file.</p>" ) );
 
308
    action->setToolTip( i18nc( "@info:tooltip", "New file" ) );
 
309
    action->setWhatsThis( i18nc( "@info:whatsthis", "Creates an empty file." ) );
330
310
 
331
311
    action = actionCollection()->addAction( "add_toolview" );
332
312
    action->setIcon(KIcon("window-new"));
333
313
    action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_V );
334
314
    action->setText( i18n( "&Add Tool View..." ) );
335
315
    connect( action, SIGNAL(triggered(bool)),  SLOT(viewAddNewToolView()) );
336
 
    action->setToolTip( i18nc( "@info:tooltip", "Add Tool View" ) );
337
 
    action->setWhatsThis( i18nc( "@info:whatsthis", "<b>Add Tool View</b><p>Adds a new tool view to this window.</p>" ) );
 
316
    action->setToolTip( i18nc( "@info:tooltip", "Add tool view" ) );
 
317
    action->setWhatsThis( i18nc( "@info:whatsthis", "Adds a new tool view to this window." ) );
338
318
}
339
319
 
340
320
void MainWindowPrivate::toggleArea(bool b)
350
330
    return m_mainWindow->actionCollection();
351
331
}
352
332
 
353
 
/* Make sure that the main toolbar has only items from our actionCollection
354
 
   and not from anywhere else.  Presently, when new XMLGUI client is added,
355
 
   it's actions are always merged, and there's no clear way to stop this.
356
 
   So, we execute the below code whenever a new client is added.  */
357
 
/*
358
 
 * Only re-enable if you manage to also remove the relevant actions from the 
359
 
 * configure toolbar dialog. If not, we stay with the actions, as anything else
360
 
 * confuses users.
361
 
 * void MainWindowPrivate::fixToolbar()
362
 
{
363
 
    QWidget* w = m_mainWindow->guiFactory()->container(
364
 
        "mainToolBar", m_mainWindow);
365
 
    if (w)
366
 
        foreach (QAction *a, w->actions())
367
 
        {
368
 
            if ( !a->isSeparator() && (a != m_mainWindow->actionCollection()->action(a->objectName())) )
369
 
                w->removeAction(a);
370
 
        }
371
 
}*/
372
 
 
373
333
bool MainWindowPrivate::applicationQuitRequested() const
374
334
{
375
335
    return s_quitRequested;