46
60
#include <qprinter.h>
47
61
#include <qprogressdialog.h>
48
62
#include <qvaluelist.h>
63
#include <qwhatsthis.h>
49
64
// Krusader includes
50
65
#include "krusader.h"
51
67
#include "VFS/krpermhandler.h"
52
#include "BookMan/bookman.h"
53
68
#include "GUI/krusaderstatus.h"
54
69
#include "RemoteMan/remoteman.h"
55
70
#include "Dialogs/krpleasewait.h"
56
71
#include "krusaderview.h"
57
#include "Panel/kvfspanel.h"
72
#include "Panel/listpanel.h"
73
#include "Panel/panelfunc.h"
58
74
#include "Konfigurator/konfigurator.h"
75
#include "Konfigurator/kgprotocols.h"
59
76
#include "MountMan/kmountman.h"
77
#include "Panel/panelpopup.h"
60
78
#include "defaults.h"
61
79
#include "resources.h"
62
80
#include "GUI/kfnkeys.h"
63
81
#include "GUI/kcmdline.h"
64
82
#include "krslots.h"
83
#include "krservices.h"
84
#include "UserAction/useraction.h"
85
#include "UserAction/expander.h"
86
#include "UserMenu/usermenu.h"
87
#include "panelmanager.h"
88
#include "MountMan/kmountman.h"
89
#include "BookMan/krbookmarkhandler.h"
66
91
// define the static members
67
Krusader *Krusader::App=0;
68
KAction *Krusader::actProperties=0; KAction *Krusader::actPack=0;
69
KAction *Krusader::actUnpack=0; KAction *Krusader::actTest=0;
70
KAction *Krusader::actCompare=0; KAction *Krusader::actCalculate=0;
71
KAction *Krusader::actSelect=0; KAction *Krusader::actSelectAll=0;
72
KAction *Krusader::actUnselect=0; KAction *Krusader::actUnselectAll=0;
73
KAction *Krusader::actInvert=0; KAction *Krusader::actSysInfo=0;
74
KAction *Krusader::actSync=0; KAction *Krusader::actHomeTerminal=0;
75
KAction *Krusader::actFTPConnect=0; KAction *Krusader::actFTPNewConnect=0;
76
KAction *Krusader::actFTPDisconnect=0; KAction *Krusader::actFullPanel=0;
77
KAction *Krusader::actTreePanel=0; KAction *Krusader::actQuickPanel=0;
78
KAction *Krusader::actAllFilter=0; KAction *Krusader::actExecFilter=0;
79
KAction *Krusader::actCustomFilter=0; KAction *Krusader::actMountMan=0;
80
KAction *Krusader::actBookMan=0; KAction *Krusader::actNewTool=0;
81
KAction *Krusader::actKonfigurator=0; KAction *Krusader::actToolsSetup=0;
82
KAction *Krusader::actBack=0; KAction *Krusader::actRoot=0;
83
KAction *Krusader::actFind=0; KAction *Krusader::actAddBookmark=0;
84
KAction *Krusader::actSavePosition=0; KAction *Krusader::actSelectColorMask=0;
85
KToggleAction *Krusader::actToggleTerminal=0;
92
Krusader *Krusader::App = 0;
93
KAction *Krusader::actProperties = 0;
94
KAction *Krusader::actPack = 0;
95
KAction *Krusader::actUnpack = 0;
96
KAction *Krusader::actTest = 0;
97
KAction *Krusader::actCompare = 0;
98
KAction *Krusader::actCalculate = 0;
99
KAction *Krusader::actSelect = 0;
100
KAction *Krusader::actSelectAll = 0;
101
KAction *Krusader::actUnselect = 0;
102
KAction *Krusader::actUnselectAll = 0;
103
KAction *Krusader::actInvert = 0;
104
KAction *Krusader::actCompDirs = 0;
105
KAction *Krusader::actSync = 0;
106
KAction *Krusader::actDiskUsage = 0;
107
KAction *Krusader::actHomeTerminal = 0;
108
KAction *Krusader::actFTPConnect = 0;
109
KAction *Krusader::actFTPNewConnect = 0;
110
KAction *Krusader::actFTPDisconnect = 0;
111
KAction *Krusader::actProfiles = 0;
112
KAction *Krusader::actMultiRename = 0;
113
KAction *Krusader::actAllFilter = 0;
114
KAction *Krusader::actExecFilter = 0;
115
KAction *Krusader::actCustomFilter = 0;
116
KAction *Krusader::actMountMan = 0;
117
KAction *Krusader::actNewTool = 0;
118
KAction *Krusader::actKonfigurator = 0;
119
KAction *Krusader::actToolsSetup = 0;
120
KAction *Krusader::actSwapPanels = 0;
121
KAction *Krusader::actBack = 0;
122
KAction *Krusader::actRoot = 0;
123
KAction *Krusader::actFind = 0;
124
KAction *Krusader::actLocate = 0;
125
//KAction *Krusader::actAddBookmark = 0;
126
KAction *Krusader::actSavePosition = 0;
127
KAction *Krusader::actSelectColorMask = 0;
128
KAction *Krusader::actOpenLeftBm = 0;
129
KAction *Krusader::actOpenRightBm = 0;
130
KAction *Krusader::actDirUp = 0;
131
KAction *Krusader::actCmdlinePopup = 0;
132
KAction *Krusader::actNewTab = 0;
133
KAction *Krusader::actDupTab = 0;
134
KAction *Krusader::actCloseTab = 0;
135
KAction *Krusader::actNextTab = 0;
136
KAction *Krusader::actPreviousTab = 0;
137
KAction *Krusader::actSplit = 0;
138
KAction *Krusader::actCombine = 0;
139
KAction *Krusader::actUserMenu = 0;
140
KAction *Krusader::actSyncDirs = 0;
141
KAction *Krusader::actF2 = 0;
142
KAction *Krusader::actF3 = 0;
143
KAction *Krusader::actF4 = 0;
144
KAction *Krusader::actF5 = 0;
145
KAction *Krusader::actF6 = 0;
146
KAction *Krusader::actF7 = 0;
147
KAction *Krusader::actF8 = 0;
148
KAction *Krusader::actF9 = 0;
149
KAction *Krusader::actF10 = 0;
150
KToggleAction *Krusader::actToggleTerminal = 0;
151
KRadioAction *Krusader::actMarkNewerAndSingle = 0;
152
KRadioAction *Krusader::actMarkSingle = 0;
153
KRadioAction *Krusader::actMarkNewer = 0;
154
KRadioAction *Krusader::actMarkDifferentAndSingle = 0;
155
KRadioAction *Krusader::actMarkDifferent = 0;
156
KRadioAction **Krusader::compareArray[] = {&actMarkNewerAndSingle, &actMarkNewer, &actMarkSingle,
157
&actMarkDifferentAndSingle, &actMarkDifferent, 0};
158
UserAction *Krusader::userAction = 0;
159
Expander *Krusader::expander = 0;
160
UserMenu *Krusader::userMenu = 0;
161
KrBookmarkHandler *Krusader::bookman = 0;
88
163
// construct the views, statusbar and menu bars and prepare Krusader to start
89
Krusader::Krusader() : KParts::MainWindow() {
90
// create the "krusader"
93
setXMLFile("krusaderui.rc"); // kpart-related xml file
95
plzWait = new KRPleaseWaitHandler();
97
bool runKonfig=versionControl();
100
switch (config->getConfigState()) {
101
case KConfigBase::NoAccess :
102
message="Krusader's configuration file can't be found.\nDefault values will be used.";
104
case KConfigBase::ReadOnly :
105
message="Krusader's configuration file is in READ ONLY mode (why is that !?)\nChanged values will not be saved";
107
case KConfigBase::ReadWrite :
112
KMessageBox::error(krApp,message);
115
// register with the dcop server
116
DCOPClient* client = KApplication::kApplication()->dcopClient();
117
if ( !client->attach() ) exit(0);
118
client->registerAs( KApplication::kApplication()->name() );
120
// create an icon loader
121
iconLoader = KGlobal::iconLoader();
124
bookMan = new BookMan();
127
mountMan = new MountMan::KMountMan();
129
// setup all the krusader's actions
132
// init the permmision handler class
133
KRpermHandler::init();
135
// create the main view and set it
136
mainView=new KrusaderView(this);
138
// setup keyboard accelerators
141
// create a status bar
142
status=new KrusaderStatus(this);
144
// This enables Krusader to minimize to tray if needed
145
KSystemTray *st=new KSystemTray(this);
146
st->setPixmap(iconLoader->loadIcon("krusader",KIcon::Panel));
148
disableFutureItems();
150
setCentralWidget(mainView);
151
config->setGroup("Look&Feel");
152
if (krConfig->readBoolEntry("Minimize To Tray",_MinimizeToTray))
153
st->show(); else show();
155
setCursor(KCursor::arrowCursor());
156
// first, resize and move to starting point
157
config->setGroup("Private");
158
move(krConfig->readPointEntry("Start Position",_StartPosition));
159
resize(krConfig->readSizeEntry("Start Size",_StartSize));
161
// let the good times rool :)
163
if (runKonfig) slot->runKonfigurator(true);
165
// refresh the right and left panels
166
mainView->left->refresh();
167
mainView->right->refresh();
164
Krusader::Krusader() : KParts::MainWindow(), sysTray( 0 ), isStarting( true ) {
165
// parse command line arguments
166
KCmdLineArgs * args = KCmdLineArgs::parsedArgs();
167
QString leftPath, rightPath, startProfile;
169
// get command-line arguments
170
if ( args->isSet( "left" ) ) {
171
leftPath = args->getOption( "left" );
172
// make sure left or right are not relative paths
173
if ( !leftPath.startsWith( "/" ) && leftPath.find( ":/" ) < 0 ) // make sure we don't touch things like ftp://
174
leftPath = QDir::currentDirPath() + "/" + leftPath;
175
} else leftPath = QString::null;
176
if ( args->isSet( "right" ) ) {
177
rightPath = args->getOption( "right" );
178
// make sure left or right are not relative paths
179
if ( !rightPath.startsWith( "/" ) && rightPath.find( ":/" ) < 0 ) // make sure we don't touch things like ftp://
180
rightPath = QDir::currentDirPath() + "/" + rightPath;
181
} else rightPath = QString::null;
182
if ( args->isSet( "profile" ) ) {
183
startProfile = args->getOption( "profile" );
184
} else startProfile = QString::null;
186
// create the "krusader"
188
slot = new KRslots();
189
setXMLFile( "krusaderui.rc" ); // kpart-related xml file
191
plzWait = new KRPleaseWaitHandler();
193
bool runKonfig = versionControl();
196
switch ( config->getConfigState() ) {
197
case KConfigBase::NoAccess :
198
message = "Krusader's configuration file can't be found. Default values will be used.";
200
case KConfigBase::ReadOnly :
201
message = "Krusader's configuration file is in READ ONLY mode (why is that!?) Changed values will not be saved";
203
case KConfigBase::ReadWrite :
207
if ( message != "" ) {
208
KMessageBox::error( krApp, message );
212
// register with the dcop server
213
DCOPClient* client = KApplication::kApplication() ->dcopClient();
214
if ( !client->attach() )
216
client->registerAs( KApplication::kApplication() ->name() );
218
// create an icon loader
219
iconLoader = KGlobal::iconLoader();
222
mountMan = new KMountMan();
225
bookman = new KrBookmarkHandler();
227
// create the main view
228
mainView = new KrusaderView( this );
230
// setup all the krusader's actions
233
// init the permmision handler class
234
KRpermHandler::init();
236
// init the protocol handler
239
// starting the panels
240
mainView->start( leftPath, rightPath );
244
KConfigGroupSaver grp( krConfig, "Startup" );
245
QStringList l1( krConfig->readPathListEntry( "Left Tab Bar" ) );
246
QStringList l2( krConfig->readPathListEntry( "Right Tab Bar" ) );
247
QStringList::const_iterator it;
249
if ( krConfig->readEntry( "Left Panel Origin" ) == i18n( "the last place it was" ) )
250
for ( it = ++(l1.begin()); it != l1.end(); ++it )
251
mainView->leftMng->slotNewTab( *it );
253
krConfig->setGroup( "Startup" );
254
if ( krConfig->readEntry( "Right Panel Origin" ) == i18n( "the last place it was" ) )
255
for ( it = ++(l2.begin()); it != l2.end(); ++it )
256
mainView->rightMng->slotNewTab( *it );
258
krConfig->setGroup( "Startup" );
259
mainView->leftMng->setActiveTab( krConfig->readNumEntry( "Left Active Tab", 0 ) );
260
krConfig->setGroup( "Startup" );
261
mainView->rightMng->setActiveTab( krConfig->readNumEntry( "Right Active Tab", 0 ) );
264
// create the user menu
265
userMenu = new UserMenu( this );
268
// setup keyboard accelerators
271
// create a status bar
272
status = new KrusaderStatus( this );
273
QWhatsThis::add( status, i18n( "Status bar will show basic informations "
274
"about file below mouse pointer." ) );
276
// This enables Krusader to show a tray icon
277
sysTray = new KSystemTray( this );
278
sysTray->setPixmap( iconLoader->loadIcon( "krusader", KIcon::Panel, 22 ) );
281
setCentralWidget( mainView );
282
config->setGroup( "Look&Feel" );
284
// manage our keyboard short-cuts
285
//KAcceleratorManager::manage(this,true);
287
setCursor( KCursor::arrowCursor() );
288
// first, resize and move to starting point
289
config->setGroup( "Private" );
290
move( oldPos = krConfig->readPointEntry( "Start Position", _StartPosition ) );
291
resize( oldSize = krConfig->readSizeEntry( "Start Size", _StartSize ) );
293
if ( ! startProfile.isEmpty() )
294
mainView->profiles( startProfile );
296
if ( krConfig->readBoolEntry( "Maximized" ) )
301
// let the good times rool :)
304
slot->runKonfigurator( true );
170
Krusader::~Krusader(){}
309
Krusader::~Krusader() {}
172
311
bool Krusader::versionControl() {
174
// create config file
175
config=kapp->config();
176
QString oldVerText = config->readEntry("Version","100");
177
oldVerText.truncate(oldVerText.find("-"));
178
float oldVer = oldVerText.toFloat();
180
kdDebug() << QString("version = %1").arg(oldVer) << endl;
182
// older icompatible version
183
if ( oldVer < (9/10) ){
184
KMessageBox::information(krApp,i18n("A configuration older then v0.90,\nwas detected Krusader has to reset your\nconfiguration to default values.\nKrusader will now run Konfigurator."));
185
if (!QDir::home().remove(".kde/share/config/krusaderrc")) {
186
KMessageBox::error(krApp,i18n("Unable to remove your krusaderrc file !\nPlease remove it manually and rerun Krusader."));
190
config->reparseConfiguration();
192
// first installation of krusader
193
if ( oldVer == 100 ){
194
KMessageBox::information(krApp,i18n("Welcome to Krusader,\nas this is your first run,\nKrusader will now run Konfigurator."));
197
config->writeEntry("Version",VERSION);
202
void Krusader::statusBarUpdate(QString mess) {
203
// change the message on the statusbar for 2 seconds
204
statusBar()->message(mess,5000);
207
void Krusader::disableFutureItems() {
208
//krCompare->setEnabled(false);
209
//krSyncDirs->setEnabled(false);
210
//krNewTool->setEnabled(false);
211
//krToolsSetup->setEnabled(false);
212
//actionCollection()->action("std_print")->setEnabled(false);
313
// create config file
314
config = kapp->config();
315
QString oldVerText = config->readEntry( "Version", "200" );
316
oldVerText.truncate( oldVerText.find( "-" ) );
317
float oldVer = oldVerText.toFloat();
319
//kdDebug() << QString( "version = %1" ).arg( oldVer ) << endl;
321
// older icompatible version
322
if ( oldVer < ( 9 / 10 ) ) {
323
KMessageBox::information( krApp, i18n( "A configuration older then v0.90 was detected Krusader has to reset your configuration to default values. Krusader will now run Konfigurator." ) );
324
if ( !QDir::home().remove( ".kde/share/config/krusaderrc" ) ) {
325
KMessageBox::error( krApp, i18n( "Unable to remove your krusaderrc file! Please remove it manually and rerun Krusader." ) );
329
config->reparseConfiguration();
331
// first installation of krusader
332
if ( oldVer == 100 ) {
333
KMessageBox::information( krApp, i18n( "Welcome to Krusader, as this is your first run, Krusader will now run Konfigurator." ) );
336
config->writeEntry( "Version", VERSION );
341
void Krusader::statusBarUpdate( QString& mess ) {
342
// change the message on the statusbar for 2 seconds
343
statusBar() ->message( mess, 5000 );
346
void Krusader::showEvent ( QShowEvent * ) {
348
show(); // needed to make sure krusader is removed from
349
// the taskbar when minimizing (system tray issue)
352
void Krusader::hideEvent ( QHideEvent *e ) {
353
QString lastGroup = config->group();
354
config->setGroup( "Look&Feel" );
355
bool showTrayIcon = krConfig->readBoolEntry( "Minimize To Tray", _MinimizeToTray );
356
config->setGroup ( lastGroup );
358
bool isModalTopWidget = false;
360
QWidget *actWnd = qApp->activeWindow();
362
isModalTopWidget = actWnd->isModal();
364
if ( showTrayIcon && !isModalTopWidget && KWin::windowInfo( winId() ).isMinimized() ) {
366
hide(); // needed to make sure krusader is removed from
367
// the taskbar when minimizing (system tray issue)
368
} else KParts::MainWindow::hideEvent( e );
371
void Krusader::moveEvent ( QMoveEvent *e ) {
372
oldPos = e->oldPos();
373
KParts::MainWindow::moveEvent( e );
376
void Krusader::resizeEvent ( QResizeEvent *e ) {
377
oldSize = e->oldSize();
378
KParts::MainWindow::resizeEvent( e );
215
381
void Krusader::setupAccels() {
216
accels = new KAccel(this);
218
accels->insertItem("F2 Terminal", "F2_terminal", Key_F2,false);
219
accels->connectItem("F2_terminal",SLOTS, SLOT(terminal()));
221
accels->insertItem("F3 View", "F3_view", Key_F3,false);
222
accels->connectItem("F3_view",SLOTS, SLOT(view()));
224
accels->insertItem("F4 Edit", "F4_edit", Key_F4,false);
225
accels->connectItem("F4_edit",SLOTS, SLOT(edit()));
227
accels->insertItem("F5-Copy", "F5_copy", Key_F5,false);
228
accels->connectItem("F5_copy",SLOTS, SLOT(copyFiles()));
230
accels->insertItem("F6-Move", "F6_move", Key_F6,false);
231
accels->connectItem("F6_move",SLOTS, SLOT(moveFiles()));
233
accels->insertItem("F7-Mkdir", "F7_mkdir", Key_F7,false);
234
accels->connectItem("F7_mkdir",SLOTS, SLOT(mkdir()));
236
accels->insertItem("F8-Delete", "F8_delete", Key_F8,false);
237
accels->connectItem("F8_delete",SLOTS, SLOT(deleteFiles()));
239
accels->insertItem("F9-Rename", "F9_rename", Key_F9,false);
240
accels->connectItem("F9_rename",SLOTS, SLOT(rename()));
242
accels->insertItem("F10-Quit", "F10_quit", Key_F10,false);
243
accels->connectItem("F10_quit",this, SLOT(quitKrusader()));
245
accels->insertItem("Tab-Switch panel", "tab_switch_panel", Key_Tab,false);
246
accels->connectItem("tab_switch_panel", mainView, SLOT(panelSwitch()));
382
accels = new KAccel( this );
384
accels->insert( "F3_ViewDlg", i18n( "F3 View Dialog" ), QString::null,
385
SHIFT + Key_F3, SLOTS, SLOT( viewDlg() ) );
388
accels->insert( "F2_Terminal", i18n( "F2 Terminal" ), QString::null,
389
Key_F2, SLOTS, SLOT( terminal() ) );
391
accels->insert( "F3_View", i18n( "F3 View" ), QString::null,
392
Key_F3, SLOTS, SLOT( view() ) );
394
accels->insert( "F3_ViewDlg", i18n( "F3 View Dialog" ), QString::null,
395
SHIFT + Key_F3, SLOTS, SLOT( viewDlg() ) );
397
accels->insert( "F4_Edit", i18n( "F4 Edit" ), QString::null,
398
Key_F4, SLOTS, SLOT( edit() ) );
400
accels->insert( "F5_Copy", i18n( "F5 Copy" ), QString::null,
401
Key_F5, SLOTS, SLOT( copyFiles() ) );
403
accels->insert( "F6_Move", i18n( "F6 Move" ), QString::null,
404
Key_F6, SLOTS, SLOT( moveFiles() ) );
406
accels->insert( "F7_Mkdir", i18n( "F7 Mkdir" ), QString::null,
407
Key_F7, SLOTS, SLOT( mkdir() ) );
409
accels->insert( "F8_Delete", i18n( "F8 Delete" ), QString::null,
410
Key_F8, SLOTS, SLOT( deleteFiles() ) );
412
accels->insert( "F9_Rename", i18n( "F9 Rename" ), QString::null,
413
Key_F9, SLOTS, SLOT( rename() ) );
415
accels->insert( "F10_Quit", i18n( "F10 Quit" ), QString::null,
416
Key_F10, this, SLOT( quitKrusader() ) );
419
accels->insert( "Tab-Switch panel", i18n( "Tab: switch panel" ), QString::null,
420
Key_Tab, mainView, SLOT( panelSwitch() ) );
250
424
// <patch> Moving from Pixmap actions to generic filenames - thanks to Carsten Pfeiffer
251
425
void Krusader::setupActions() {
252
// first come the TODO actions
253
//actSync = 0;//new KAction(i18n("S&yncronize Dirs"), 0, this, 0, actionCollection(), "sync dirs");
254
//actNewTool = 0;//new KAction(i18n("&Add a new tool"), 0, this, 0, actionCollection(), "add tool");
255
//actToolsSetup = 0;//new KAction(i18n("&Tools Menu Setup"), 0, 0, this, 0, actionCollection(), "tools setup");
256
//KStdAction::print(SLOTS, 0,actionCollection(),"std_print");
259
// second, the KDE standard action
260
KStdAction::up(SLOTS,SLOT(dirUp()),actionCollection(),"std_up");
261
KStdAction::home(SLOTS,SLOT(home()),actionCollection(),"std_home");
262
KStdAction::redisplay(SLOTS,SLOT(refresh()),actionCollection(),"std_redisplay");
263
actShowToolBar = KStdAction::showToolbar(SLOTS, SLOT(toggleToolbar()),actionCollection(),"std_toolbar");
264
actShowStatusBar = KStdAction::showStatusbar(SLOTS, SLOT(toggleStatusbar()),actionCollection(),"std_statusbar");
265
KStdAction::quit(this, SLOT(quitKrusader()),actionCollection(),"std_quit");
266
KStdAction::configureToolbars(SLOTS,SLOT(configToolbar()),actionCollection(),"std_config_toolbar");
267
KStdAction::keyBindings(SLOTS,SLOT(configKeys()),actionCollection(),"std_config_keys");
269
// the toggle actions
270
actCompareDirs = new KToggleAction(i18n("Compare Mode"), "kr_comparedirs",
271
CTRL+Key_Equal, SLOTS, SLOT(compareDirectories()), actionCollection(), "compare mode");
272
actCompareDirs->setChecked(false);
273
actToggleFnkeys = new KToggleAction(i18n("Show &FN Keys Bar"),0,SLOTS,
274
SLOT(toggleFnkeys()),actionCollection(),"toggle fn bar");
275
actToggleFnkeys->setChecked(true);
276
actToggleCmdline = new KToggleAction(i18n("Show &Command Line"),0,SLOTS,
277
SLOT(toggleCmdline()),actionCollection(),"toggle command line");
278
actToggleCmdline->setChecked(true);
279
actToggleTerminal = new KToggleAction(i18n("Show &Terminal Emulator"),0,SLOTS,
280
SLOT(toggleTerminal()),actionCollection(),"toggle terminal emulator");
281
actToggleTerminal->setChecked(false);
282
actToggleHidden = new KToggleAction(i18n("Show H&idden Files"),0,SLOTS,
283
SLOT(toggleHidden()),actionCollection(),"toggle hidden files");
284
actToggleSortByExt = new KToggleAction(i18n("Sort By E&xtention"),0,SLOTS,
285
SLOT(toggleSortByExt()),actionCollection(),"toggle sort by extention");
286
krConfig->setGroup("Look&Feel");
287
actToggleHidden->setChecked(krConfig->readBoolEntry("Show Hidden",_ShowHidden));
288
actToggleSortByExt->setChecked(krConfig->readBoolEntry("Sort By Extention",_SortByExt));
290
// and then the DONE actions
291
actSelectColorMask =new KAction(i18n("Configure compare-mode"), 0,
292
SLOTS, SLOT(selectCompareMask()), actionCollection(), "select colormask");
293
actTest = new KAction(i18n("Test Archi&ve(s)"), "kr_arc_test", CTRL+Key_T,
294
SLOTS, SLOT(testArchive()), actionCollection(), "test archives");
295
actFTPConnect = new KAction(i18n("&FTP Connect"), "kr_ftp_connect", CTRL+Key_F,
296
SLOTS, SLOT(runRemoteMan()), actionCollection(), "ftp connect");
297
actFTPNewConnect = new KAction(i18n("FT&P New Connection"), "kr_ftp_new", CTRL+Key_N,
298
SLOTS, SLOT(newFTPconnection()), actionCollection(), "ftp new connection");
299
actCalculate = new KAction(i18n("Calculate &Occupied Space"), "kr_calc", 0,
300
SLOTS, SLOT(calcSpace()), actionCollection(), "calculate");
301
actProperties = new KAction(i18n("&Properties"), "kr_properties", 0,
302
SLOTS, SLOT(properties()), actionCollection(),"properties");
303
actPack = new KAction(i18n("Pac&k"), "kr_arc_pack", CTRL+Key_P,
304
SLOTS, SLOT(slotPack()), actionCollection(), "pack");
305
actUnpack = new KAction(i18n("&Unpack"), "kr_arc_unpack", CTRL+Key_U,
306
SLOTS, SLOT(slotUnpack()), actionCollection() , "unpack");
307
actSelect = new KAction(i18n("Select &Group"), "kr_select", CTRL+Key_Plus,
308
SLOTS, SLOT(markGroup()), actionCollection(), "select group");
309
actSelectAll = new KAction(i18n("&Select All"), "kr_selectall", ALT+Key_Plus,
310
SLOTS, SLOT(markAll()), actionCollection(), "select all");
311
actUnselectAll = new KAction(i18n("U&nselect All"), "kr_unselectall", ALT+Key_Minus,
312
SLOTS, SLOT(unmarkAll()), actionCollection(), "unselect all");
313
actHomeTerminal = new KAction(i18n("&Terminal"), "kr_terminal", 0,
314
SLOTS, SLOT(homeTerminal()), actionCollection(), "terminal@home");
315
actFTPDisconnect = new KAction(i18n("FTP Disc&onnect"), "kr_ftp_disconnect", SHIFT+CTRL+Key_F,
316
SLOTS, SLOT(FTPDisconnect()), actionCollection(), "ftp disconnect");
317
actFullPanel = new KAction(i18n("&Full Panel"), "kr_fullview", ALT+Key_1,
318
SLOTS, SLOT(setListView()), actionCollection(), "full panel");
319
actTreePanel = new KAction(i18n("&Tree Panel"), "kr_treeview", ALT+Key_2,
320
SLOTS, SLOT(setTreeView()), actionCollection(), "tree panel");
321
actMountMan = new KAction(i18n("&MountMan"), "kr_mountman", ALT+Key_Slash,
322
SLOTS, SLOT(runMountMan()), actionCollection(), "mountman");
323
actBookMan = new KAction(i18n("&BookMan"), "kr_bookman", 0,
324
krBookMan,SLOT(showGUI()), actionCollection(), "bookman");
325
actFind = new KAction(i18n("&Search"), "filefind", CTRL+Key_S,
326
SLOTS, SLOT(search()), actionCollection(), "find");
327
actInvert = new KAction(i18n("&Invert Selection"),"kr_invert", ALT+Key_Asterisk,
328
SLOTS, SLOT(invert()), actionCollection(), "invert");
329
actUnselect = new KAction(i18n("&Unselect &Group"), "kr_unselect", CTRL+Key_Minus,
330
SLOTS, SLOT(unmarkGroup()), actionCollection(), "unselect group");
331
actAddBookmark = new KAction(i18n("Add Bookmark"), "kr_addbookmark", CTRL+Key_B,
332
SLOTS, SLOT(addBookmark()), actionCollection(), "add bookmark");
333
actKonfigurator = new KAction(i18n("&Konfigurator"), "configure", 0,
334
SLOTS, SLOT(runKonfigurator()), actionCollection(), "konfigurator");
335
actBack = new KAction(i18n("Back"), "back", 0,
336
SLOTS, SLOT(back()), actionCollection(), "back");
337
actRoot = new KAction(i18n("Root"), "top", CTRL+Key_Backspace,
338
SLOTS, SLOT(root()), actionCollection(), "root");
339
actSysInfo = new KAction(i18n("&Device Manager"), "kr_hwinfo", 0,
340
SLOTS, SLOT(sysInfo()), actionCollection(), "sysinfo");
341
actSavePosition = new KAction(i18n("Save &Position"), 0,
342
krApp, SLOT(savePosition()), actionCollection(), "save position");
343
actAllFilter = new KAction(i18n("&All Files"), SHIFT+Key_F10,
344
SLOTS, SLOT(allFilter()), actionCollection(), "all files");
345
actExecFilter = new KAction(i18n("&Executables"), SHIFT+Key_F11,
346
SLOTS, SLOT(execFilter()), actionCollection(), "exec files");
347
actCustomFilter=new KAction(i18n("&Custom"), SHIFT+Key_F12,
348
SLOTS, SLOT(customFilter()), actionCollection(), "custom files");
349
actQuickPanel = new KAction(i18n("&Quickview Panel"), ALT+Key_3,
350
SLOTS, SLOT(setQuickView()), actionCollection(), "quickview panel");
351
actCompare = new KAction(i18n("Compare b&y content"), "kr_compare",
352
0, SLOTS, SLOT(compareContent()), actionCollection(), "compare");
353
new KAction(i18n("Right-click menu"), Key_Menu,
354
SLOTS, SLOT(rightclickMenu()), actionCollection(), "rightclick menu");
356
// and at last we can set the tool-tips
357
actSelect->setToolTip(i18n("Highlight files by using a filter"));
358
actSelectAll->setToolTip(i18n("Highlight all the files in the current directory"));
359
actUnselectAll->setToolTip(i18n("Remove selection from all highlight files"));
360
actMountMan->setToolTip(i18n("Mount.Man: Krusader's mount-manager. Try it!"));
361
actKonfigurator->setToolTip(i18n("Setup Krusader the way you like it"));
362
actBack->setToolTip(i18n("Back to the place you came from"));
363
actRoot->setToolTip(i18n("ROOT (/)"));
364
actFind->setToolTip(i18n("Search for files"));
365
actAddBookmark->setToolTip(i18n("Add the current path to your bookmarks"));
426
// first come the TODO actions
427
//actSync = 0;//new KAction(i18n("S&yncronize Dirs"), 0, this, 0, actionCollection(), "sync dirs");
428
//actNewTool = 0;//new KAction(i18n("&Add a new tool"), 0, this, 0, actionCollection(), "add tool");
429
//actToolsSetup = 0;//new KAction(i18n("&Tools Menu Setup"), 0, 0, this, 0, actionCollection(), "tools setup");
430
//KStdAction::print(SLOTS, 0,actionCollection(),"std_print");
433
// second, the KDE standard action
434
//KStdAction::up( SLOTS, SLOT( dirUp() ), actionCollection(), "std_up" )->setShortcut(Key_Backspace);
435
/* Shortcut disabled because of the Terminal Emulator bug. */
436
krConfig->setGroup( "Private" );
437
int compareMode = krConfig->readNumEntry( "Compare Mode", 0 );
439
KStdAction::home( SLOTS, SLOT( home() ), actionCollection(), "std_home" ); /*->setShortcut(Key_QuoteLeft);*/
440
KAction *actRedisplay = KStdAction::redisplay( SLOTS, SLOT( refresh() ), actionCollection(), "std_redisplay" );
441
actRedisplay->setText( "Reload" );
442
actRedisplay->setShortcut( CTRL + Key_R );
443
actShowToolBar = KStdAction::showToolbar( SLOTS, SLOT( toggleToolbar() ), actionCollection(), "std_toolbar" );
444
actShowStatusBar = KStdAction::showStatusbar( SLOTS, SLOT( toggleStatusbar() ), actionCollection(), "std_statusbar" );
445
KStdAction::quit( this, SLOT( quitKrusader() ), actionCollection(), "std_quit" );
446
KStdAction::configureToolbars( SLOTS, SLOT( configToolbar() ), actionCollection(), "std_config_toolbar" );
447
KStdAction::keyBindings( SLOTS, SLOT( configKeys() ), actionCollection(), "std_config_keys" );
449
KStdAction::cut( SLOTS, SLOT( cut() ), actionCollection(), "std_cut" );
450
KStdAction::copy( SLOTS, SLOT( copy() ), actionCollection(), "std_copy" );
451
KStdAction::paste( SLOTS, SLOT( paste() ), actionCollection(), "std_paste" );
453
// the toggle actions
454
actToggleFnkeys = new KToggleAction( i18n( "Show &FN Keys Bar" ), 0, SLOTS,
455
SLOT( toggleFnkeys() ), actionCollection(), "toggle fn bar" );
456
actToggleFnkeys->setChecked( true );
457
actToggleCmdline = new KToggleAction( i18n( "Show &Command Line" ), 0, SLOTS,
458
SLOT( toggleCmdline() ), actionCollection(), "toggle command line" );
459
actToggleCmdline->setChecked( true );
460
actToggleTerminal = new KToggleAction( i18n( "Show Terminal &Emulator" ), 0, SLOTS,
461
SLOT( toggleTerminal() ), actionCollection(), "toggle terminal emulator" );
462
actToggleTerminal->setChecked( false );
463
actToggleHidden = new KToggleAction( i18n( "Show &Hidden Files" ), CTRL + Key_Period, SLOTS,
464
SLOT( toggleHidden() ), actionCollection(), "toggle hidden files" );
465
actSwapPanels = new KAction( i18n( "S&wap Panels" ), CTRL + Key_U, SLOTS,
466
SLOT( toggleSwapPanels() ), actionCollection(), "toggle swap panels" );
467
krConfig->setGroup( "Look&Feel" );
468
actToggleHidden->setChecked( krConfig->readBoolEntry( "Show Hidden", _ShowHidden ) );
470
// and then the DONE actions
471
actCmdlinePopup = new KAction( i18n( "popup cmdline" ), 0, CTRL + Key_Slash, SLOTS,
472
SLOT( cmdlinePopup() ), actionCollection(), "cmdline popup" );
473
/* Shortcut disabled because of the Terminal Emulator bug. */
474
actDirUp = new KAction( i18n( "Up one directory" ), "up", CTRL+Key_PageUp /*Key_Backspace*/, SLOTS, SLOT( dirUp() ), actionCollection(), "dirUp" );
475
new KAction( i18n( "&Edit new file" ), "filenew", SHIFT + Key_F4, SLOTS, SLOT( editDlg() ), actionCollection(), "edit_new_file" );
476
new KAction( i18n( "Start &Root Mode Krusader" ), "krusader_red", ALT + Key_K, SLOTS, SLOT( rootKrusader() ), actionCollection(), "root krusader" );
478
actTest = new KAction( i18n( "T&est Archive(s)" ), "ark", ALT + Key_E,
479
SLOTS, SLOT( testArchive() ), actionCollection(), "test archives" );
480
actFTPConnect = new KAction( i18n( "&Net Connections" ), "domtreeviewer", 0,
481
SLOTS, SLOT( runRemoteMan() ), actionCollection(), "ftp connect" );
482
actFTPNewConnect = new KAction( i18n( "New Net &Connection" ), "connect_creating", CTRL + Key_N,
483
SLOTS, SLOT( newFTPconnection() ), actionCollection(), "ftp new connection" );
484
actProfiles = new KAction( i18n( "Pro&files" ), "kr_profile", ALT + Key_L,
485
MAIN_VIEW, SLOT( profiles() ), actionCollection(), "profile" );
486
actCalculate = new KAction( i18n( "Calculate &Occupied Space" ), "kcalc", 0,
487
SLOTS, SLOT( calcSpace() ), actionCollection(), "calculate" );
488
actProperties = new KAction( i18n( "&Properties" ), "help", 0,
489
SLOTS, SLOT( properties() ), actionCollection(), "properties" );
490
actPack = new KAction( i18n( "Pac&k" ), "kr_arc_pack", ALT + Key_P,
491
SLOTS, SLOT( slotPack() ), actionCollection(), "pack" );
492
actUnpack = new KAction( i18n( "&Unpack" ), "kr_arc_unpack", ALT + Key_U,
493
SLOTS, SLOT( slotUnpack() ), actionCollection() , "unpack" );
494
actSplit = new KAction( i18n( "Sp&lit file" ), "kr_split", CTRL + Key_P,
495
SLOTS, SLOT( slotSplit() ), actionCollection(), "split" );
496
actCombine = new KAction( i18n( "Com&bine files" ), "kr_combine", CTRL + Key_B,
497
SLOTS, SLOT( slotCombine() ), actionCollection() , "combine" );
498
actSelect = new KAction( i18n( "Select &Group" ), "kr_select", CTRL + Key_Plus,
499
SLOTS, SLOT( markGroup() ), actionCollection(), "select group" );
500
actSelectAll = new KAction( i18n( "&Select All" ), "kr_selectall", ALT + Key_Plus,
501
SLOTS, SLOT( markAll() ), actionCollection(), "select all" );
502
actUnselectAll = new KAction( i18n( "U&nselect All" ), "kr_unselectall", ALT + Key_Minus,
503
SLOTS, SLOT( unmarkAll() ), actionCollection(), "unselect all" );
504
actCompDirs = new KAction( i18n( "&Compare Directories" ), "view_left_right", 0,
505
SLOTS, SLOT( compareDirs() ), actionCollection(), "compare dirs" );
506
actMarkNewerAndSingle = new KRadioAction( i18n( "&Mark Newer And Single" ), 0,
507
SLOTS, SLOT( compareSetup() ), actionCollection(), "mark_newer_and_single" );
508
actMarkNewer = new KRadioAction( i18n( "Mark &Newer" ), 0,
509
SLOTS, SLOT( compareSetup() ), actionCollection(), "mark_newer" );
510
actMarkSingle = new KRadioAction( i18n( "Mark &Single" ), 0,
511
SLOTS, SLOT( compareSetup() ), actionCollection(), "mark_single" );
512
actMarkDifferentAndSingle = new KRadioAction( i18n( "Mark Different &And Single" ), 0,
513
SLOTS, SLOT( compareSetup() ), actionCollection(), "mark_different_and_single" );
514
actMarkDifferent = new KRadioAction( i18n( "Mark &Different" ), 0,
515
SLOTS, SLOT( compareSetup() ), actionCollection(), "mark_different" );
516
actMarkNewerAndSingle->setExclusiveGroup( "mark group" );
517
actMarkNewer->setExclusiveGroup( "mark group" );
518
actMarkSingle->setExclusiveGroup( "mark group" );
519
actMarkDifferentAndSingle->setExclusiveGroup( "mark group" );
520
actMarkDifferent->setExclusiveGroup( "mark group" );
521
if( compareMode < (int)( sizeof( compareArray ) / sizeof( KRadioAction ** ) ) -1 )
522
(*compareArray[ compareMode ])->setChecked( true );
523
actHomeTerminal = new KAction( i18n( "&Terminal" ), "konsole", 0,
524
SLOTS, SLOT( homeTerminal() ), actionCollection(), "terminal@home" );
525
actFTPDisconnect = new KAction( i18n( "Disconnect &From Net" ), "kr_ftp_disconnect", SHIFT + CTRL + Key_F,
526
SLOTS, SLOT( FTPDisconnect() ), actionCollection(), "ftp disconnect" );
527
#if KDE_IS_VERSION(3,2,0) /* new mountman feature is available in kde 3.2 only! */
528
actMountMan = new KToolBarPopupAction( i18n( "&MountMan" ), "kr_mountman", ALT + Key_Slash,
529
SLOTS, SLOT( runMountMan() ), actionCollection(), "mountman" );
530
connect( ( ( KToolBarPopupAction* ) actMountMan ) ->popupMenu(), SIGNAL( aboutToShow() ),
531
mountMan, SLOT( quickList() ) );
533
actMountMan = new KAction( i18n( "&MountMan" ), "kr_mountman", ALT + Key_Slash,
534
SLOTS, SLOT( runMountMan() ), actionCollection(), "mountman" );
537
actFind = new KAction( i18n( "&Search" ), "filefind", CTRL + Key_S,
538
SLOTS, SLOT( search() ), actionCollection(), "find" );
539
actLocate = new KAction( i18n( "&Locate" ), "find", CTRL + Key_L,
540
SLOTS, SLOT( locate() ), actionCollection(), "locate" );
541
actSyncDirs = new KAction( i18n( "Synchronize &Directories" ), "kr_syncdirs", CTRL + Key_Y,
542
SLOTS, SLOT( slotSynchronizeDirs() ), actionCollection(), "sync dirs" );
543
//actDiskUsage = new KAction( i18n( "D&isk Usage" ), "kchart", ALT + Key_D,
544
// SLOTS, SLOT( slotDiskUsage() ), actionCollection(), "disk usage" );
545
actInvert = new KAction( i18n( "&Invert Selection" ), "kr_invert", ALT + Key_Asterisk,
546
SLOTS, SLOT( invert() ), actionCollection(), "invert" );
547
actUnselect = new KAction( i18n( "&Unselect Group" ), "kr_unselect", CTRL + Key_Minus,
548
SLOTS, SLOT( unmarkGroup() ), actionCollection(), "unselect group" );
549
actKonfigurator = new KAction( i18n( "Configure &Krusader" ), "configure", 0,
550
SLOTS, SLOT( startKonfigurator() ), actionCollection(), "konfigurator" );
551
actBack = new KAction( i18n( "Back" ), "back", 0,
552
SLOTS, SLOT( back() ), actionCollection(), "back" );
553
actRoot = new KAction( i18n( "Root" ), "top", CTRL + Key_Backspace,
554
SLOTS, SLOT( root() ), actionCollection(), "root" );
555
actSavePosition = new KAction( i18n( "Save &Position" ), 0,
556
krApp, SLOT( savePosition() ), actionCollection(), "save position" );
557
actAllFilter = new KAction( i18n( "&All Files" ), SHIFT + Key_F10,
558
SLOTS, SLOT( allFilter() ), actionCollection(), "all files" );
559
//actExecFilter = new KAction( i18n( "&Executables" ), SHIFT + Key_F11,
560
// SLOTS, SLOT( execFilter() ), actionCollection(), "exec files" );
561
actCustomFilter = new KAction( i18n( "&Custom" ), SHIFT + Key_F12,
562
SLOTS, SLOT( customFilter() ), actionCollection(), "custom files" );
563
actCompare = new KAction( i18n( "Compare b&y content" ), "kmultiple", 0,
564
SLOTS, SLOT( compareContent() ), actionCollection(), "compare" );
565
actMultiRename = new KAction( i18n( "Multi &Rename" ), "krename", SHIFT + Key_F9,
566
SLOTS, SLOT( multiRename() ), actionCollection(), "multirename" );
567
new KAction( i18n( "Right-click menu" ), Key_Menu,
568
SLOTS, SLOT( rightclickMenu() ), actionCollection(), "rightclick menu" );
569
new KAction( i18n( "Right bookmarks" ), ALT + Key_Right,
570
SLOTS, SLOT( openRightBookmarks() ), actionCollection(), "right bookmarks" );
571
new KAction( i18n( "Left bookmarks" ), ALT + Key_Left,
572
SLOTS, SLOT( openLeftBookmarks() ), actionCollection(), "left bookmarks" );
573
new KAction( i18n( "Bookmarks" ), CTRL + Key_D,
574
SLOTS, SLOT( openBookmarks() ), actionCollection(), "bookmarks" );
575
new KAction( i18n( "Sync Panels" ), ALT + Key_O,
576
SLOTS, SLOT( syncPanels() ), actionCollection(), "sync panels");
577
new KAction( i18n( "Left history" ), ALT + CTRL + Key_Left,
578
SLOTS, SLOT( openLeftHistory() ), actionCollection(), "left history" );
579
new KAction( i18n( "Right history" ), ALT + CTRL + Key_Right,
580
SLOTS, SLOT( openRightHistory() ), actionCollection(), "right history" );
581
new KToggleAction( i18n( "Toggle Popup Panel" ), ALT + Key_Down, SLOTS,
582
SLOT( togglePopupPanel() ), actionCollection(), "toggle popup panel" );
583
new KToggleAction( i18n( "Vertical Mode" ), ALT + CTRL + Key_R, MAIN_VIEW,
584
SLOT( toggleVerticalMode() ), actionCollection(), "toggle vertical mode" );
585
actNewTab = new KAction( i18n( "New tab" ), ALT + CTRL + Key_N, SLOTS,
586
SLOT( newTab() ), actionCollection(), "new tab" );
587
actDupTab = new KAction( i18n( "Duplicate tab" ), ALT + CTRL + SHIFT + Key_N, SLOTS,
588
SLOT( duplicateTab() ), actionCollection(), "duplicate tab" );
589
actCloseTab = new KAction( i18n( "Close tab" ), ALT + CTRL + Key_C, SLOTS,
590
SLOT( closeTab() ), actionCollection(), "close tab" );
591
actNextTab = new KAction( i18n( "Next tab" ), SHIFT + Key_Right, SLOTS,
592
SLOT( nextTab() ), actionCollection(), "next tab" );
593
actPreviousTab = new KAction( i18n( "Previous tab" ), SHIFT + Key_Left, SLOTS,
594
SLOT( previousTab() ), actionCollection(), "previous tab" );
595
actUserMenu = new KAction( i18n( "User Menu" ), ALT + Key_QuoteLeft, SLOTS,
596
SLOT( userMenu() ), actionCollection(), "user menu" );
599
actF2 = new KAction( i18n( "F2 - Open a terminal" ), Key_F2,
600
SLOTS, SLOT( terminal() ) , actionCollection(), "F2_Terminal" );
601
actF3 = new KAction( i18n( "F3 - View a file" ), Key_F3,
602
SLOTS, SLOT( view() ) , actionCollection(), "F3_View" );
603
actF4 = new KAction( i18n( "F4 - Edit a file" ), Key_F4,
604
SLOTS, SLOT( edit() ) , actionCollection(), "F4_Edit" );
605
actF5 = new KAction( i18n( "F5 - Copy" ), Key_F5,
606
SLOTS, SLOT( copyFiles() ) , actionCollection(), "F5_Copy" );
607
actF6 = new KAction( i18n( "F6 - Move" ), Key_F6,
608
SLOTS, SLOT( moveFiles() ) , actionCollection(), "F6_Move" );
609
actF7 = new KAction( i18n( "F7 - Mkdir" ), Key_F7,
610
SLOTS, SLOT( mkdir() ) , actionCollection(), "F7_Mkdir" );
611
actF8 = new KAction( i18n( "F8 - Delete" ), Key_F8,
612
SLOTS, SLOT( deleteFiles() ) , actionCollection(), "F8_Delete" );
613
actF9 = new KAction( i18n( "F9 - Rename" ), Key_F9,
614
SLOTS, SLOT( rename() ) , actionCollection(), "F9_Rename" );
615
actF10 = new KAction( i18n( "F10 - Quit" ), Key_F10,
616
this, SLOT( quitKrusader() ) , actionCollection(), "F10_Quit" );
618
// and at last we can set the tool-tips
619
actSelect->setToolTip( i18n( "Highlight files by using a filter" ) );
620
actSelectAll->setToolTip( i18n( "Highlight all the files in the current directory" ) );
621
actUnselectAll->setToolTip( i18n( "Remove selection from all highlight files" ) );
622
actKonfigurator->setToolTip( i18n( "Setup Krusader the way you like it" ) );
623
actBack->setToolTip( i18n( "Back to the place you came from" ) );
624
actRoot->setToolTip( i18n( "ROOT (/)" ) );
625
actFind->setToolTip( i18n( "Search for files" ) );
627
// setup all UserActions
628
expander = new Expander();
629
userAction = new UserAction();
368
632
///////////////////////////////////////////////////////////////////////////
369
633
//////////////////// implementation of slots //////////////////////////////
370
634
///////////////////////////////////////////////////////////////////////////
372
void Krusader::savePosition(){
373
config->setGroup("Private");
374
config->writeEntry( "Start Position", pos() );
375
config->writeEntry( "Start Size", size() );
376
config->writeEntry( "Panel Size", mainView->vert_splitter->sizes()[0]);
377
config->writeEntry( "Terminal Size", mainView->vert_splitter->sizes()[1]);
379
config->writeEntry( "Left Name Size", mainView->left->fileList->columnWidth(0));
380
config->writeEntry( "Left Size Size", mainView->left->fileList->columnWidth(1));
381
config->writeEntry( "Left Date Size", mainView->left->fileList->columnWidth(2));
382
config->writeEntry( "Right Name Size", mainView->right->fileList->columnWidth(0));
383
config->writeEntry( "Right Size Size", mainView->right->fileList->columnWidth(1));
384
config->writeEntry( "Right Date Size", mainView->right->fileList->columnWidth(2));
385
QValueList<int> lst = mainView->horiz_splitter->sizes();
386
config->writeEntry( "Splitter Sizes", lst);
636
void Krusader::savePosition() {
637
config->setGroup( "Private" );
638
config->writeEntry( "Start Position", isMaximized() ? oldPos : pos() );
639
config->writeEntry( "Start Size", isMaximized() ? oldSize : size() );
640
config->writeEntry( "Maximized", isMaximized() );
641
config->writeEntry( "Panel Size", mainView->vert_splitter->sizes() [ 0 ] );
642
config->writeEntry( "Terminal Size", mainView->vert_splitter->sizes() [ 1 ] );
643
QValueList<int> lst = mainView->horiz_splitter->sizes();
644
config->writeEntry( "Splitter Sizes", lst );
645
// save view settings ---> fix when we have tabbed-browsing
646
mainView->left->view->saveSettings();
647
mainView->right->view->saveSettings();
391
651
void Krusader::saveSettings() {
392
toolBar()->saveSettings(krConfig,"Private");
393
config->setGroup("Startup");
394
if (config->readBoolEntry("Panels Save Settings",_PanelsSave)){
396
if (mainView->left->type == "tree") config->writeEntry("Left Panel Type",i18n("Tree"));
397
else if (mainView->left->type == "quickview") config->writeEntry("Left Panel Type",i18n("Quickview"));
398
else { // list view - save both type and homepage
399
config->writeEntry("Left Panel Type",i18n("List"));
400
config->writeEntry("Left Panel Origin",i18n("the last place it was"));
403
if (mainView->right->type == "tree") config->writeEntry("Right Panel Type",i18n("Tree"));
404
else if (mainView->right->type == "quickview") config->writeEntry("Right Panel Type",i18n("Quickview"));
405
else { // list view - save both type and homepage
406
config->writeEntry("Right Panel Type",i18n("List"));
407
config->writeEntry("Right Panel Origin",i18n("the last place it was"));
411
if( mainView->left->type=="list" )
412
config->writeEntry("lastHomeLeft",mainView->left->realPath);
414
if( mainView->right->type=="list" )
415
config->writeEntry("lastHomeRight",mainView->right->realPath);
417
// save size and position
418
if (config->readBoolEntry("Remember Position",_RememberPos) ||
419
config->readBoolEntry("UI Save Settings",_UiSave) ) {
652
toolBar() ->saveSettings( krConfig, "Private" );
653
config->setGroup( "Startup" );
654
config->writeEntry( "Left Active Tab", mainView->leftMng->activeTab() );
655
config->writeEntry( "Right Active Tab", mainView->rightMng->activeTab() );
656
mainView->leftMng->saveSettings( krConfig, "Left Tab Bar" );
657
mainView->rightMng->saveSettings( krConfig, "Right Tab Bar" );
658
bool panelsavesettings = config->readBoolEntry( "Panels Save Settings", _PanelsSave );
659
bool rememberpos = config->readBoolEntry( "Remember Position", _RememberPos );
660
bool uisavesettings = config->readBoolEntry( "UI Save Settings", _UiSave );
661
if ( panelsavesettings ) {
663
config->writeEntry( "Left Panel Type", i18n( "List" ) );
664
config->writeEntry( "Left Panel Origin", i18n( "the last place it was" ) );
666
config->writeEntry( "Right Panel Type", i18n( "List" ) );
667
config->writeEntry( "Right Panel Origin", i18n( "the last place it was" ) );
669
// save the popup panel's page of the CURRENT tab
670
config->writeEntry( "Left Panel Popup", mainView->left->popup->currentPage() );
671
config->writeEntry( "Right Panel Popup", mainView->right->popup->currentPage() );
673
// save size and position
674
if ( rememberpos || uisavesettings ) {
424
if ( config->readBoolEntry("UI Save Settings",_UiSave ) ){
425
config->writeEntry( "Show status bar",actShowStatusBar->isChecked() );
426
config->writeEntry( "Show tool bar",actShowToolBar->isChecked() );
427
config->writeEntry( "Show FN Keys",actToggleFnkeys->isChecked() );
428
config->writeEntry( "Show Cmd Line",actToggleCmdline->isChecked() );
429
config->writeEntry( "Show Terminal Emulator",actToggleTerminal->isChecked());
432
// delete all vfs records...
433
mainView->left->cleanUp();
434
mainView->right->cleanUp();
679
if ( uisavesettings ) {
680
config->setGroup( "Startup" );
681
config->writeEntry( "Show status bar", actShowStatusBar->isChecked() );
682
config->writeEntry( "Show tool bar", actShowToolBar->isChecked() );
683
config->writeEntry( "Show FN Keys", actToggleFnkeys->isChecked() );
684
config->writeEntry( "Show Cmd Line", actToggleCmdline->isChecked() );
685
config->writeEntry( "Show Terminal Emulator", actToggleTerminal->isChecked() );
437
void Krusader::refreshView(){
439
mainView=new KrusaderView(this);
440
setCentralWidget(mainView);
441
config->setGroup("Private");
442
resize(krConfig->readSizeEntry("Start Size",_StartSize));
443
move(krConfig->readPointEntry("Start Position",_StartPosition));
690
void Krusader::refreshView() {
692
mainView = new KrusaderView( this );
693
setCentralWidget( mainView );
694
config->setGroup( "Private" );
695
resize( krConfig->readSizeEntry( "Start Size", _StartSize ) );
696
move( krConfig->readPointEntry( "Start Position", _StartPosition ) );
448
701
bool Krusader::queryClose() {
450
krConfig->setGroup("Look&Feel");
451
if (krConfig->readBoolEntry("Warn On Exit",_WarnOnExit)) {
452
switch ( KMessageBox::warningYesNo( this,
453
i18n("Ok to shutdown Krusader ?")) ) {
454
case KMessageBox::Yes :
456
case KMessageBox::No :
706
krConfig->setGroup( "Look&Feel" );
707
if ( krConfig->readBoolEntry( "Warn On Exit", _WarnOnExit ) ) {
708
switch ( KMessageBox::warningYesNo( this,
709
i18n( "Ok to shutdown Krusader?" ) ) ) {
710
case KMessageBox::Yes :
713
case KMessageBox::No :
721
// close all open VFS
722
//delete krApp->mainView->left->func;
723
//delete krApp->mainView->right->func;
464
731
void Krusader::quitKrusader() {
465
if (queryClose()) kapp->quit();
732
if ( queryClose() ) {
468
737
// the please wait dialog functions
469
void Krusader::startWaiting( QString msg, int count , bool cancel){
470
plzWait->startWaiting( msg ,count, cancel );
473
void Krusader::incProgress(KProcess *,char *buffer,int buflen){
475
for (int i=0 ; i<buflen; ++i)
476
if ( buffer[i] == '\n' ) ++howMuch;
478
plzWait->incProgress(howMuch);
481
void Krusader::stopWait(){
485
void Krusader::updateGUI(bool enforce) {
486
// now, check if we need to create a konsole_part
487
config->setGroup("Startup");
488
if (config->readBoolEntry("Show Terminal Emulator",_ShowTerminalEmulator)) {
490
mainView->slotTerminalEmulator(true); // create konsole_part
491
config->setGroup("Private");
493
lst.append(config->readNumEntry("Panel Size",_PanelSize));
494
lst.append(config->readNumEntry("Terminal Size",_TerminalSize));
495
mainView->vert_splitter->setSizes(lst);
496
config->setGroup("Startup");
500
// call the XML GUI function to draw the UI
501
createGUI(mainView->konsole_part);
502
toolBar()->applySettings(krConfig,"Private");
504
// now, hide what need to be hidden
505
if (!krConfig->readBoolEntry("Show tool bar",_ShowToolBar)){
507
actShowToolBar->setChecked(false);
510
actShowToolBar->setChecked(true);
512
if (!krConfig->readBoolEntry("Show status bar",_ShowStatusBar)){
514
actShowStatusBar->setChecked(false);
517
actShowStatusBar->setChecked(true);
519
if (!krConfig->readBoolEntry("Show Cmd Line",_ShowCmdline)){
520
mainView->cmdLine->hide();
521
actToggleCmdline->setChecked(false);
523
mainView->cmdLine->show();
524
actToggleCmdline->setChecked(true);
526
if (!krConfig->readBoolEntry("Show FN Keys",_ShowFNkeys)){
527
mainView->fnKeys->hide();
528
actToggleFnkeys->setChecked(false);
530
mainView->fnKeys->show();
531
actToggleFnkeys->setChecked(true);
738
void Krusader::startWaiting( QString msg, int count , bool cancel ) {
739
plzWait->startWaiting( msg , count, cancel );
742
void Krusader::incProgress( KProcess *, char *buffer, int buflen ) {
744
for ( int i = 0 ; i < buflen; ++i )
745
if ( buffer[ i ] == '\n' )
748
plzWait->incProgress( howMuch );
751
void Krusader::stopWait() {
755
void Krusader::updateGUI( bool enforce ) {
756
// now, check if we need to create a konsole_part
757
config->setGroup( "Startup" );
758
if ( config->readBoolEntry( "Show Terminal Emulator", _ShowTerminalEmulator ) ) {
760
mainView->slotTerminalEmulator( true ); // create konsole_part
761
config->setGroup( "Private" );
763
lst.append( config->readNumEntry( "Panel Size", _PanelSize ) );
764
lst.append( config->readNumEntry( "Terminal Size", _TerminalSize ) );
765
mainView->vert_splitter->setSizes( lst );
766
config->setGroup( "Startup" );
770
// call the XML GUI function to draw the UI
771
createGUI( mainView->konsole_part );
772
toolBar() ->applySettings( krConfig, "Private" );
774
// now, hide what need to be hidden
775
if ( !krConfig->readBoolEntry( "Show tool bar", _ShowToolBar ) ) {
777
actShowToolBar->setChecked( false );
780
actShowToolBar->setChecked( true );
782
if ( !krConfig->readBoolEntry( "Show status bar", _ShowStatusBar ) ) {
783
statusBar() ->hide();
784
actShowStatusBar->setChecked( false );
786
statusBar() ->show();
787
actShowStatusBar->setChecked( true );
789
if ( !krConfig->readBoolEntry( "Show Cmd Line", _ShowCmdline ) ) {
790
mainView->cmdLine->hide();
791
actToggleCmdline->setChecked( false );
793
mainView->cmdLine->show();
794
actToggleCmdline->setChecked( true );
796
// update the Fn bar to the shortcuts selected by the user
797
mainView->fnKeys->updateShortcuts();
798
if ( !krConfig->readBoolEntry( "Show FN Keys", _ShowFNkeys ) ) {
799
mainView->fnKeys->hide();
800
actToggleFnkeys->setChecked( false );
802
mainView->fnKeys->show();
803
actToggleFnkeys->setChecked( true );
536
808
// return a list in the format of TOOLS,PATH. for example
537
809
// DIFF,kdiff,TERMINAL,konsole,...
539
// currently supported tools: DIFF,
811
// currently supported tools: DIFF, MAIL, RENAME
541
813
// to use it: QStringList lst = supportedTools();
542
814
// int i = lst.findIndex("DIFF");
543
815
// if (i!=-1) pathToDiff=lst[i+1];
544
816
QStringList Krusader::supportedTools() {
550
// first, a diff program: kdiff
553
proc << "which kdiff >/dev/null 2>&1";
554
if( proc.start(KProcess::Block) && proc.normalExit() && proc.exitStatus()==0 ) {
555
tools.append("DIFF"); tools.append("kdiff");
560
proc.clearArguments();
561
proc << "which xxdiff >/dev/null 2>&1";
562
if( proc.start(KProcess::Block) && proc.normalExit() && proc.exitStatus()==0 ) {
563
tools.append("DIFF"); tools.append("xxdiff");
571
proc.clearArguments();
572
proc << "which kmail >/dev/null 2>&1";
573
if( proc.start(KProcess::Block) && proc.normalExit() && proc.exitStatus()==0 ) {
574
tools.append("MAIL"); tools.append("kmail");
582
QString Krusader::getTempDir(){
583
// try to make krusader temp dir
584
krConfig->setGroup("General");
585
QString tmpDir = krConfig->readEntry("Temp Directory",_TempDirectory);
586
for(int i = 1 ; i != -1 ; i=tmpDir.find('/',i+1) )
587
QDir().mkdir( tmpDir.left(i) );
588
QDir().mkdir( tmpDir );
589
chmod( tmpDir.local8Bit(), 0777);
590
// add a secure sub dir under the user UID
592
uid.sprintf("%d",getuid());
593
QDir(tmpDir).mkdir(uid);
594
tmpDir=tmpDir+"/"+uid+"/";
595
chmod(tmpDir.local8Bit(),S_IRUSR | S_IWUSR | S_IXUSR );
596
// add a random sub dir to use
597
while (QDir().exists(tmpDir)) tmpDir = tmpDir+kapp->randomString(8);
598
QDir().mkdir(tmpDir);
600
if( !QDir(tmpDir).isReadable() ){
601
KMessageBox::error(krApp,"Could not create a temporary directory.\nHandling of Archives will not be possible until this is fixed.");
602
return QString::null;
607
QString Krusader::getTempFile(){
608
// try to make krusader temp dir
609
krConfig->setGroup("General");
610
QString tmpDir = krConfig->readEntry("Temp Directory",_TempDirectory);
611
for(int i = 1 ; i != -1 ; i=tmpDir.find('/',i+1) )
612
QDir().mkdir( tmpDir.left(i) );
613
QDir().mkdir( tmpDir );
614
chmod( tmpDir.local8Bit(), 0777);
615
// add a secure sub dir under the user UID
617
uid.sprintf("%d",getuid());
618
QDir(tmpDir).mkdir(uid);
619
tmpDir=tmpDir+"/"+uid+"/";
620
chmod(tmpDir.local8Bit(),S_IRUSR | S_IWUSR | S_IXUSR );
622
while(QDir().exists(tmpDir)) tmpDir = tmpDir+kapp->randomString(8);
819
// first, a diff program: kdiff
820
if ( KrServices::cmdExist( "kdiff" ) ) {
821
tools.append( "DIFF" );
822
tools.append( KrServices::fullPathName( "kdiff", "diff utility" ) );
823
} else if ( KrServices::cmdExist( "kompare" ) ) {
824
tools.append( "DIFF" );
825
tools.append( KrServices::fullPathName( "kompare", "diff utility" ) );
826
} else if ( KrServices::cmdExist( "xxdiff" ) ) {
827
tools.append( "DIFF" );
828
tools.append( KrServices::fullPathName( "xxdiff", "diff utility" ) );
831
if ( KrServices::cmdExist( "kmail" ) ) {
832
tools.append( "MAIL" );
833
tools.append( KrServices::fullPathName( "kmail" ) );
835
// rename tool: krename
836
if ( KrServices::cmdExist( "krename" ) ) {
837
tools.append( "RENAME" );
838
tools.append( KrServices::fullPathName( "krename" ) );
844
QString Krusader::getTempDir() {
845
// try to make krusader temp dir
846
krConfig->setGroup( "General" );
847
QString tmpDir = krConfig->readEntry( "Temp Directory", _TempDirectory );
849
if ( ! QDir( tmpDir ).exists() ) {
850
for ( int i = 1 ; i != -1 ; i = tmpDir.find( '/', i + 1 ) )
851
QDir().mkdir( tmpDir.left( i ) );
852
QDir().mkdir( tmpDir );
853
chmod( tmpDir.local8Bit(), 0777 );
856
// add a secure sub dir under the user UID
858
uid.sprintf( "%d", getuid() );
859
QDir( tmpDir ).mkdir( uid );
860
tmpDir = tmpDir + "/" + uid + "/";
861
chmod( tmpDir.local8Bit(), S_IRUSR | S_IWUSR | S_IXUSR );
862
// add a random sub dir to use
863
while ( QDir().exists( tmpDir ) )
864
tmpDir = tmpDir + kapp->randomString( 8 );
865
QDir().mkdir( tmpDir );
867
if ( !QDir( tmpDir ).isReadable() ) {
868
KMessageBox::error( krApp, "Could not create a temporary directory. Handling of Archives will not be possible until this is fixed." );
869
return QString::null;
874
QString Krusader::getTempFile() {
875
// try to make krusader temp dir
876
krConfig->setGroup( "General" );
877
QString tmpDir = krConfig->readEntry( "Temp Directory", _TempDirectory );
879
if ( ! QDir( tmpDir ).exists() ) {
880
for ( int i = 1 ; i != -1 ; i = tmpDir.find( '/', i + 1 ) )
881
QDir().mkdir( tmpDir.left( i ) );
882
QDir().mkdir( tmpDir );
883
chmod( tmpDir.local8Bit(), 0777 );
886
// add a secure sub dir under the user UID
888
uid.sprintf( "%d", getuid() );
889
QDir( tmpDir ).mkdir( uid );
890
tmpDir = tmpDir + "/" + uid + "/";
891
chmod( tmpDir.local8Bit(), S_IRUSR | S_IWUSR | S_IXUSR );
893
while ( QDir().exists( tmpDir ) )
894
tmpDir = tmpDir + kapp->randomString( 8 );