diff --git a/ChangeLog b/ChangeLog index dc7f428e..274ad917 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,227 +1,228 @@ ====================== + ADDED: Creating new files with SHIFT+F4 ADDED: Russian translation (thanks to Dmitry Chernyak) ADDED: Ctrl+Enter and Ctrl+Shift+Enter keyboard shortcuts ADDED: default shortcut for refreshing the panel is Ctrl+R ADDED: ctrl-left/right arrow checks if we're on a folder, if so it refreshes the other panel with the contents of the folder, otherwise to the same path as current one (Wincmd style) ADDED: tabbed-browsing beta ---> memory leak? listpanel doesn't seem to be deleted (using top to check) FIXED: internal editor / viewer crash at invalid symlinks ADDED: SHIFT-F3 view dialog. ADDED: The internal viewer follow links on HTML pages. ADDED: Total Commander like file renaming (two subsequent single clicks on an item) ADDED: panel swapping by Ctrl+U ADDED: command line improvments: ctrl+/ opens history list, up&down keys work again, and general usability ADDED: krusader can now be started from commandline with new options: try: krusader --left=/mnt/cdrom --right=ftp://downloads@myserver.net ! ADDED: new command line widget. should fix some issues and requests ADDED: Missing WhatsThis information (thanks to Mikolaj!) ADDED: new selection mode (a-la Total Commander) - beta mode! Selected file is colored by the "link" color ADDED: a new shortcut for 'show hidden files' - ctrl+. (ctrl plus dot) ADDED: rar support to krArc KIO slave. ADDED: open with in the right click menu for multiple files with the same mimetype. ADDED: Patch by Heiner which adds a cancel button to the calculate space action. FIXED: run-in-terminal would cause the terminal to close prematuraly and results would be lost. FIXED: free disk capacity miscalculation for Ext2 and Ext3 file systems. FIXED: crash when editing a file with # in the filename FIXED: inplace renaming bug with extention when pressing ctrl+click FIXED: whenever the folder gets refreshed, the current file would be lost FIXED: problematic behavior when trying to SPACE a folder without permissions FIXED: Ctrl-A didn't work properly FIXED: crash when unmounting a busy mountpoint FIXED: date-time sorting bug FIXED: changed pop-up delay of the history button on the command line to zero FIXED: right-click menu via keyboard appeared in the wrong place FIXED: crash when using spacebar on the ".." (thanks to heiner) FIXED: automark directories didn't work (thanks to Anarky) FIXED: bug when using space to calculate space of directory FIXED: crash when viewing files with # in their name. FIXED: compilation problem with GCC >= 3.3 (thanks to Adios) FIXED: Force refresh when creating a new directory. FIXED: a crash when trying to repaint when the VFS was deleted. REMOVED: Device Manager action UPDATED: many usability issues (thanks to Mikolaj) UPDATED: German translation UPDATED: Hungarian translation UPDATED: Dutch translation UPDATED: Spanish translation 1.25-beta1 ====================== ADDED: Finally, the new bookmark system is here! courtasy of Jan Halasa ADDED: new Hungarian translation, thanks to Kukk Zoltán FIXED: mountMan bug - didn't allow to umount/mount filesystem with trailing / FIXED: width of modified column for i18n (thanks to heiner) FIXED: dirUp() bug - selection goes to top. FIXED: the @ in ftp passwords bug. UPDATED: Slovak translation UPDATED: Dutch translation 1.21-beta1 ====================== ADDED: Opening left/right bookmarks (alt+left/right arrow) is now an action, and can be remapped. ADDED: In-place renaming (thanks to Heiner Eichmann) ADDED: New KIO slaves to handle archives. ADDED: multi-file properties. ADDED: Krusader now obeys KDE's date time format ADDED: Total-Commander style directory selection. Press SPACE to check it out! Thanks goes (again) to Heiner Eichmann! FIXED: column sizes are saved when doing 'save postion', or if 'save settings' is set in konfigurator. FIXED: double-catching of the ~ (tilda) key FIXED: double-catching of the backspace key FIXED: closing krusader using Alt-F4 or clicking X didn't save settings FIXED: Wrong focus after renaming FIXED: Error using KRename with filenames containing spaces (thanks to Tobias Vogele) FIXED: FreeBSD compatability in KrARC (thanks to Heiner Eichmann) FIXED: a crash in the dirUp() function. FIXED: when opening bookmarks using keyboard, active panel didn't change properly FIXED: in search dialog - you can now simply click text, and press ENTER. no need to click Search FIXED: a lot of usability issues (thanks to Mikolaj Machowski) FIXED: double-click in search dialog bug (thanks to heiner eichmann for the patch) FIXED: i18n issues - thanks to Frank Schoolmeesters FIXED: Panel flicker patch (thanks to Gabor Takacs for the patch) FIXED: Krusader failed to report permission errors while deleting files FIXED: issue with Japanesse translation FIXED: ctrl+arrows is caught by panel and not the view FIXED: removed unsafe debug messages FIXED: proper properties and owner/group for non-local files UPDATED: Dutch translation UPDATED: German translation BUG: krArc slow when unpacking large files 1.20 - KDE 3 ====================== ADDED: Clicking on the status or totals bars (above and below file list) changes focus ADDED: Each panel remembers the way it was sorted (might be different for each) ADDED: Each panel remembers the column width (might be different for each) ADDED: Dutch translation, thanks to Frank Schoolmeesters FIXED: Crash when saying NO to "really exit krusader?" UPDATED: German translation UPDATED: Polish translation 1.20 ====================== ADDED: Japanese translation, thanks to UTUMI Hirosi ADDED: error window when attempting to drag-n-drop to a target without enough permissions FIXED: crash when viewing/editing a file without permissions to read FIXED: icon touchup - to make the thing look more consistent FIXED: removed the ftp disconnect and root actions from the toolbar FIXED: updated polish translation FIXED: date sorting with files older than the year 2000 FIXED: crash on remote connections if there is a @ in the password FIXED: the remote connections rename function FIXED: blank hex viewer with short text files FIXED: anonymous checkbox in remote-man not respected 1.12 beta2 ====================== ADDED: Introducing extention column ADDED: Italian translation (thanks to Giuseppe Bordoni) ADDED: Preview to the right-click menu. FIXED: minimize to tray didn't behave correctly FIXED: crash when mounting failed (no cdrom in drive) FIXED: icon too big when minimized to tray FIXED: origin bar now accepts local urls (file:/) gracefully FIXED: origin bug, which caused the focus to go to the panel too soon. FIXED: right click menu in mountman (thanx to Heiner). FIXED: new 'admin' folder (support automake 1.7). FIXED: ESC key close the viewer. FIXED: crash when trying to open non-existing directory. FIXED: directory sorting. FIXED: TODO: automark directories won't work in 1.12!!! TODO: can we add a krProgress to normal-vfs refreshes ? TODO: dragn'drop quirky. TODO: add progressbar to totals (?) TODO: COMPAREMODE 1.12 beta1 ====================== ADDED: some GUI touch-ups: make buttons smaller, and bars leaner. all in all, the thing should look better. ADDED: FreeBSD compatability issues - patchs by Heiner, thanks man! ADDED: move to next-gen view (at last) FIXED: popup-menu poping out of place. FIXED: Panel & PanelFunc permission clean up. FIXED: krBack() clean up. FIXED: moved all the logic from ListPanel to ListPanelFunc FIXED: integrated the openUrl() API. FIXED: minor bug in mountman FIXED: bug in arc_vfs, concerning full-paths in tars (thanks Heiner) FIXED: right align size column REMOVED: Tree & Quickview panels. 1.11 KDE 3 ====================== ADDED: updated Swedish translation, thanks to Anders Linden. ADDED: new Spanish translation, thanks to Rafa Munoz. ADDED: new Polish translation, thanks to Lukasz Janyst. FIXED: Changed the internal viewer default from Hex to Text. FIXED: Crash when Krusader is called with open viewer/internal editor. FIXED: Keyboard shortcuts not saved in Konfigurator. 1.10 - KDE 3 ====================== ADDED: new and improved viewer. ADDED: Krename support ! (more info at: http://krename.sf.net ) ADDED: you can now use the command line to "cd" into konqi-supported urls. ( try: cd audiocd:/?dev=/dev/cdrom ) ADDED: you can try to execute files in remote filesystem. ADDED: new command detection function instead of using 'which' FIXED: rewritten the panel sorting function, it should be better and faster now. FIXED: back to KRDirWatch, since KDirWatch crashed us on systems with FAM enabled. FIXED: removed the "panel start path is invalid" error message. if the start path is invalid try to find the closest path (the previous solution was '/'); FIXED: don't watch read-only/not-readable directories - this should improve performance and avoid a loooong wait time on super-mounted cdroms. FIXED: multiple selctions modes are no-more. default mode is Konqueror. the multi-mode become unstable after the kde3 porting and we had to disable it. FIXED: memory leak when starting konfigurator. 1.0.2 - KDE 3 ====================== ADDED: new icon. ADDED: sftp & scp support. ADDED: multi-protocol and history to the new connection dialog. FIXED: normal_vfs now uses the KDE dir watch, in other words: better directory refresh. FIXED: new 'admin' folder. 1.0.1 - KDE 3 ====================== ADDED: Krusader now compiles on KDE 3 (tested with RC3). ADDED: New ftp/smb vfs due to KDE 3 API changes. 1.0.1 ====================== ADDED: When compare-mode is active, pressing the 'Select Files' icon (or the equivelent keyboard short-cut), will open the usual dialog with 4 new options in the predefined selections. This allows automatic selection of files according to their compare-mode status - newer, older, etc. ADDED: Terminal emulator now "follows mouse" - konqueror style. ADDED: French translation. ADDED: A new icon for Krusader. new we've got krusader.png and krusader2.png ! FIXED: errors compiling on kde 2.1 - convertSizeFromKB FIXED: compatability issue with installing to debian FIXED: compatability issue with Solaris FIXED: keyboard settings are not saved. FIXED: a small bug causing 'rrr' to show instead of 'rwx'. 1/1/02 - 1.00 ===================== diff --git a/krusader/KViewer/krviewer.cpp b/krusader/KViewer/krviewer.cpp index d8468d2e..bb2cd28c 100644 --- a/krusader/KViewer/krviewer.cpp +++ b/krusader/KViewer/krviewer.cpp @@ -1,301 +1,301 @@ /*************************************************************************** krviewer.cpp - description ------------------- begin : Thu Apr 18 2002 copyright : (C) 2002 by Shie Erlich & Rafi Yanai email : ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // Qt includes #include #include #include // KDE includes #include #include #include #include #include #include #include #include #include #include #include #include #include // Krusader includes #include "krviewer.h" #include "../krusader.h" KrViewer::KrViewer(QWidget *parent, const char *name ) : KParts::MainWindow(parent,name), manager(this,this){ //setWFlags(WType_TopLevel | WDestructiveClose); setXMLFile("krviewerui.rc"); setHelpMenuEnabled(false); setAutoSaveSettings("KrViewerWindow",true); tmpFile.setAutoDelete(true); hex_part=generic_part=text_part=editor_part=0L; connect(&manager,SIGNAL(activePartChanged(KParts::Part*)), this,SLOT(createGUI(KParts::Part*))); viewerMenu = new QPopupMenu( this ); viewerMenu->insertItem( i18n("&Generic viewer"), this, SLOT(viewGeneric()), CTRL+Key_G,1 ); viewerMenu->insertItem( i18n("&Text viewer"), this, SLOT(viewText()), CTRL+Key_T,2 ); viewerMenu->insertItem( i18n("&Hex viewer"), this, SLOT(viewHex()), CTRL+Key_H,3 ); viewerMenu->insertSeparator(); viewerMenu->insertItem( i18n("Text &editor"), this, SLOT(editText()), CTRL+Key_E,4 ); viewerMenu->insertSeparator(); viewerMenu->insertItem( i18n("&Close"), this, SLOT( close() ), Key_Escape ); statusBar()->show(); } KrViewer::~KrViewer(){ //kdDebug() << "KrViewer killed" << endl; } -KParts::Part* KrViewer::getPart(KURL url, QString mimetype ,bool readOnly){ +KParts::Part* KrViewer::getPart(KURL url, QString mimetype ,bool readOnly, bool create){ KParts::Part *part = 0L; KLibFactory *factory = 0; KTrader::OfferList offers = KTrader::self()->query(mimetype); QString type = (readOnly ? "KParts::ReadOnlyPart" : "KParts::ReadWritePart"); // in theory, we only care about the first one.. but let's try all // offers just in case the first can't be loaded for some reason KTrader::OfferList::Iterator it(offers.begin()); for( ; it != offers.end(); ++it) { KService::Ptr ptr = (*it); // we now know that our offer can handle mimetype and is a part. // since it is a part, it must also have a library... let's try to // load that now factory = KLibLoader::self()->factory( ptr->library().latin1() ); if (factory) { part = static_cast(factory->create(this, ptr->name().latin1(), type.latin1() )); if( part ) - if( ((KParts::ReadOnlyPart*)part)->openURL(url) ) break; + if( ((KParts::ReadOnlyPart*)part)->openURL( url ) || create ) break; else { delete part; part = 0L; } } } return part; } void KrViewer::createGUI(KParts::Part* part){ // make sure all the other parts are hidden if(generic_part) generic_part->widget()->hide(); if(text_part) text_part->widget()->hide(); if(hex_part) hex_part->widget()->hide(); if(editor_part) editor_part->widget()->hide(); // and show the new part widget connect(part,SIGNAL(setStatusBarText(const QString&)), this,SLOT(slotSetStatusBarText(const QString&))); KParts::MainWindow::createGUI(part); setCentralWidget(part->widget()); part->widget()->show(); // and "fix" the menubar menuBar()->removeItem(70); menuBar()->insertItem( i18n("&KrViewer"), viewerMenu,70 ); menuBar()->show(); } void KrViewer::keyPressEvent(QKeyEvent *e) { switch (e->key()) { case Key_F10: case Key_Escape: close(); break; default: e->ignore(); break; } } void KrViewer::view(KURL url){ KrViewer* viewer = new KrViewer(krApp); viewer->url = url; viewer->setCaption("KrViewer: "+url.url()); viewer->show(); if( !viewer->viewGeneric() ){ if( !viewer->viewText() ) { viewer->destroy(); return; } viewer->viewerMenu->setItemEnabled(1,false); } } -void KrViewer::edit(KURL url){ +void KrViewer::edit(KURL url, bool create){ KrViewer* viewer = new KrViewer(krApp); viewer->url = url; viewer->setCaption("KrEdit: "+url.url()); viewer->show(); - if( !viewer->editText() ) + if( !viewer->editText( create ) ) { viewer->destroy(); return; } } bool KrViewer::editGeneric(QString mimetype, KURL _url){ KParts::ReadWritePart *kedit_part = 0L; KLibFactory *factory = 0; KTrader::OfferList offers = KTrader::self()->query(mimetype); // in theory, we only care about the first one.. but let's try all // offers just in case the first can't be loaded for some reason KTrader::OfferList::Iterator it(offers.begin()); for( ; it != offers.end(); ++it) { KService::Ptr ptr = (*it); // we now know that our offer can handle mimetype and is a part. // since it is a part, it must also have a library... let's try to // load that now factory = KLibLoader::self()->factory( ptr->library().latin1() ); if (factory) { kedit_part = static_cast(factory->create(this, ptr->name().latin1(), "KParts::ReadWritePart")); if( kedit_part ) if(kedit_part->openURL(_url) ) break; else { delete kedit_part; kedit_part = 0L; } } } if (!kedit_part){ KMessageBox::error(this,i18n("Sorry, can't find internal editor")); return false; } setCentralWidget(kedit_part->widget()); createGUI(kedit_part); kedit_part->widget()->show(); return true; } -bool KrViewer::editText(){ +bool KrViewer::editText( bool create ){ if( !editor_part ){ - editor_part = static_cast(getPart(url,"text/plain",false)); + editor_part = static_cast(getPart(url,"text/plain",false,create)); if( !editor_part ) return false; manager.addPart(editor_part,this); } manager.setActivePart(editor_part); return true; } bool KrViewer::viewGeneric(){ QString mimetype = KMimeType::findByURL( url )->name(); if( url.prettyURL().startsWith("man:") ) mimetype = "text/html"; if( mimetype == "text/plain" ) viewerMenu->setItemEnabled(1,false); if( !generic_part ){ if( mimetype.contains("html") ){ KHTMLPart* p = new KHTMLPart(this,0,0,0,KHTMLPart::BrowserViewGUI); connect(p->browserExtension(), SIGNAL(openURLRequest(const KURL &, const KParts::URLArgs &)), this,SLOT(handleOpenURLRequest(const KURL &,const KParts::URLArgs & ))); p-> openURL(url); generic_part = p; } else { generic_part = static_cast(getPart(url,mimetype,true)); } if( generic_part ) manager.addPart(generic_part,this); else return false; } manager.setActivePart(generic_part); return true; } bool KrViewer::viewText(){ if( !text_part ){ text_part = static_cast(getPart(url,"text/plain",true)); if( !text_part ) return false; manager.addPart(text_part,this); } manager.setActivePart(text_part); return true; } void KrViewer::viewHex(){ if( !hex_part ){ QString file; // files that are not local must first be downloaded if( !url.isLocalFile() ){ if( !KIO::NetAccess::download( url, file ) ){ KMessageBox::sorry(this,i18n("KrViewer is unable to download: ")+url.url()); return; } } else file = url.url().mid(url.url().find("/")); // create a hex file QFile f_in( file ); f_in.open( IO_ReadOnly ); QDataStream in( &f_in ); FILE *out = KDE_fopen(tmpFile.name().mid(tmpFile.name().find("/")).latin1(),"w"); KIO::filesize_t fileSize = f_in.size(); KIO::filesize_t address = 0; char buf[16]; unsigned int* pBuff = (unsigned int*)buf; while( address 16)? 16 : (fileSize-address); in.readRawBytes(buf,bufSize); fprintf(out,"0x%8.8llx: ",address); for(int i=0; i<4; ++i){ if(i<(bufSize/4)) fprintf(out,"%8.8x ",pBuff[i]); else fprintf(out," "); } fprintf(out,"| "); for(int i=0; i' ' && buf[i]<'~' ) fputc(buf[i],out); else fputc('.',out); } fputc('\n',out); address += 16; } // clean up f_in.close(); fclose(out); if( !url.isLocalFile() ) KIO::NetAccess::removeTempFile( file ); hex_part = static_cast(getPart(tmpFile.name(),"text/plain",true)); if( !hex_part ) return; manager.addPart(hex_part,this); } manager.setActivePart(hex_part); } void KrViewer::handleOpenURLRequest( const KURL &url, const KParts::URLArgs & ){ if(generic_part) generic_part->openURL(url); } diff --git a/krusader/KViewer/krviewer.h b/krusader/KViewer/krviewer.h index f14f60fd..cac25401 100644 --- a/krusader/KViewer/krviewer.h +++ b/krusader/KViewer/krviewer.h @@ -1,69 +1,69 @@ /*************************************************************************** krviewer.h - description ------------------- begin : Thu Apr 18 2002 copyright : (C) 2002 by Shie Erlich & Rafi Yanai email : ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KRVIEWER_H #define KRVIEWER_H #include #include #include #include #include /** *@author Shie Erlich & Rafi Yanai */ class QPopupMenu; class KrViewer : public KParts::MainWindow { Q_OBJECT public: ~KrViewer(); static void view(KURL url); - static void edit(KURL url); + static void edit(KURL url, bool create = false ); public slots: bool viewGeneric(); void viewHex(); bool viewText(); bool editGeneric(QString mimetype, KURL _url); - bool editText(); + bool editText( bool create = false ); void keyPressEvent(QKeyEvent *e); void createGUI(KParts::Part*); void handleOpenURLRequest( const KURL &url, const KParts::URLArgs & ); private: KrViewer(QWidget *parent=0, const char *name=0); - KParts::Part* getPart(KURL url, QString m ,bool readOnly); + KParts::Part* getPart(KURL url, QString m ,bool readOnly, bool create=false); QPopupMenu* viewerMenu; KURL url; KParts::PartManager manager; KParts::ReadOnlyPart *generic_part; KParts::ReadOnlyPart *text_part; KParts::ReadOnlyPart *hex_part; KParts::ReadWritePart *editor_part; KTempFile tmpFile; }; #endif diff --git a/krusader/krslots.cpp b/krusader/krslots.cpp index e8f40472..515082ae 100644 --- a/krusader/krslots.cpp +++ b/krusader/krslots.cpp @@ -1,429 +1,463 @@ /*************************************************************************** krslots.cpp ------------------- copyright : (C) 2001 by Shie Erlich & Rafi Yanai email : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- Description *************************************************************************** A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD S o u r c e F i l e *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include #include #include // KDE includes #include #include #include #include #include #include #include #include #include #include // Krusader includes #include "krslots.h" #include "krusader.h" #include "krusaderview.h" #include "Panel/listpanel.h" #include "Dialogs/krdialogs.h" #include "Dialogs/krspwidgets.h" #include "GUI/krusaderstatus.h" #include "RemoteMan/remoteman.h" #include "Panel/panelfunc.h" #include "Konfigurator/konfigurator.h" #include "MountMan/kmountman.h" #include "defaults.h" #include "resources.h" #include "GUI/kfnkeys.h" #include "GUI/kcmdline.h" #include "Search/krquery.h" #include "Search/krsearchmod.h" #include "Search/krsearchdialog.h" #include "VFS/vfs.h" #include "panelmanager.h" #define ACTIVE_PANEL (krApp->mainView->activePanel) #define ACTIVE_FUNC (krApp->mainView->activePanel->func) #define MAIN_VIEW (krApp->mainView) #define REFRESH_BOTH_PANELS { ListPanel *p=ACTIVE_PANEL; \ MAIN_VIEW->left->func->refresh(); \ MAIN_VIEW->right->func->refresh();\ p->slotFocusOnMe(); } void KRslots::selectCompareMask() { int left=0,right=0; KRSpWidgets::selectCompareColorMask(&left, &right); if (left>0 && right>0) { // safeguard MAIN_VIEW->left->colorMask = left; MAIN_VIEW->right->colorMask = right; if (krCompareDirs->isChecked() ) { ((ListPanel*)MAIN_VIEW->left)->view->clear(); ((ListPanel*)MAIN_VIEW->left)->slotUpdate(); ((ListPanel*)MAIN_VIEW->right)->view->clear(); ((ListPanel*)MAIN_VIEW->right)->slotUpdate(); } } } void KRslots::compareDirectories() { KMessageBox::sorry(0, i18n("Compare mode is temporarily disabled. sorry")); if (!krCompareDirs->isChecked()) { ACTIVE_PANEL->compareMode = false; ACTIVE_PANEL->otherPanel->compareMode = false; REFRESH_BOTH_PANELS; return; } // else is implied ACTIVE_PANEL->compareMode = true; ACTIVE_PANEL->otherPanel->compareMode = true; REFRESH_BOTH_PANELS; } void KRslots::sendFileByEmail(QString filename) { QString mailProg; QStringList lst = Krusader::supportedTools(); if (lst.contains("MAIL")) mailProg=lst[lst.findIndex("MAIL") + 1]; else { KMessageBox::error(0,i18n("Krusader can't find any of the supported mail clients. Please install one to your path. Hint: Krusader supports kmail.")); return; } KShellProcess proc; if (mailProg == "kmail") { proc << "kmail" << "--subject \""+i18n("Sending file: ")+ filename.mid(filename.findRev('/')+1)+"\"" << QString::null + "--attach "+"\"" + filename + "\""; } if (!proc.start(KProcess::DontCare)) KMessageBox::error(0,i18n("Error executing ")+mailProg+" !"); else proc.detach(); } void KRslots::compareContent() { QString diffProg; QStringList lst = Krusader::supportedTools(); if (lst.contains("DIFF")) diffProg=lst[lst.findIndex("DIFF") + 1]; else { KMessageBox::error(0,i18n("Krusader can't find any of the supported diff-frontends. Please install one to your path. Hint: Krusader supports kdiff and xxdiff.")); return; } QStringList lst1, lst2; QString name1, name2; ((ListPanel*)ACTIVE_PANEL)->getSelectedNames(&lst1); ((ListPanel*)ACTIVE_PANEL->otherPanel)->getSelectedNames(&lst2); // first, see if we've got exactly 1 selected file, if not, try the current one if (lst1.count() == 1) name1 = lst1[0]; if (lst2.count() == 1) name2 = lst2[0]; if ( name1.isEmpty() || name2.isEmpty() ) { // if we got here, then one of the panel can't be sure what file to diff KMessageBox::detailedError(0,i18n("Don't know which files to compare."), i18n("To compare 2 files by content, select (mark) a file in the left panel, and select another one in the right panel.")); return; } // else implied: all ok, let's call kdiff // but if one of the files isn't local, download them first KURL url1 = ACTIVE_FUNC->files()->vfs_getFile(name1); KURL url2 = ACTIVE_PANEL->otherPanel->func->files()->vfs_getFile(name2); QString tmp1 = QString::null, tmp2 = QString::null; if (!url1.isLocalFile()) { if( !KIO::NetAccess::download( url1, tmp1 ) ){ KMessageBox::sorry(krApp,i18n("Krusader is unable to download: ")+name1); return; } } else tmp1 = url1.url(); if (!url2.isLocalFile()) { if( !KIO::NetAccess::download( url2, tmp2 ) ){ KMessageBox::sorry(krApp,i18n("Krusader is unable to download: ")+name1); return; } } else tmp2 = url2.url(); KShellProcess p; p << diffProg << tmp1.mid(tmp1.find('/')) << tmp2.mid(tmp2.find('/')); if (!p.start(KProcess::DontCare)) KMessageBox::error(0,i18n("Error executing ")+diffProg+" !"); else p.detach(); sleep(2); if( tmp1 != url1.url() ) KIO::NetAccess::removeTempFile( tmp1 ); if( tmp2 != url2.url() ) KIO::NetAccess::removeTempFile( tmp2 ); } void KRslots::rightclickMenu() { ACTIVE_PANEL->popRightClickMenu( ACTIVE_PANEL->mapToGlobal( dynamic_cast(ACTIVE_PANEL->view)->itemRect(dynamic_cast (ACTIVE_PANEL->view->getCurrentKrViewItem())).topLeft() ) ); } void KRslots::addBookmark(){ QString path=ACTIVE_PANEL->virtualPath; if (path.contains('\\')>0) KMessageBox::information(0, i18n("In order to save the time needed to enter an archive, Krusader will not allow bookmarks which point into an archive, as it is usually a mistake to do so!"), QString::null, "BookmarkArchives"); } // GUI toggle slots void KRslots::toggleFnkeys(){ if( MAIN_VIEW->fnKeys->isVisible() ) MAIN_VIEW->fnKeys->hide(); else MAIN_VIEW->fnKeys->show(); } void KRslots::toggleCmdline(){ if( MAIN_VIEW->cmdLine->isVisible() ) MAIN_VIEW->cmdLine->hide(); else MAIN_VIEW->cmdLine->show(); } void KRslots::toggleToolbar() { if (krApp->toolBar()->isVisible()) krApp->toolBar()->hide(); else krApp->toolBar()->show(); } void KRslots::toggleStatusbar() { if (krApp->statusBar()->isVisible()) krApp->statusBar()->hide(); else krApp->statusBar()->show(); } void KRslots::toggleTerminal() { if( MAIN_VIEW->terminal_dock->isVisible() ) MAIN_VIEW->slotTerminalEmulator(false); else MAIN_VIEW->slotTerminalEmulator(true); } void KRslots::showAboutApplication() { KRAbout *q=new KRAbout(); q->exec(); } void KRslots::insertFileName(bool full_path) { QString filename = ACTIVE_PANEL->view->getCurrentItem(); if( filename == QString::null ) return; if( full_path ) { QString path=ACTIVE_FUNC->files()->vfs_getOrigin(); if( !path.endsWith( "/" )) path+="/"; filename = path+filename; } QString current = MAIN_VIEW->cmdLine->text(); if( current.length() != 0 && !current.endsWith( " " ) ) current += " "; MAIN_VIEW->cmdLine->setText( current + filename ); } // directory list functions void KRslots::allFilter() { ACTIVE_PANEL->setFilter(ListPanel::ALL); } void KRslots::execFilter() { ACTIVE_PANEL->setFilter(ListPanel::EXEC); } void KRslots::customFilter() { ACTIVE_PANEL->setFilter(ListPanel::CUSTOM);} void KRslots::markAll() { ACTIVE_PANEL->select(true,true); } void KRslots::unmarkAll() { ACTIVE_PANEL->select(false,true); } void KRslots::markGroup() { ACTIVE_PANEL->select(true,false); } void KRslots::unmarkGroup() { ACTIVE_PANEL->select(false,false); } void KRslots::invert() { ACTIVE_PANEL->invertSelection(); } void KRslots::root() { ACTIVE_FUNC->openUrl("/"); } void KRslots::refresh(QString p){ ACTIVE_FUNC->openUrl(p); } void KRslots::home() { ACTIVE_FUNC->openUrl(QDir::homeDirPath()); } void KRslots::refresh() { ACTIVE_FUNC->refresh(); } void KRslots::properties() { ACTIVE_FUNC->properties(); } void KRslots::dirUp() { ACTIVE_FUNC->dirUp(); } void KRslots::back() { ACTIVE_FUNC->goBack(); } void KRslots::slotPack() { ACTIVE_FUNC->pack(); } void KRslots::slotUnpack() { ACTIVE_FUNC->unpack(); } void KRslots::testArchive() { ACTIVE_FUNC->testArchive(); } void KRslots::calcSpace() { ACTIVE_FUNC->calcSpace(); } void KRslots::FTPDisconnect() { ACTIVE_FUNC->FTPDisconnect(); } void KRslots::newFTPconnection(){ newFTPconnection(QString::null); } void KRslots::newFTPconnection(QString host) { ACTIVE_FUNC->newFTPconnection(host); } // run external modules / programs void KRslots::runKonfigurator(bool firstTime) { delete new Konfigurator(firstTime); } void KRslots::toggleSortByExt() { krConfig->setGroup("Look&Feel"); bool ext = !krConfig->readBoolEntry("Sort By Extention",_SortByExt); krApp->actToggleSortByExt->setChecked(ext); krConfig->writeEntry("Sort By Extention",ext); REFRESH_BOTH_PANELS; } void KRslots::toggleHidden(){ krConfig->setGroup("Look&Feel"); bool show = !krConfig->readBoolEntry("Show Hidden",_ShowHidden); krApp->actToggleHidden->setChecked(show); krConfig->writeEntry("Show Hidden",show); REFRESH_BOTH_PANELS; } void KRslots::toggleSwapPanels(){ PanelManager *currentFirst = panel_swap ? MAIN_VIEW->rightMng : MAIN_VIEW->leftMng; krApp->actToggleSwapPanels->setChecked( panel_swap = !panel_swap ); MAIN_VIEW->horiz_splitter->moveToLast( currentFirst ); MAIN_VIEW->left->updateGeometry(); MAIN_VIEW->right->updateGeometry(); } void KRslots::search() { new KrSearchDialog(); } void KRslots::runRemoteMan() { QString host=remoteMan::getHost(); if (host==QString::null) return; // otherwise, attempt a connection newFTPconnection(host); } void KRslots::runMountMan() { if (krApp->mountMan->operational()) { while (!krApp->mountMan->ready()); krApp->mountMan->mainWindow(); } } void KRslots::homeTerminal(){ QString save = getcwd(0,0); chdir (QDir::homeDirPath().local8Bit()); KProcess proc; krConfig->setGroup("General"); QString term = krConfig->readEntry("Terminal",_Terminal); proc << term; if(!proc.start(KProcess::DontCare)) KMessageBox::sorry(krApp,i18n("Can't open ")+"\""+term+"\""); chdir(save.local8Bit()); } void KRslots::sysInfo(){ KProcess proc; proc << "kcmshell" << "System/ksysctrl"; if (!proc.start(KProcess::DontCare)){ KMessageBox::sorry(krApp,i18n("Can't find \"KsysCtrl\". Please install KDE admin package")); } } void KRslots::multiRename(){ QStringList lst = Krusader::supportedTools(); int i = lst.findIndex("RENAME"); if (i == -1){ KMessageBox::sorry(krApp,i18n("Can't find a batch renamer tool.\nYou can get Krename at http://krename.sf.net")); return; } QString pathToRename = lst[i+1]; QStringList names; ((ListPanel*)ACTIVE_PANEL)->getSelectedNames(&names); KURL::List* urls = ACTIVE_FUNC->files()->vfs_getFiles(&names); if( urls->isEmpty() ){ delete urls; return; } KShellProcess proc; proc << pathToRename; for( KURL::List::iterator u=urls->begin(); u != urls->end(); ++u){ if( QFileInfo((*u).path()).isDir() ) proc << "-r"; proc << "\"" + (*u).path() + "\""; // patch thanks to Tobias Vogele } proc.start(KProcess::DontCare); delete urls; } // settings slots void KRslots::configToolbar(){ KEditToolbar dlg(krApp->factory());//actionCollection()); if (dlg.exec()) krApp->updateGUI(); } void KRslots::configKeys(){ KKeyDialog::configureKeys(krApp->actionCollection(),"krusaderui.rc"); } // misc void KRslots::changeTrashIcon(){ // update trash bin icon - this is "stolen" konqi code // Copyright (C) 2000  David Faure KURL trash; trash.setPath(KGlobalSettings::trashPath()); KURL::List lst; lst.append(trash); KDirNotify_stub allDirNotify("*","KDirNotify*"); allDirNotify.FilesChanged( lst ); // end of konqi code } // F2 void KRslots::terminal() { ACTIVE_FUNC->terminal(); } // F3 void KRslots::view() { ACTIVE_FUNC->view(); } // F4 void KRslots::edit() { ACTIVE_FUNC->editFile(); } // F5 void KRslots::copyFiles() { ACTIVE_FUNC->copyFiles(); } // F6 void KRslots::moveFiles() { ACTIVE_FUNC->moveFiles(); } // F7 void KRslots::mkdir() { ACTIVE_FUNC->mkdir(); } // F8 void KRslots::deleteFiles() { ACTIVE_FUNC->deleteFiles();} // F9 void KRslots::rename() { ACTIVE_FUNC->rename(); } // Shift F3 void KRslots::viewDlg(){ // ask the user for a url to view KChooseDir *chooser = new KChooseDir( 0,i18n("Enter a URL to view:"), QString::null); QString dest = chooser->dest; if ( dest == QString::null ) return ; // the usr canceled - else KrViewer::view( KURL::fromPathOrURL(dest) ); // view the file + else + { + /* KURL::fromPathOrURL requires fullpath, so we check whether it is relative */ + if ( !dest.contains( ":/" ) && !dest.startsWith( "/" ) ) + dest = ACTIVE_FUNC->files()->vfs_getOrigin() + "/" + dest; /* it's full path now */ + + KrViewer::view( KURL::fromPathOrURL(dest) ); // view the file + } + // nothing more to it! +} + +// Shift F4 +void KRslots::editDlg(){ + // ask the user for the filename to edit + KChooseDir *chooser = new KChooseDir( 0,i18n("Enter the filename to edit:"), QString::null); + QString dest = chooser->dest; + if ( dest == QString::null ) return ; // the usr canceled + else + { + /* KURL::fromPathOrURL requires fullpath, so we check whether it is relative */ + if ( !dest.contains( ":/" ) && !dest.startsWith( "/" ) ) + dest = ACTIVE_FUNC->files()->vfs_getOrigin() + "/" + dest; /* it's full path now */ + + krConfig->setGroup( "General" ); + QString edit = krConfig->readEntry( "Editor", _Editor ); + + if ( edit == "internal editor" ) + KrViewer::edit( KURL::fromPathOrURL( dest ), true ); + else { + KProcess proc; + proc << edit << dest; + if ( !proc.start( KProcess::DontCare ) ) + KMessageBox::sorry( krApp, i18n( "Can't open " ) + "\"" + edit + "\"" ); + } + } // nothing more to it! } #include "krslots.moc" diff --git a/krusader/krslots.h b/krusader/krslots.h index ec33f448..29c61253 100644 --- a/krusader/krslots.h +++ b/krusader/krslots.h @@ -1,135 +1,137 @@ /*************************************************************************** krslots.h ------------------- copyright : (C) 2001 by Shie Erlich & Rafi Yanai email : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- Description *************************************************************************** A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD H e a d e r F i l e *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KRSLOTS_H #define KRSLOTS_H #include // the 2 following #includes should go away with the ugly stubs on the bottom #include "krusader.h" #include "krusaderview.h" #include "Panel/listpanel.h" #include "BookMan/bookmarksbutton.h" #include "GUI/kcmdline.h" class ListPanel; class KRslots : public QObject { Q_OBJECT private: bool panel_swap; public: enum compareMode { full } ; KRslots() {panel_swap = false;} ~KRslots() {} public slots: void selectCompareMask(); void compareDirectories(); void sendFileByEmail( QString filename ); void compareContent(); void rightclickMenu(); void insertFileName(bool full_path); void toggleHidden(); void toggleSwapPanels(); void toggleSortByExt(); void configToolbar(); void configKeys(); void toggleToolbar(); void toggleStatusbar(); void toggleTerminal(); void home(); void root(); void dirUp(); void markAll(); void unmarkAll(); void markGroup(); void unmarkGroup(); void invert(); void refresh(); void refresh( QString p ); void properties(); void back(); void slotPack(); void slotUnpack(); void testArchive(); void calcSpace(); void FTPDisconnect(); void allFilter(); void execFilter(); void customFilter(); void newFTPconnection(); void newFTPconnection( QString host ); void runKonfigurator( bool firstTime = false ); void startKonfigurator() { runKonfigurator( false ); } void search(); // call the search module void homeTerminal(); void sysInfo(); void addBookmark(); void runMountMan(); void runRemoteMan(); void toggleFnkeys(); void toggleCmdline(); void changeTrashIcon(); void showAboutApplication(); void multiRename(); void openRightBookmarks() { krApp->mainView->right->bookmarksButton->openPopup(); } void openLeftBookmarks() { krApp->mainView->left->bookmarksButton->openPopup(); } void cmdlinePopup() { krApp->mainView->cmdLine->popup(); } // F2 void terminal(); // F3 void view(); // Shift F3 void viewDlg(); // F4 void edit(); + // Shift F4 + void editDlg(); // F5 void copyFiles(); // F6 void moveFiles(); // F7 void mkdir(); // F8 void deleteFiles(); // F9 void rename(); // ugly stubs, remove later ? void slotCurrentChanged( QString p ) { krApp->mainView->slotCurrentChanged( p ); } void slotSetActivePanel( ListPanel *p ) { krApp->mainView->slotSetActivePanel( p ); } }; #endif diff --git a/krusader/krusader.cpp b/krusader/krusader.cpp index 80a6683e..45690890 100644 --- a/krusader/krusader.cpp +++ b/krusader/krusader.cpp @@ -1,668 +1,672 @@ /*************************************************************************** krusader.cpp ------------------- copyright : (C) 2000 by Shie Erlich & Rafi Yanai e-mail : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- Description *************************************************************************** A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD S o u r c e F i l e *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include // KDE includes #include #include #include #include #include #include #include #include #include #include #include // QT includes #include #include #include #include #include #include #include // Krusader includes #include "krusader.h" #include "kicons.h" #include "VFS/krpermhandler.h" #include "GUI/krusaderstatus.h" #include "RemoteMan/remoteman.h" #include "Dialogs/krpleasewait.h" #include "krusaderview.h" #include "Panel/listpanel.h" #include "Panel/panelfunc.h" #include "Konfigurator/konfigurator.h" #include "MountMan/kmountman.h" #include "defaults.h" #include "resources.h" #include "GUI/kfnkeys.h" #include "GUI/kcmdline.h" #include "krslots.h" #include "krservices.h" // define the static members Krusader *Krusader::App = 0; KAction *Krusader::actProperties = 0; KAction *Krusader::actPack = 0; KAction *Krusader::actUnpack = 0; KAction *Krusader::actTest = 0; KAction *Krusader::actCompare = 0; KAction *Krusader::actCalculate = 0; KAction *Krusader::actSelect = 0; KAction *Krusader::actSelectAll = 0; KAction *Krusader::actUnselect = 0; KAction *Krusader::actUnselectAll = 0; KAction *Krusader::actInvert = 0; KAction *Krusader::actSync = 0; KAction *Krusader::actHomeTerminal = 0; KAction *Krusader::actFTPConnect = 0; KAction *Krusader::actFTPNewConnect = 0; KAction *Krusader::actFTPDisconnect = 0; KAction *Krusader::actMultiRename = 0; KAction *Krusader::actAllFilter = 0; KAction *Krusader::actExecFilter = 0; KAction *Krusader::actCustomFilter = 0; KAction *Krusader::actMountMan = 0; KAction *Krusader::actNewTool = 0; KAction *Krusader::actKonfigurator = 0; KAction *Krusader::actToolsSetup = 0; KAction *Krusader::actBack = 0; KAction *Krusader::actRoot = 0; KAction *Krusader::actFind = 0; //KAction *Krusader::actAddBookmark = 0; KAction *Krusader::actSavePosition = 0; KAction *Krusader::actSelectColorMask = 0; KAction *Krusader::actOpenLeftBm = 0; KAction *Krusader::actOpenRightBm = 0; KAction *Krusader::actDirUp = 0; KAction *Krusader::actCmdlinePopup = 0; KToggleAction *Krusader::actToggleTerminal = 0; bool showTrayIcon = false; // construct the views, statusbar and menu bars and prepare Krusader to start Krusader::Krusader() : KParts::MainWindow(), sysTray( 0 ) { // parse command line arguments KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); QString leftPath, rightPath; if (args->isSet("left")) leftPath = args->getOption("left"); else leftPath = QString::null; if (args->isSet("right")) rightPath = args->getOption("right"); else rightPath = QString::null; // create the "krusader" App = this; slot = new KRslots(); setXMLFile( "krusaderui.rc" ); // kpart-related xml file plzWait = new KRPleaseWaitHandler(); bool runKonfig = versionControl(); QString message; switch ( config->getConfigState() ) { case KConfigBase::NoAccess : message = "Krusader's configuration file can't be found. Default values will be used."; break; case KConfigBase::ReadOnly : message = "Krusader's configuration file is in READ ONLY mode (why is that !?) Changed values will not be saved"; break; case KConfigBase::ReadWrite : message = ""; break; } if ( message != "" ) { KMessageBox::error( krApp, message ); } // register with the dcop server DCOPClient* client = KApplication::kApplication() ->dcopClient(); if ( !client->attach() ) exit( 0 ); client->registerAs( KApplication::kApplication() ->name() ); // create an icon loader iconLoader = KGlobal::iconLoader(); // create MountMan mountMan = new MountMan::KMountMan(); // setup all the krusader's actions setupActions(); // init the permmision handler class KRpermHandler::init(); // create the main view and set it mainView = new KrusaderView( this ); mainView->start(leftPath, rightPath); // setup keyboard accelerators setupAccels(); // create a status bar status = new KrusaderStatus( this ); QWhatsThis::add( status, i18n( "Status bar will show basic informations " "about file below mouse pointer." ) ); // This enables Krusader to show a tray icon config->setGroup( "Look&Feel" ); if ( krConfig->readBoolEntry( "Minimize To Tray", _MinimizeToTray ) ) { showTrayIcon = true; sysTray = new KSystemTray( this ); sysTray->setPixmap( iconLoader->loadIcon( "krusader", KIcon::Panel, 22 ) ); sysTray->show(); } setCentralWidget( mainView ); config->setGroup( "Look&Feel" ); show(); // manage our keyboard short-cuts //KAcceleratorManager::manage(this,true); setCursor( KCursor::arrowCursor() ); // first, resize and move to starting point config->setGroup( "Private" ); move( krConfig->readPointEntry( "Start Position", _StartPosition ) ); resize( krConfig->readSizeEntry( "Start Size", _StartSize ) ); // let the good times rool :) updateGUI( true ); if ( runKonfig ) slot->runKonfigurator( true ); // refresh the right and left panels mainView->left->func->refresh(); mainView->right->func->refresh(); } Krusader::~Krusader() {} bool Krusader::versionControl() { bool retval = false; // create config file config = kapp->config(); QString oldVerText = config->readEntry( "Version", "200" ); oldVerText.truncate( oldVerText.find( "-" ) ); float oldVer = oldVerText.toFloat(); //kdDebug() << QString( "version = %1" ).arg( oldVer ) << endl; // older icompatible version if ( oldVer < ( 9 / 10 ) ) { 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." ) ); if ( !QDir::home().remove( ".kde/share/config/krusaderrc" ) ) { KMessageBox::error( krApp, i18n( "Unable to remove your krusaderrc file! Please remove it manually and rerun Krusader." ) ); exit( 1 ); } retval = true; config->reparseConfiguration(); } // first installation of krusader if ( oldVer == 100 ) { KMessageBox::information( krApp, i18n( "Welcome to Krusader, as this is your first run, Krusader will now run Konfigurator." ) ); retval = true; } config->writeEntry( "Version", VERSION ); config->sync(); return retval; } void Krusader::statusBarUpdate( QString& mess ) { // change the message on the statusbar for 2 seconds statusBar() ->message( mess, 5000 ); } void Krusader::showEvent ( QShowEvent *e ) { if (showTrayIcon) show(); // needed to make sure krusader is removed from // the taskbar when minimizing (system tray issue) else KParts::MainWindow::showEvent(e); } void Krusader::hideEvent ( QHideEvent *e ) { if (showTrayIcon) hide(); // needed to make sure krusader is removed from // the taskbar when minimizing (system tray issue) else KParts::MainWindow::hideEvent(e); } void Krusader::setupAccels() { accels = new KAccel( this ); // F2 accels->insert( "F2_Terminal", i18n( "F2 Terminal" ), QString::null, Key_F2, SLOTS, SLOT( terminal() ) ); // F3 accels->insert( "F3_View", i18n( "F3 View" ), QString::null, Key_F3, SLOTS, SLOT( view() ) ); // SHIFT+F3 accels->insert( "F3_ViewDlg", i18n( "F3 View Dialog" ), QString::null, SHIFT+Key_F3, SLOTS, SLOT( viewDlg() ) ); // F4 accels->insert( "F4_Edit", i18n( "F4 Edit" ), QString::null, Key_F4, SLOTS, SLOT( edit() ) ); + // SHIFT+F4 + accels->insert( "F4_EditDlg", i18n( "F4 Edit Dialog" ), QString::null, + SHIFT+Key_F4, SLOTS, SLOT( editDlg() ) ); // F5 accels->insert( "F5_Copy", i18n( "F5 Copy" ), QString::null, Key_F5, SLOTS, SLOT( copyFiles() ) ); // F6 accels->insert( "F6_Move", i18n( "F6 Move" ), QString::null, Key_F6, SLOTS, SLOT( moveFiles() ) ); // F7 accels->insert( "F7_Mkdir", i18n( "F7 Mkdir" ), QString::null, Key_F7, SLOTS, SLOT( mkdir() ) ); // F8 accels->insert( "F8_Delete", i18n( "F8 Delete" ), QString::null, Key_F8, SLOTS, SLOT( deleteFiles() ) ); // F9 accels->insert( "F9_Rename", i18n( "F9 Rename" ), QString::null, Key_F9, SLOTS, SLOT( rename() ) ); // F10 accels->insert( "F10_Quit", i18n( "F10 Quit" ), QString::null, Key_F10, this, SLOT( quitKrusader() ) ); // Tab accels->insert( "Tab-Switch panel", i18n( "Tab: switch panel" ), QString::null, Key_Tab, mainView, SLOT( panelSwitch() ) ); } // Moving from Pixmap actions to generic filenames - thanks to Carsten Pfeiffer void Krusader::setupActions() { // first come the TODO actions //actSync = 0;//new KAction(i18n("S&yncronize Dirs"), 0, this, 0, actionCollection(), "sync dirs"); //actNewTool = 0;//new KAction(i18n("&Add a new tool"), 0, this, 0, actionCollection(), "add tool"); //actToolsSetup = 0;//new KAction(i18n("&Tools Menu Setup"), 0, 0, this, 0, actionCollection(), "tools setup"); //KStdAction::print(SLOTS, 0,actionCollection(),"std_print"); // second, the KDE standard action //KStdAction::up( SLOTS, SLOT( dirUp() ), actionCollection(), "std_up" )->setShortcut(Key_Backspace); KStdAction::home( SLOTS, SLOT( home() ), actionCollection(), "std_home" )->setShortcut(Key_QuoteLeft); + KStdAction::openNew( SLOTS, SLOT( editDlg() ), actionCollection(), "std_open_new" ); KAction *actRedisplay = KStdAction::redisplay( SLOTS, SLOT( refresh() ), actionCollection(), "std_redisplay" ); actRedisplay->setText( "Reload" ); actRedisplay->setShortcut( CTRL + Key_R ); actShowToolBar = KStdAction::showToolbar( SLOTS, SLOT( toggleToolbar() ), actionCollection(), "std_toolbar" ); actShowStatusBar = KStdAction::showStatusbar( SLOTS, SLOT( toggleStatusbar() ), actionCollection(), "std_statusbar" ); KStdAction::quit( this, SLOT( quitKrusader() ), actionCollection(), "std_quit" ); KStdAction::configureToolbars( SLOTS, SLOT( configToolbar() ), actionCollection(), "std_config_toolbar" ); KStdAction::keyBindings( SLOTS, SLOT( configKeys() ), actionCollection(), "std_config_keys" ); // the toggle actions actCompareDirs = new KToggleAction( i18n( "Com&pare Mode" ), "kr_comparedirs", CTRL + Key_Equal, SLOTS, SLOT( compareDirectories() ), actionCollection(), "compare mode" ); actCompareDirs->setChecked( false ); actToggleFnkeys = new KToggleAction( i18n( "Show &FN Keys Bar" ), 0, SLOTS, SLOT( toggleFnkeys() ), actionCollection(), "toggle fn bar" ); actToggleFnkeys->setChecked( true ); actToggleCmdline = new KToggleAction( i18n( "Show &Command Line" ), 0, SLOTS, SLOT( toggleCmdline() ), actionCollection(), "toggle command line" ); actToggleCmdline->setChecked( true ); actToggleTerminal = new KToggleAction( i18n( "Show &Terminal Emulator" ), 0, SLOTS, SLOT( toggleTerminal() ), actionCollection(), "toggle terminal emulator" ); actToggleTerminal->setChecked( false ); actToggleHidden = new KToggleAction( i18n( "Show &Hidden Files" ), CTRL + Key_Period, SLOTS, SLOT( toggleHidden() ), actionCollection(), "toggle hidden files" ); actToggleSwapPanels = new KToggleAction( i18n( "S&wap Panels" ), CTRL + Key_U, SLOTS, SLOT( toggleSwapPanels() ), actionCollection(), "toggle swap panels" ); actToggleSortByExt = new KToggleAction( i18n( "Sort By E&xtention" ), 0, SLOTS, SLOT( toggleSortByExt() ), actionCollection(), "toggle sort by extention" ); krConfig->setGroup( "Look&Feel" ); actToggleHidden->setChecked( krConfig->readBoolEntry( "Show Hidden", _ShowHidden ) ); actToggleSwapPanels->setChecked( false ); actToggleSortByExt->setChecked( krConfig->readBoolEntry( "Sort By Extention", _SortByExt ) ); // and then the DONE actions actCmdlinePopup = new KAction( i18n("popup cmdline"), 0, CTRL + Key_Slash, SLOTS, SLOT(cmdlinePopup()), actionCollection(), "cmdline popup"); actDirUp = new KAction( i18n("Up"), "up", Key_Backspace, SLOTS, SLOT(dirUp()), actionCollection(), "dirUp"); actSelectColorMask = new KAction( i18n( "Co&nfigure compare-mode" ), 0, SLOTS, SLOT( selectCompareMask() ), actionCollection(), "select colormask" ); actTest = new KAction( i18n( "&Test Archive(s)" ), "kr_arc_test", ALT + Key_T, SLOTS, SLOT( testArchive() ), actionCollection(), "test archives" ); // actFTPConnect = new KAction( i18n( "&Net Connections" ), "socket", CTRL + Key_C, // SLOTS, SLOT( runRemoteMan() ), actionCollection(), "ftp connect" ); actFTPNewConnect = new KAction( i18n( "New Net &Connection" ), "ftp", CTRL + Key_N, SLOTS, SLOT( newFTPconnection() ), actionCollection(), "ftp new connection" ); actCalculate = new KAction( i18n( "Calculate &Occupied Space" ), "kr_calc", 0, SLOTS, SLOT( calcSpace() ), actionCollection(), "calculate" ); actProperties = new KAction( i18n( "&Properties" ), "kr_properties", 0, SLOTS, SLOT( properties() ), actionCollection(), "properties" ); actPack = new KAction( i18n( "Pac&k" ), "kr_arc_pack", ALT + Key_P, SLOTS, SLOT( slotPack() ), actionCollection(), "pack" ); actUnpack = new KAction( i18n( "&Unpack" ), "kr_arc_unpack", ALT + Key_U, SLOTS, SLOT( slotUnpack() ), actionCollection() , "unpack" ); actSelect = new KAction( i18n( "Select &Group" ), "kr_select", CTRL + Key_Plus, SLOTS, SLOT( markGroup() ), actionCollection(), "select group" ); actSelectAll = new KAction( i18n( "&Select All" ), "kr_selectall", ALT + Key_Plus, SLOTS, SLOT( markAll() ), actionCollection(), "select all" ); actUnselectAll = new KAction( i18n( "U&nselect All" ), "kr_unselectall", ALT + Key_Minus, SLOTS, SLOT( unmarkAll() ), actionCollection(), "unselect all" ); actHomeTerminal = new KAction( i18n( "&Terminal" ), "kr_terminal", 0, SLOTS, SLOT( homeTerminal() ), actionCollection(), "terminal@home" ); actFTPDisconnect = new KAction( i18n( "Disconnect &From Net" ), "kr_ftp_disconnect", SHIFT + CTRL + Key_F, SLOTS, SLOT( FTPDisconnect() ), actionCollection(), "ftp disconnect" ); actMountMan = new KAction( i18n( "&MountMan" ), "kcmpartitions", ALT + Key_Slash, SLOTS, SLOT( runMountMan() ), actionCollection(), "mountman" ); actFind = new KAction( i18n( "&Search" ), "filefind", CTRL + Key_S, SLOTS, SLOT( search() ), actionCollection(), "find" ); actInvert = new KAction( i18n( "&Invert Selection" ), "kr_invert", ALT + Key_Asterisk, SLOTS, SLOT( invert() ), actionCollection(), "invert" ); actUnselect = new KAction( i18n( "&Unselect Group" ), "kr_unselect", CTRL + Key_Minus, SLOTS, SLOT( unmarkGroup() ), actionCollection(), "unselect group" ); actKonfigurator = new KAction( i18n( "&Konfigurator" ), "configure", 0, SLOTS, SLOT( startKonfigurator() ), actionCollection(), "konfigurator" ); actBack = new KAction( i18n( "Back" ), "back", 0, SLOTS, SLOT( back() ), actionCollection(), "back" ); actRoot = new KAction( i18n( "Root" ), "top", CTRL + Key_Backspace, SLOTS, SLOT( root() ), actionCollection(), "root" ); actSavePosition = new KAction( i18n( "Save &Position" ), 0, krApp, SLOT( savePosition() ), actionCollection(), "save position" ); actAllFilter = new KAction( i18n( "&All Files" ), SHIFT + Key_F10, SLOTS, SLOT( allFilter() ), actionCollection(), "all files" ); actExecFilter = new KAction( i18n( "&Executables" ), SHIFT + Key_F11, SLOTS, SLOT( execFilter() ), actionCollection(), "exec files" ); actCustomFilter = new KAction( i18n( "&Custom" ), SHIFT + Key_F12, SLOTS, SLOT( customFilter() ), actionCollection(), "custom files" ); actCompare = new KAction( i18n( "Compare b&y content" ), "proxy", 0, SLOTS, SLOT( compareContent() ), actionCollection(), "compare" ); actMultiRename = new KAction( i18n( "Multi &Rename" ), "krename", SHIFT + Key_F9, SLOTS, SLOT( multiRename() ), actionCollection(), "multirename" ); new KAction( i18n( "Right-click menu" ), Key_Menu, SLOTS, SLOT( rightclickMenu() ), actionCollection(), "rightclick menu" ); new KAction( i18n( "Right bookmarks" ), ALT+Key_Right, SLOTS, SLOT( openRightBookmarks() ), actionCollection(), "right bookmarks" ); new KAction( i18n( "Left bookmarks" ), ALT+Key_Left, SLOTS, SLOT( openLeftBookmarks() ), actionCollection(), "left bookmarks" ); // and at last we can set the tool-tips actSelect->setToolTip( i18n( "Highlight files by using a filter" ) ); actSelectAll->setToolTip( i18n( "Highlight all the files in the current directory" ) ); actUnselectAll->setToolTip( i18n( "Remove selection from all highlight files" ) ); actMountMan->setToolTip( i18n( "Mount.Man: Krusader's mount-manager. Try it!" ) ); actKonfigurator->setToolTip( i18n( "Setup Krusader the way you like it" ) ); actBack->setToolTip( i18n( "Back to the place you came from" ) ); actRoot->setToolTip( i18n( "ROOT (/)" ) ); actFind->setToolTip( i18n( "Search for files" ) ); } /////////////////////////////////////////////////////////////////////////// //////////////////// implementation of slots ////////////////////////////// /////////////////////////////////////////////////////////////////////////// void Krusader::savePosition() { config->setGroup( "Private" ); config->writeEntry( "Start Position", pos() ); config->writeEntry( "Start Size", size() ); config->writeEntry( "Panel Size", mainView->vert_splitter->sizes() [ 0 ] ); config->writeEntry( "Terminal Size", mainView->vert_splitter->sizes() [ 1 ] ); QValueList lst = mainView->horiz_splitter->sizes(); config->writeEntry( "Splitter Sizes", lst ); // save view settings ---> fix when we have tabbed-browsing mainView->left->view->saveSettings(); mainView->right->view->saveSettings(); config->sync(); } void Krusader::saveSettings() { toolBar() ->saveSettings( krConfig, "Private" ); config->setGroup( "Startup" ); bool panelsavesettings = config->readBoolEntry( "Panels Save Settings", _PanelsSave ); bool rememberpos = config->readBoolEntry( "Remember Position", _RememberPos ); bool uisavesettings = config->readBoolEntry( "UI Save Settings", _UiSave ); if ( panelsavesettings ) { // left panel config->writeEntry( "Left Panel Type", i18n( "List" ) ); config->writeEntry( "Left Panel Origin", i18n( "the last place it was" ) ); // right panel config->writeEntry( "Right Panel Type", i18n( "List" ) ); config->writeEntry( "Right Panel Origin", i18n( "the last place it was" ) ); } config->writeEntry( "lastHomeLeft", mainView->left->realPath ); config->writeEntry( "lastHomeRight", mainView->right->realPath ); // save size and position if ( rememberpos || uisavesettings ) { savePosition(); } // save the gui if ( uisavesettings ) { config->writeEntry( "Show status bar", actShowStatusBar->isChecked() ); config->writeEntry( "Show tool bar", actShowToolBar->isChecked() ); config->writeEntry( "Show FN Keys", actToggleFnkeys->isChecked() ); config->writeEntry( "Show Cmd Line", actToggleCmdline->isChecked() ); config->writeEntry( "Show Terminal Emulator", actToggleTerminal->isChecked() ); } config->sync(); } void Krusader::refreshView() { delete mainView; mainView = new KrusaderView( this ); setCentralWidget( mainView ); config->setGroup( "Private" ); resize( krConfig->readSizeEntry( "Start Size", _StartSize ) ); move( krConfig->readPointEntry( "Start Position", _StartPosition ) ); mainView->show(); show(); } bool Krusader::queryClose() { bool quit = true; krConfig->setGroup( "Look&Feel" ); if ( krConfig->readBoolEntry( "Warn On Exit", _WarnOnExit ) ) { switch ( KMessageBox::warningYesNo( this, i18n( "Ok to shutdown Krusader ?" ) ) ) { case KMessageBox::Yes : quit = true; break; case KMessageBox::No : quit = false; break; default: quit = false; } } if (quit) { // close all open VFS delete krApp->mainView->left->func; delete krApp->mainView->right->func; saveSettings(); delete krApp->mainView; return true; } else return false; } void Krusader::quitKrusader() { if ( queryClose() ) { kapp->quit(); } } // the please wait dialog functions void Krusader::startWaiting( QString msg, int count , bool cancel ) { plzWait->startWaiting( msg , count, cancel ); } void Krusader::incProgress( KProcess *, char *buffer, int buflen ) { int howMuch = 0; for ( int i = 0 ; i < buflen; ++i ) if ( buffer[ i ] == '\n' ) ++howMuch; plzWait->incProgress( howMuch ); } void Krusader::stopWait() { plzWait->stopWait(); } void Krusader::updateGUI( bool enforce ) { // now, check if we need to create a konsole_part config->setGroup( "Startup" ); if ( config->readBoolEntry( "Show Terminal Emulator", _ShowTerminalEmulator ) ) { if ( enforce ) { mainView->slotTerminalEmulator( true ); // create konsole_part config->setGroup( "Private" ); QValueList lst; lst.append( config->readNumEntry( "Panel Size", _PanelSize ) ); lst.append( config->readNumEntry( "Terminal Size", _TerminalSize ) ); mainView->vert_splitter->setSizes( lst ); config->setGroup( "Startup" ); } } // call the XML GUI function to draw the UI createGUI( mainView->konsole_part ); toolBar() ->applySettings( krConfig, "Private" ); if ( enforce ) { // now, hide what need to be hidden if ( !krConfig->readBoolEntry( "Show tool bar", _ShowToolBar ) ) { toolBar() ->hide(); actShowToolBar->setChecked( false ); } else { toolBar() ->show(); actShowToolBar->setChecked( true ); } if ( !krConfig->readBoolEntry( "Show status bar", _ShowStatusBar ) ) { statusBar() ->hide(); actShowStatusBar->setChecked( false ); } else { statusBar() ->show(); actShowStatusBar->setChecked( true ); } if ( !krConfig->readBoolEntry( "Show Cmd Line", _ShowCmdline ) ) { mainView->cmdLine->hide(); actToggleCmdline->setChecked( false ); } else { mainView->cmdLine->show(); actToggleCmdline->setChecked( true ); } if ( !krConfig->readBoolEntry( "Show FN Keys", _ShowFNkeys ) ) { mainView->fnKeys->hide(); actToggleFnkeys->setChecked( false ); } else { mainView->fnKeys->show(); actToggleFnkeys->setChecked( true ); } } } // return a list in the format of TOOLS,PATH. for example // DIFF,kdiff,TERMINAL,konsole,... // // currently supported tools: DIFF, MAIL, RENAME // // to use it: QStringList lst = supportedTools(); // int i = lst.findIndex("DIFF"); // if (i!=-1) pathToDiff=lst[i+1]; QStringList Krusader::supportedTools() { QStringList tools; // first, a diff program: kdiff if ( KrServices::cmdExist( "kdiff" ) ) { tools.append( "DIFF" ); tools.append( "kdiff" ); } else if ( KrServices::cmdExist( "kompare" ) ) { tools.append( "DIFF" ); tools.append( "kompare" ); } else if ( KrServices::cmdExist( "xxdiff" ) ) { tools.append( "DIFF" ); tools.append( "xxdiff" ); } // a mailer: kmail if ( KrServices::cmdExist( "kmail" ) ) { tools.append( "MAIL" ); tools.append( "kmail" ); } // rename tool: krename if ( KrServices::cmdExist( "krename" ) ) { tools.append( "RENAME" ); tools.append( "krename" ); } return tools; } QString Krusader::getTempDir() { // try to make krusader temp dir krConfig->setGroup( "General" ); QString tmpDir = krConfig->readEntry( "Temp Directory", _TempDirectory ); for ( int i = 1 ; i != -1 ; i = tmpDir.find( '/', i + 1 ) ) QDir().mkdir( tmpDir.left( i ) ); QDir().mkdir( tmpDir ); chmod( tmpDir.local8Bit(), 0777 ); // add a secure sub dir under the user UID QString uid; uid.sprintf( "%d", getuid() ); QDir( tmpDir ).mkdir( uid ); tmpDir = tmpDir + "/" + uid + "/"; chmod( tmpDir.local8Bit(), S_IRUSR | S_IWUSR | S_IXUSR ); // add a random sub dir to use while ( QDir().exists( tmpDir ) ) tmpDir = tmpDir + kapp->randomString( 8 ); QDir().mkdir( tmpDir ); if ( !QDir( tmpDir ).isReadable() ) { KMessageBox::error( krApp, "Could not create a temporary directory. Handling of Archives will not be possible until this is fixed." ); return QString::null; } return tmpDir; } QString Krusader::getTempFile() { // try to make krusader temp dir krConfig->setGroup( "General" ); QString tmpDir = krConfig->readEntry( "Temp Directory", _TempDirectory ); for ( int i = 1 ; i != -1 ; i = tmpDir.find( '/', i + 1 ) ) QDir().mkdir( tmpDir.left( i ) ); QDir().mkdir( tmpDir ); chmod( tmpDir.local8Bit(), 0777 ); // add a secure sub dir under the user UID QString uid; uid.sprintf( "%d", getuid() ); QDir( tmpDir ).mkdir( uid ); tmpDir = tmpDir + "/" + uid + "/"; chmod( tmpDir.local8Bit(), S_IRUSR | S_IWUSR | S_IXUSR ); while ( QDir().exists( tmpDir ) ) tmpDir = tmpDir + kapp->randomString( 8 ); return tmpDir; } #include "krusader.moc" diff --git a/krusader/krusaderui.rc b/krusader/krusaderui.rc index 12666e56..d55e1258 100644 --- a/krusader/krusaderui.rc +++ b/krusader/krusaderui.rc @@ -1,102 +1,104 @@ &File + &Mark &Commands &View &Tools &Settings &Help + # # #