~ubuntu-branches/ubuntu/trusty/krusader/trusty

« back to all changes in this revision

Viewing changes to krusader/krusader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-08-08 13:47:36 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20110808134736-8e630ivgd2c3sgg5
Tags: 1:2.4.0~beta1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
 
71
71
#include "krusaderversion.h"
72
72
#include "kicons.h"
73
 
#include "VFS/krpermhandler.h"
74
 
#include "GUI/krusaderstatus.h"
75
 
#include "Dialogs/krpleasewait.h"
76
73
#include "krusaderview.h"
77
 
#include "Konfigurator/konfigurator.h"
78
 
#include "Konfigurator/kgprotocols.h"
79
 
#include "MountMan/kmountman.h"
80
 
#include "Panel/panelpopup.h"
81
 
#include "Queue/queue_mgr.h"
82
74
#include "defaults.h"
83
75
#include "resources.h"
84
 
#include "GUI/kfnkeys.h"
85
 
#include "GUI/kcmdline.h"
86
 
#include "GUI/terminaldock.h"
87
76
#include "krslots.h"
88
77
#include "krservices.h"
89
 
#include "UserAction/useraction.h"
90
 
#include "Panel/listpanel.h"
 
78
// This makes gcc-4.1 happy. Warning about possible problem with KrAction's dtor not called
 
79
#include "krtrashhandler.h"
 
80
#include "tabactions.h"
 
81
#include "krglobal.h"
 
82
#include "kractions.h"
 
83
#include "panelmanager.h"
 
84
#include "Panel/viewactions.h"
 
85
#include "Panel/listpanelactions.h"
 
86
#include "Panel/krview.h"
91
87
#include "Panel/krviewfactory.h"
92
 
// This makes gcc-4.1 happy. Warning about possible problem with KrAction's dtor not called
93
88
#include "UserAction/kraction.h"
94
89
#include "UserAction/expander.h"
 
90
#include "UserAction/useraction.h"
95
91
#include "UserMenu/usermenu.h"
96
 
#include "BookMan/krbookmarkhandler.h"
97
92
#include "Dialogs/popularurls.h"
 
93
#include "Dialogs/checksumdlg.h"
 
94
#include "Dialogs/krpleasewait.h"
98
95
#include "GUI/krremoteencodingmenu.h"
99
 
#include "Dialogs/checksumdlg.h"
 
96
#include "GUI/kfnkeys.h"
 
97
#include "GUI/kcmdline.h"
 
98
#include "GUI/terminaldock.h"
 
99
#include "GUI/krusaderstatus.h"
100
100
#include "VFS/vfile.h"
101
 
#include "krtrashhandler.h"
102
 
#include "Panel/viewactions.h"
103
 
#include "Panel/listpanelactions.h"
 
101
#include "VFS/krpermhandler.h"
 
102
#include "MountMan/kmountman.h"
 
103
#include "Queue/queue_mgr.h"
 
104
#include "Konfigurator/kgprotocols.h"
 
105
#include "BookMan/krbookmarkhandler.h"
 
106
 
 
107
 
104
108
 
105
109
#ifdef __KJSEMBED__
106
110
#include "KrJS/krjs.h"
107
111
#endif
108
112
 
109
 
#include "krglobal.h"
110
 
#include "kractions.h"
111
 
#include "panelmanager.h"
112
113
 
113
114
// define the static members
114
115
Krusader *Krusader::App = 0;
303
304
    // for some reason sometimes the active view cannot be focused immediately at this point,
304
305
    // so queue it for the main loop
305
306
    QTimer::singleShot(0, ACTIVE_PANEL->view->widget(), SLOT(setFocus()));
 
307
 
 
308
    _openUrlTimer.setSingleShot(true);
 
309
    connect(&_openUrlTimer, SIGNAL(timeout()), SLOT(doOpenUrl()));
306
310
}
307
311
 
308
312
Krusader::~Krusader()
423
427
    _krActions = new KrActions(this);
424
428
    _viewActions = new ViewActions(this, this);
425
429
    _listPanelActions = new ListPanelActions(this, this);
 
430
    _tabActions = new TabActions(this, this);
426
431
}
427
432
 
428
433
///////////////////////////////////////////////////////////////////////////
443
448
    if (!MAIN_VIEW->getTerminalEmulatorSplitterSizes().isEmpty())
444
449
        cfg.writeEntry("Terminal Emulator Splitter Sizes", MAIN_VIEW->getTerminalEmulatorSplitterSizes());
445
450
 
446
 
    // save view settings ---> fix when we have tabbed-browsing
447
 
    MAIN_VIEW->left->view->saveSettings();
448
 
    MAIN_VIEW->right->view->saveSettings();
449
 
 
450
451
    cfg = krConfig->group("Startup");
451
 
    cfg.writeEntry("Vertical Mode", MAIN_VIEW->isVertical());
 
452
    MAIN_VIEW->saveSettings(cfg);
452
453
    krConfig->sync();
453
454
}
454
455
 
455
456
void Krusader::saveSettings() {
456
457
    KConfigGroup cfg(krConfig, "Main Toolbar");
457
 
    toolBar() ->saveSettings(cfg);
 
458
    toolBar()->saveSettings(cfg);
458
459
 
459
460
    cfg = krConfig->group("Actions Toolbar");
460
461
    toolBar("actionsToolBar")->saveSettings(cfg);
461
462
 
462
463
    cfg = krConfig->group("Startup");
463
 
    MAIN_VIEW->saveSettings(cfg);
464
464
 
465
465
    bool rememberpos = cfg.readEntry("Remember Position", _RememberPos);
466
466
    bool uisavesettings = cfg.readEntry("UI Save Settings", _UiSave);
467
467
 
468
 
    // save the popup panel's page of the CURRENT tab
469
 
    MAIN_VIEW->left->saveSettings(cfg);
470
 
    MAIN_VIEW->right->saveSettings(cfg);
471
 
 
472
468
    // save size and position
473
 
    if (rememberpos || uisavesettings) {
 
469
    if (rememberpos || uisavesettings)
474
470
        savePosition();
475
 
    }
476
471
 
477
472
    // save the gui
478
473
    if (uisavesettings) {
479
474
        cfg = krConfig->group("Startup");
480
475
        cfg.writeEntry("Show status bar", KrActions::actShowStatusBar->isChecked());
481
 
        cfg.writeEntry("Show tool bar", KrActions::actShowToolBar->isChecked());
 
476
        cfg.writeEntry("Show tool bar", !toolBar()->isHidden());
 
477
        cfg.writeEntry("Show actions tool bar", !toolBar("actionsToolBar")->isHidden());
482
478
        cfg.writeEntry("Show FN Keys", KrActions::actToggleFnkeys->isChecked());
483
479
        cfg.writeEntry("Show Cmd Line", KrActions::actToggleCmdline->isChecked());
484
480
        cfg.writeEntry("Show Terminal Emulator", KrActions::actToggleTerminal->isChecked());
485
 
        cfg.writeEntry("Vertical Mode", MAIN_VIEW->isVertical());
486
481
        cfg.writeEntry("Start To Tray", isHidden());
487
482
    }
488
483
 
613
608
                // KDE is funny and rejects the close event for
614
609
                // playing a fancy animation with the CANCEL button.
615
610
                // if we hide the widget, KDialog accepts the close event
616
 
                // dont't hide Konfigurator - see Konfigurator::closeEvent()
 
611
                // don't hide Konfigurator - see Konfigurator::closeEvent()
617
612
                w->hide();
618
613
                hid = true;
619
614
            }
695
690
 
696
691
    KConfigGroup cfg_act(krConfig->group("Actions Toolbar"));
697
692
    toolBar("actionsToolBar") ->applySettings(cfg_act);
698
 
    static_cast<KToggleAction*>(actionCollection()->action("toggle actions toolbar"))->
699
 
    setChecked(toolBar("actionsToolBar")->isVisible());
700
693
 
701
694
    KConfigGroup cfg(krConfig, "Startup");
702
695
    if (enforce) {
703
696
        // now, hide what need to be hidden
704
 
        if (!cfg.readEntry("Show tool bar", _ShowToolBar)) {
705
 
            toolBar() ->hide();
706
 
            KrActions::actShowToolBar->setChecked(false);
707
 
        } else {
708
 
            toolBar() ->show();
709
 
            KrActions::actShowToolBar->setChecked(true);
710
 
        }
 
697
        toolBar()->setVisible(cfg.readEntry("Show tool bar", _ShowToolBar));
 
698
        toolBar("actionsToolBar")->setVisible(cfg.readEntry("Show actions tool bar", _ShowActionsToolBar));
711
699
        if (!cfg.readEntry("Show status bar", _ShowStatusBar)) {
712
700
            statusBar() ->hide();
713
701
            KrActions::actShowStatusBar->setChecked(false);
873
861
 
874
862
void Krusader::openUrl(QString url)
875
863
{
 
864
    _urlToOpen = url;
 
865
    _openUrlTimer.start(0);
 
866
}
 
867
 
 
868
void Krusader::doOpenUrl()
 
869
{
 
870
    QString url = _urlToOpen;
 
871
    _urlToOpen.clear();
876
872
    int tab = ACTIVE_MNG->findTab(url);
877
873
    if(tab >= 0)
878
874
        ACTIVE_MNG->setActiveTab(tab);
879
 
    else if((tab = OTHER_MNG->findTab(url)) >= 0)
 
875
    else if((tab = OTHER_MNG->findTab(url)) >= 0) {
880
876
        OTHER_MNG->setActiveTab(tab);
881
 
    else
 
877
        OTHER_MNG->currentPanel()->view->widget()->setFocus();
 
878
    } else
882
879
        ACTIVE_MNG->slotNewTab(url);
883
880
}
884
881