From 50e51d1622c551ebc287861dc4c307b9859a9568 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 17 Feb 2016 13:06:45 +0700 Subject: Added support for xz archives. This resolve bug 2516. Signed-off-by: Michele Calgaro --- krusader/Dialogs/packgui.cpp | 6 +- krusader/Konfigurator/kgarchives.cpp | 10 +- krusader/Konfigurator/kgdependencies.cpp | 3 +- krusader/Konfigurator/kggeneral.cpp | 9 +- krusader/Konfigurator/kgprotocols.cpp | 113 +++++++++++----------- krusader/Konfigurator/krresulttable.cpp | 31 +++--- krusader/Panel/krbriefview.cpp | 79 +++++++-------- krusader/Panel/krdetailedview.cpp | 107 +++++++++++---------- krusader/Panel/krviewitem.cpp | 21 ++-- krusader/Panel/panelfunc.cpp | 76 +++++++-------- krusader/VFS/krarchandler.cpp | 160 +++++++++++++++++++------------ krusader/defaults.h | 136 +++++++++++++------------- krusader/krusader.cpp | 85 +++++++++------- 13 files changed, 450 insertions(+), 386 deletions(-) (limited to 'krusader') diff --git a/krusader/Dialogs/packgui.cpp b/krusader/Dialogs/packgui.cpp index e57af8e..e479060 100644 --- a/krusader/Dialogs/packgui.cpp +++ b/krusader/Dialogs/packgui.cpp @@ -5,10 +5,10 @@ e-mail : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- - Description + Description *************************************************************************** - A + 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 @@ -63,11 +63,13 @@ PackGUI::PackGUI(TQString defaultName, TQString defaultPath, int noOfFiles, TQSt if (PS("tar")) typeData->insertItem("tar"); if (PS("tar") && PS("gzip")) typeData->insertItem("tar.gz"); if (PS("tar") && PS("bzip2")) typeData->insertItem("tar.bz2"); + if (PS("tar") && PS("xz")) typeData->insertItem("tar.xz"); if (PS("zip")) typeData->insertItem("zip"); if (PS("rar")) typeData->insertItem("rar"); if (PS("lha")) typeData->insertItem("lha"); if (PS("arj")) typeData->insertItem("arj"); if (PS("7z")) typeData->insertItem("7z"); + if (PS("xz")) typeData->insertItem("xz"); // set the last used packer as the top one TQString tmp=krConfig->readEntry("lastUsedPacker",TQString()); if (tmp!=TQString()) { diff --git a/krusader/Konfigurator/kgarchives.cpp b/krusader/Konfigurator/kgarchives.cpp index a4ea958..f31d719 100644 --- a/krusader/Konfigurator/kgarchives.cpp +++ b/krusader/Konfigurator/kgarchives.cpp @@ -66,10 +66,11 @@ KgArchives::KgArchives( bool first, TQWidget* parent, const char* name ) : {"Archives","Do UnAce", _DoUnAce, i18n( "Ace" ), false, ""}, {"Archives","Do Lha", _DoLha, i18n( "Lha" ), false, ""}, {"Archives","Do DEB", _DoDEB, i18n( "Deb" ), false, ""}, - {"Archives","Do 7z", _Do7z, i18n( "7zip" ), false, ""} + {"Archives","Do 7z", _Do7z, i18n( "7zip" ), false, ""}, + {"Archives","Do Xz", _DoXz, i18n( "Xz" ), false, ""} }; - cbs = createCheckBoxGroup( 3, 0, packers, 11, generalGrp ); + cbs = createCheckBoxGroup( 3, 0, packers, 12, generalGrp ); generalGrid->addWidget( cbs, 1, 0 ); addLabel( generalGrid, 2, 0, i18n( "The archives that are \"greyed-out\" were unavailable on your\nsystem last time Krusader checked. If you wish Krusader to\nsearch again, click the 'Auto Configure' button." ), @@ -81,7 +82,7 @@ KgArchives::KgArchives( bool first, TQWidget* parent, const char* name ) : createSpacer( hbox, "spacer2" ); generalGrid->addWidget( hbox, 3, 0 ); connect( btnAutoConfigure, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAutoConfigure() ) ); - + kgArchivesLayout->addWidget( generalGrp, 0 ,0 ); // ------------------------ FINE-TUNING GROUPBOX -------------------------------- @@ -101,7 +102,7 @@ KgArchives::KgArchives( bool first, TQWidget* parent, const char* name ) : fineTuneGrid->addWidget( finetunes, 1, 0 ); kgArchivesLayout->addWidget( fineTuneGrp, 1 ,0 ); - + if( first ) slotAutoConfigure(); @@ -133,6 +134,7 @@ void KgArchives::disableNonExistingPackers() cbs->find( "Do Unarj" )->setEnabled(PS("unarj") || PS("arj") ); cbs->find( "Do DEB" )->setEnabled(PS("dpkg") && PS("tar") ); cbs->find( "Do 7z" )->setEnabled( PS("7z") ); + cbs->find( "Do Xz" )->setEnabled(PS("xz")); krConfig->setGroup( "Archives" ); krConfig->writeEntry( "Supported Packers", lst ); diff --git a/krusader/Konfigurator/kgdependencies.cpp b/krusader/Konfigurator/kgdependencies.cpp index 839b721..25da574 100644 --- a/krusader/Konfigurator/kgdependencies.cpp +++ b/krusader/Konfigurator/kgdependencies.cpp @@ -56,7 +56,7 @@ KgDependencies::KgDependencies( bool first, TQWidget* parent, const char* name pathsGrid->setSpacing( 6 ); pathsGrid->setMargin( 11 ); pathsGrid->setAlignment( TQt::AlignTop ); - + addApplication( "df", pathsGrid, 0, general_tab, PAGE_GENERAL ); addApplication( "eject", pathsGrid, 1, general_tab, PAGE_GENERAL ); addApplication( "tdesu", pathsGrid, 2, general_tab, PAGE_GENERAL ); @@ -93,6 +93,7 @@ KgDependencies::KgDependencies( bool first, TQWidget* parent, const char* name addApplication( "unrar", archGrid1,11, packers_tab, PAGE_PACKERS ); addApplication( "unzip", archGrid1,12, packers_tab, PAGE_PACKERS ); addApplication( "zip", archGrid1,13, packers_tab, PAGE_PACKERS ); + addApplication( "xz", archGrid1,14, packers_tab, PAGE_PACKERS ); // ---------------------------- CHECKSUM TAB ------------------------------------- TQWidget *checksum_tab = new TQWidget( tabWidget, "tab_4" ); diff --git a/krusader/Konfigurator/kggeneral.cpp b/krusader/Konfigurator/kggeneral.cpp index ba0429c..f2a9f36 100644 --- a/krusader/Konfigurator/kggeneral.cpp +++ b/krusader/Konfigurator/kggeneral.cpp @@ -44,7 +44,7 @@ KgGeneral::KgGeneral( bool first, TQWidget* parent, const char* name ) : KonfiguratorPage( first, parent, name ) { -if( first ) +if( first ) slotFindTools(); TQGridLayout *kgGeneralLayout = new TQGridLayout( parent ); @@ -91,11 +91,11 @@ TQFrame *line2 = createLine( generalGrp, "line2" ); TQVBox * vbox = new TQVBox( hbox2 ); new TQLabel( i18n("Default viewer mode:"), vbox); - + KONFIGURATOR_NAME_VALUE_TIP viewMode[] = // name value tooltip {{ i18n( "Generic mode" ), "generic", i18n( "Use the system's default viewer" ) }, - { i18n( "Text mode" ), "text", i18n( "View the file in text-only mode" ) }, + { i18n( "Text mode" ), "text", i18n( "View the file in text-only mode" ) }, { i18n( "Hex mode" ), "hex", i18n( "View the file in hex-mode (better for binary files)" ) } }; createRadioButtonGroup( "General", "Default Viewer Mode", "generic", 0, 3, viewMode, 3, vbox, "myRadio2", false ); @@ -132,8 +132,9 @@ TQFrame *line2 = createLine( generalGrp, "line2" ); defaultAtomicExtensions += ".tar.gz"; defaultAtomicExtensions += ".tar.bz2"; defaultAtomicExtensions += ".moc.cpp"; + defaultAtomicExtensions += ".tar.xz"; - listBox = createListBox( "Look&Feel", "Atomic Extensions", + listBox = createListBox( "Look&Feel", "Atomic Extensions", defaultAtomicExtensions, vbox2, true, false ); TQFrame *line3 = createLine( generalGrp, "line3" ); diff --git a/krusader/Konfigurator/kgprotocols.cpp b/krusader/Konfigurator/kgprotocols.cpp index 2a5439e..fb3cd9f 100644 --- a/krusader/Konfigurator/kgprotocols.cpp +++ b/krusader/Konfigurator/kgprotocols.cpp @@ -51,10 +51,11 @@ TQString KgProtocols::defaultKrarcMimes = "application/x-7z,application/x-7z-com "application/x-lha,application/x-lha-compressed," "application/x-rar,application/x-rar-compressed," "application/x-rpm," + "application/x-xz," "application/x-zip,application/x-zip-compressed"; -TQString KgProtocols::defaultTarMimes = "application/x-tar,application/x-tarz," +TQString KgProtocols::defaultTarMimes = "application/x-tar,application/x-tarz," "application/x-compressed-tar," - "application/x-tbz,application/x-tgz"; + "application/x-tbz,application/x-tgz,application/x-txz"; KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : KonfiguratorPage( first, parent, name ) @@ -63,22 +64,22 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : KgProtocolsLayout->setSpacing( 6 ); // -------------------------- LINK VIEW ---------------------------------- - - TQGroupBox *linkGrp = createFrame( i18n( "Links" ), parent, "linkGrp" ); + + TQGroupBox *linkGrp = createFrame( i18n( "Links" ), parent, "linkGrp" ); TQGridLayout *linkGrid = createGridLayout( linkGrp->layout() ); - + linkList = new TQListView( linkGrp, "linkList" ); linkList->addColumn( i18n( "Defined Links" ) ); linkList->header()->setStretchEnabled( true, 0 ); linkList->setRootIsDecorated( true ); - + linkGrid->addWidget( linkList, 0, 0 ); KgProtocolsLayout->addMultiCellWidget( linkGrp, 0 ,1, 0, 0 ); // -------------------------- BUTTONS ---------------------------------- TQVBox *vbox1 = new TQVBox( parent, "vbox1" ) ; - + addSpacer( vbox1 ); btnAddProtocol = new TQPushButton( vbox1, "btnAddProtocolButton" ); btnAddProtocol->setPixmap( krLoader->loadIcon( "1leftarrow", TDEIcon::Small ) ); @@ -87,11 +88,11 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : btnRemoveProtocol->setPixmap( krLoader->loadIcon( "1rightarrow", TDEIcon::Small ) ); TQWhatsThis::add( btnRemoveProtocol, i18n( "Remove protocol from the link list." ) ); addSpacer( vbox1 ); - + KgProtocolsLayout->addWidget( vbox1, 0 ,1 ); TQVBox *vbox2 = new TQVBox( parent, "vbox2" ) ; - + addSpacer( vbox2 ); btnAddMime = new TQPushButton( vbox2, "btnAddMimeButton" ); btnAddMime->setPixmap( krLoader->loadIcon( "1leftarrow", TDEIcon::Small ) ); @@ -100,14 +101,14 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : btnRemoveMime->setPixmap( krLoader->loadIcon( "1rightarrow", TDEIcon::Small ) ); TQWhatsThis::add( btnRemoveMime, i18n( "Remove mime from the link list." ) ); addSpacer( vbox2 ); - + KgProtocolsLayout->addWidget( vbox2, 1 ,1 ); - + // -------------------------- PROTOCOLS LISTBOX ---------------------------------- - TQGroupBox *protocolGrp = createFrame( i18n( "Protocols" ), parent, "protocolGrp" ); + TQGroupBox *protocolGrp = createFrame( i18n( "Protocols" ), parent, "protocolGrp" ); TQGridLayout *protocolGrid = createGridLayout( protocolGrp->layout() ); - + protocolList = new TQListBox( protocolGrp, "protocolList" ); loadListCapableProtocols(); protocolGrid->addWidget( protocolList, 0, 0 ); @@ -116,17 +117,17 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : // -------------------------- MIMES LISTBOX ---------------------------------- - TQGroupBox *mimeGrp = createFrame( i18n( "Mimes" ), parent, "mimeGrp" ); + TQGroupBox *mimeGrp = createFrame( i18n( "Mimes" ), parent, "mimeGrp" ); TQGridLayout *mimeGrid = createGridLayout( mimeGrp->layout() ); - + mimeList = new TQListBox( mimeGrp, "protocolList" ); loadMimes(); mimeGrid->addWidget( mimeList, 0, 0 ); KgProtocolsLayout->addWidget( mimeGrp, 1 ,2 ); - - // -------------------------- CONNECT TABLE ---------------------------------- - + + // -------------------------- CONNECT TABLE ---------------------------------- + connect( protocolList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotDisableButtons() ) ); connect( linkList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotDisableButtons() ) ); connect( mimeList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotDisableButtons() ) ); @@ -135,11 +136,11 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : connect( btnRemoveProtocol, TQT_SIGNAL( clicked() ) , this, TQT_SLOT( slotRemoveProtocol() ) ); connect( btnAddMime, TQT_SIGNAL( clicked() ) , this, TQT_SLOT( slotAddMime() ) ); connect( btnRemoveMime, TQT_SIGNAL( clicked() ) , this, TQT_SLOT( slotRemoveMime() ) ); - + loadInitialValues(); slotDisableButtons(); } - + TQWidget* KgProtocols::addSpacer( TQWidget *parent, const char *widgetName ) { TQWidget *widget = new TQWidget( parent, widgetName ); @@ -153,8 +154,8 @@ void KgProtocols::loadListCapableProtocols() { TQStringList protocols = KProtocolInfo::protocols(); protocols.sort(); - - for ( TQStringList::Iterator it = protocols.begin(); it != protocols.end();) + + for ( TQStringList::Iterator it = protocols.begin(); it != protocols.end();) { if( !KProtocolInfo::supportsListing( *it ) ) { @@ -169,10 +170,10 @@ void KgProtocols::loadListCapableProtocols() void KgProtocols::loadMimes() { KMimeType::List mimes = KMimeType::allMimeTypes(); - + for( TQValueListIterator it = mimes.begin(); it != mimes.end(); it++ ) mimeList->insertItem( (*it)->name() ); - + mimeList->sort(); } @@ -184,7 +185,7 @@ void KgProtocols::slotDisableButtons() btnRemoveProtocol->setEnabled( isProtocolSelected ); btnAddMime->setEnabled( listViewItem != 0 && mimeList->selectedItem() != 0 ); btnRemoveMime->setEnabled( listViewItem == 0 ? false : listViewItem->parent() != 0 ); - + if( linkList->currentItem() == 0 && linkList->firstChild() != 0 ) linkList->setCurrentItem( linkList->firstChild() ); if( linkList->selectedItem() == 0 && linkList->currentItem() != 0 ) @@ -210,7 +211,7 @@ void KgProtocols::addProtocol( TQString name, bool changeCurrent ) protocolList->removeItem( protocolList->index( item ) ); TQListViewItem *listViewItem = new TQListViewItem( linkList, name ); listViewItem->setPixmap( 0, krLoader->loadIcon( "application-x-executable", TDEIcon::Small ) ); - + if( changeCurrent ) linkList->setCurrentItem( listViewItem ); } @@ -234,7 +235,7 @@ void KgProtocols::removeProtocol( TQString name ) { while( item->childCount() != 0 ) removeMime( item->firstChild()->text( 0 ) ); - + linkList->takeItem( item ); protocolList->insertItem( name ); protocolList->sort(); @@ -249,7 +250,7 @@ void KgProtocols::slotAddMime() TQListViewItem *itemToAdd = linkList->currentItem(); if( itemToAdd->parent() ) itemToAdd = itemToAdd->parent(); - + addMime( item->text(), itemToAdd->text( 0 ) ); slotDisableButtons(); emit sigChanged(); @@ -260,7 +261,7 @@ void KgProtocols::addMime( TQString name, TQString protocol ) { TQListBoxItem *item = mimeList->findItem( name, ExactMatch ); TQListViewItem *currentListItem = linkList->findItem( protocol, 0 ); - + if( item && currentListItem && currentListItem->parent() == 0 ) { mimeList->removeItem( mimeList->index( item ) ); @@ -284,7 +285,7 @@ void KgProtocols::slotRemoveMime() void KgProtocols::removeMime( TQString name ) { TQListViewItem *currentMimeItem = linkList->findItem( name, 0 ); - + if( currentMimeItem && currentMimeItem->parent() != 0 ) { mimeList->insertItem( currentMimeItem->text( 0 ) ); @@ -297,20 +298,20 @@ void KgProtocols::loadInitialValues() { while( linkList->childCount() != 0 ) removeProtocol( linkList->firstChild()->text( 0 ) ); - + krConfig->setGroup( "Protocols" ); TQStringList protList = krConfig->readListEntry( "Handled Protocols" ); - - for( TQStringList::Iterator it = protList.begin(); it != protList.end(); it++ ) + + for( TQStringList::Iterator it = protList.begin(); it != protList.end(); it++ ) { addProtocol( *it ); - + TQStringList mimes = krConfig->readListEntry( TQString( "Mimes For %1" ).arg( *it ) ); - + for( TQStringList::Iterator it2 = mimes.begin(); it2 != mimes.end(); it2++ ) addMime( *it2, *it ); } - + if( linkList->firstChild() != 0 ) linkList->setCurrentItem( linkList->firstChild() ); slotDisableButtons(); @@ -320,22 +321,22 @@ void KgProtocols::setDefaults() { while( linkList->childCount() != 0 ) removeProtocol( linkList->firstChild()->text( 0 ) ); - + addProtocol( "iso" ); addMime( "application/x-iso", "iso" ); - + addProtocol( "krarc" ); TQStringList krarcMimes = TQStringList::split( ',', defaultKrarcMimes ); for( TQStringList::Iterator it = krarcMimes.begin(); it != krarcMimes.end(); it++ ) addMime( *it, "krarc" ); - + addProtocol( "tar" ); TQStringList tarMimes = TQStringList::split( ',', defaultTarMimes ); for( TQStringList::Iterator it = tarMimes.begin(); it != tarMimes.end(); it++ ) addMime( *it, "tar" ); - + slotDisableButtons(); - + if( isChanged() ) emit sigChanged(); } @@ -344,18 +345,18 @@ bool KgProtocols::isChanged() { krConfig->setGroup( "Protocols" ); TQStringList protList = krConfig->readListEntry( "Handled Protocols" ); - + if( (int)protList.count() != linkList->childCount() ) return true; - + TQListViewItem *item = linkList->firstChild(); while( item ) { if( !protList.contains( item->text( 0 ) ) ) return true; - + TQStringList mimes = krConfig->readListEntry( TQString( "Mimes For %1" ).arg( item->text( 0 ) ) ); - + if( (int)mimes.count() != item->childCount() ) return true; TQListViewItem *childs = item->firstChild(); @@ -365,24 +366,24 @@ bool KgProtocols::isChanged() return true; childs = childs->nextSibling(); } - + item = item->nextSibling(); } - + return false; } bool KgProtocols::apply() { krConfig->setGroup( "Protocols" ); - + TQStringList protocolList; - + TQListViewItem *item = linkList->firstChild(); while( item ) { protocolList.append( item->text( 0 ) ); - + TQStringList mimes; TQListViewItem *childs = item->firstChild(); while( childs ) @@ -391,15 +392,15 @@ bool KgProtocols::apply() childs = childs->nextSibling(); } krConfig->writeEntry( TQString( "Mimes For %1" ).arg( item->text( 0 ) ), mimes ); - + item = item->nextSibling(); - } + } krConfig->writeEntry( "Handled Protocols", protocolList ); - krConfig->sync(); - + krConfig->sync(); + KrServices::clearProtocolCache(); - - emit sigChanged(); + + emit sigChanged(); return false; } diff --git a/krusader/Konfigurator/krresulttable.cpp b/krusader/Konfigurator/krresulttable.cpp index cc1ed23..0ab4280 100644 --- a/krusader/Konfigurator/krresulttable.cpp +++ b/krusader/Konfigurator/krresulttable.cpp @@ -99,20 +99,21 @@ KrArchiverResultTable::KrArchiverResultTable(TQWidget* parent) { _supported = KRarcHandler::supportedPackers(); // get list of available packers - Archiver* tar = new Archiver("tar", "http://www.gnu.org", PS("tar"), true, true); - Archiver* gzip = new Archiver("gzip", "http://www.gnu.org", PS("gzip"), true, true); - Archiver* bzip2 = new Archiver("bzip2", "http://www.gnu.org", PS("bzip2"), true, true); - Archiver* lha = new Archiver("lha", "http://www.gnu.org", PS("lha"), true, true); - Archiver* zip = new Archiver("zip", "http://www.info-zip.org", PS("zip"), true, false); - Archiver* unzip = new Archiver("unzip", "http://www.info-zip.org", PS("unzip"), false, true); - Archiver* arj = new Archiver("arj", "http://www.arjsoftware.com", PS("arj"), true, true); - Archiver* unarj = new Archiver("unarj", "http://www.arjsoftware.com", PS("unarj"), false, true); - Archiver* unace = new Archiver("unace", "http://www.winace.com", PS("unace"), false, true); - Archiver* rar = new Archiver("rar", "http://www.rarsoft.com", PS("rar"), true, true); - Archiver* unrar = new Archiver("unrar", "http://www.rarsoft.com", PS("unrar"), false, true); - Archiver* rpm = new Archiver("rpm", "http://www.gnu.org", PS("rpm"), false, true); - Archiver* dpkg = new Archiver("dpkg", "http://www.dpkg.org", PS("dpkg"), false, true); - Archiver* _7z = new Archiver("7z", "http://www.7-zip.org", PS("7z"), true, true); + Archiver* tar = new Archiver("tar", "http://www.gnu.org", PS("tar"), true, true); + Archiver* gzip = new Archiver("gzip", "http://www.gnu.org", PS("gzip"), true, true); + Archiver* bzip2 = new Archiver("bzip2", "http://www.gnu.org", PS("bzip2"), true, true); + Archiver* lha = new Archiver("lha", "http://www.gnu.org", PS("lha"), true, true); + Archiver* zip = new Archiver("zip", "http://www.info-zip.org", PS("zip"), true, false); + Archiver* unzip = new Archiver("unzip", "http://www.info-zip.org", PS("unzip"), false, true); + Archiver* arj = new Archiver("arj", "http://www.arjsoftware.com", PS("arj"), true, true); + Archiver* unarj = new Archiver("unarj", "http://www.arjsoftware.com", PS("unarj"), false, true); + Archiver* unace = new Archiver("unace", "http://www.winace.com", PS("unace"), false, true); + Archiver* rar = new Archiver("rar", "http://www.rarsoft.com", PS("rar"), true, true); + Archiver* unrar = new Archiver("unrar", "http://www.rarsoft.com", PS("unrar"), false, true); + Archiver* rpm = new Archiver("rpm", "http://www.gnu.org", PS("rpm"), false, true); + Archiver* dpkg = new Archiver("dpkg", "http://www.dpkg.org", PS("dpkg"), false, true); + Archiver* _7z = new Archiver("7z", "http://www.7-zip.org", PS("7z"), true, true); + Archiver* xz = new Archiver("xz", "http://www.tukaani.org/xz", PS("xz"), true, true); // Special case: arj can unpack, but unarj is prefered if(PS("arj") && PS("unarj")) @@ -149,6 +150,7 @@ KrArchiverResultTable::KrArchiverResultTable(TQWidget* parent) addRow(rpm, _grid); addRow(dpkg, _grid); addRow(_7z, _grid); + addRow(xz, _grid); delete tar; delete gzip; @@ -164,6 +166,7 @@ KrArchiverResultTable::KrArchiverResultTable(TQWidget* parent) delete rpm; delete dpkg; delete _7z; + delete xz; } KrArchiverResultTable::~KrArchiverResultTable() diff --git a/krusader/Panel/krbriefview.cpp b/krusader/Panel/krbriefview.cpp index e2d3131..571fc44 100644 --- a/krusader/Panel/krbriefview.cpp +++ b/krusader/Panel/krbriefview.cpp @@ -42,7 +42,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD #include #define CANCEL_TWO_CLICK_RENAME {singleClicked = false;renameTimer.stop();} -#define PROPS static_cast(_properties) +#define PROPS static_cast(_properties) #define MAX_COLS 5 #define VF getVfile() @@ -69,9 +69,9 @@ void KrBriefViewToolTip::maybeTip( const TQPoint &pos ) if ( !item ) return; - + int width = TQFontMetrics( view->font() ).width( item->text() ) + 4; - + TQRect r = item->rect(); r.setTopLeft( view->contentsToViewport( r.topLeft() ) ); if( width > item->textRect().width() ) @@ -92,7 +92,7 @@ KrBriefView::KrBriefView( TQHeader * headerIn, TQWidget *parent, bool &left, TDE void KrBriefView::setup() { lastSwushPosition = 0; - + // use the {} so that TDEConfigGroupSaver will work correctly! TDEConfigGroupSaver grpSvr( _config, "Look&Feel" ); setFont( _config->readFontEntry( "Filelist Font", _FilelistFont ) ); @@ -119,7 +119,7 @@ void KrBriefView::setup() { // add whatever columns are needed to the listview krConfig->setGroup( nameInTDEConfig() ); - + // determine basic settings for the view setAcceptDrops( true ); setItemsMovable( false ); @@ -131,7 +131,7 @@ void KrBriefView::setup() { // allow in-place renaming - connect( this, TQT_SIGNAL( itemRenamed ( TQIconViewItem * ) ), + connect( this, TQT_SIGNAL( itemRenamed ( TQIconViewItem * ) ), this, TQT_SLOT( inplaceRenameFinished( TQIconViewItem * ) ) ); connect( &renameTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( renameCurrentItem() ) ); connect( &contextMenuTimer, TQT_SIGNAL (timeout()), this, TQT_SLOT (showContextMenu())); @@ -144,7 +144,7 @@ void KrBriefView::setup() { CANCEL_TWO_CLICK_RENAME; - // setting the header + // setting the header while( header->count() ) header->removeLabel( 0 ); @@ -440,12 +440,12 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { pressedItem = 0; e = transformMouseEvent( e ); - + TQIconViewItem * oldCurrent = currentItem(); TQIconViewItem *newCurrent = findItem( e->pos() ); if (e->button() == Qt::RightButton) { - if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlRightButtonSelects()) { if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() && !(e->state() & ShiftButton) @@ -504,7 +504,7 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { if (e->button() == Qt::LeftButton) { dragStartPos = e->pos(); - if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlLeftButtonSelects()) { @@ -582,10 +582,10 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { if( e->state() & ShiftButton ) callDefaultHandler = false; } - + if (selectionChanged) updateView(); // don't call triggerUpdate directly! - + if (callDefaultHandler) { dragStartPos = TQPoint( -1, -1 ); @@ -631,11 +631,11 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { void KrBriefView::contentsMouseReleaseEvent( TQMouseEvent * e ) { if (e->button() == Qt::RightButton) contextMenuTimer.stop(); - + e = transformMouseEvent( e ); - + TDEIconView::contentsMouseReleaseEvent( e ); - + if( pressedItem ) { TQPoint vp = contentsToViewport( e->pos() ); TQIconViewItem *newCurrent = findItem( e->pos() ); @@ -665,8 +665,8 @@ void KrBriefView::contentsMouseMoveEvent ( TQMouseEvent * e ) { if ( dragStartPos != TQPoint( -1, -1 ) && e->state() & Qt::LeftButton && ( dragStartPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) startDrag(); - if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() - && KrSelectionMode::getSelectionHandler()->rightButtonSelects() + if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() + && KrSelectionMode::getSelectionHandler()->rightButtonSelects() && KrSelectionMode::getSelectionHandler()->showContextMenu() >= 0 && e->state() == Qt::RightButton) { TQIconViewItem *newItem = findItem( e->pos() ); @@ -754,7 +754,7 @@ void KrBriefView::contentsDropEvent( TQDropEvent * e ) { _currDragItem = 0; op()->emitGotDrop(e); e->ignore(); - TDEIconView::contentsDropEvent( e ); + TDEIconView::contentsDropEvent( e ); } void KrBriefView::contentsDragMoveEvent( TQDragMoveEvent * e ) { @@ -763,7 +763,7 @@ void KrBriefView::contentsDragMoveEvent( TQDragMoveEvent * e ) { _currDragItem = getKrViewItemAt( e->pos() ); if( _currDragItem && !_currDragItem->VF->vfile_isDir() ) _currDragItem = 0; - + TDEIconView::contentsDragMoveEvent( e ); if( _currDragItem != oldDragItem ) @@ -1031,7 +1031,7 @@ void KrBriefView::keyPressEvent( TQKeyEvent * e ) { case Key_Delete : // kill file SLOTS->deleteFiles( e->state() == ShiftButton || e->state() == ControlButton ); - + break ; case Key_Insert : { { @@ -1093,7 +1093,7 @@ void KrBriefView::keyPressEvent( TQKeyEvent * e ) { ( e->key() >= Key_0 && e->key() <= Key_9 ) || ( e->key() == Key_Backspace ) || ( e->key() == Key_Down ) || - ( e->key() == Key_Period ) ) */{ + ( e->key() == Key_Period ) ) */{ // are we doing quicksearch? if not, send keys to panel //if ( _config->readBoolEntry( "Do Quicksearch", _DoQuicksearch ) ) { // are we using krusader's classic quicksearch, or wincmd style? @@ -1142,7 +1142,7 @@ void KrBriefView::renameCurrentItem() { TQString newName, fileName; // handle inplace renaming, if possible - + KrBriefViewItem *it = static_cast(getCurrentKrViewItem()); if ( it ) fileName = it->name(); @@ -1157,7 +1157,7 @@ void KrBriefView::renameCurrentItem() { /* TODO: TDEConfigGroupSaver svr(krConfig,"Look&Feel"); if (!krConfig->readBoolEntry("Rename Selects Extension", true)) { - if (it->hasExtension() && !it->VF->vfile_isDir() ) + if (it->hasExtension() && !it->VF->vfile_isDir() ) renameLineEdit()->setSelection(0, it->name().findRev(it->extension())-1); }*/ } @@ -1226,7 +1226,7 @@ void KrBriefView::slotMouseClicked( int button, TQIconViewItem * item, const TQP void KrBriefView::refreshColors() { krConfig->setGroup("Colors"); - bool kdeDefault = krConfig->readBoolEntry("KDE Default"); + bool kdeDefault = krConfig->readBoolEntry("KDE Default"); if ( !kdeDefault ) { // KDE default is not choosen: set the background color (as this paints the empty areas) and the alternate color bool isActive = hasFocus(); @@ -1289,7 +1289,7 @@ bool KrBriefView::eventFilter( TQObject * watched, TQEvent * e ) void KrBriefView::makeItemVisible( const KrViewItem *item ) { // tqApp->processEvents(); // Please don't remove the comment. Causes crash if it is inserted! - ensureItemVisible( (TQIconViewItem *)( static_cast( item ) ) ); + ensureItemVisible( (TQIconViewItem *)( static_cast( item ) ) ); } void KrBriefView::initOperator() { @@ -1307,18 +1307,19 @@ void KrBriefView::initProperties() { _properties->displayIcons = _config->readBoolEntry( "With Icons", _WithIcons ); bool dirsByNameAlways = _config->readBoolEntry("Always sort dirs by name", false); _properties->sortMode = static_cast( KrViewProperties::Name | - KrViewProperties::Descending | KrViewProperties::DirsFirst | + KrViewProperties::Descending | KrViewProperties::DirsFirst | (dirsByNameAlways ? KrViewProperties::AlwaysSortDirsByName : 0) ); if ( !_config->readBoolEntry( "Case Sensative Sort", _CaseSensativeSort ) ) _properties->sortMode = static_cast( _properties->sortMode | KrViewProperties::IgnoreCase ); _properties->humanReadableSize = krConfig->readBoolEntry("Human Readable Size", _HumanReadableSize); _properties->localeAwareCompareIsCaseSensitive = TQString( "a" ).localeAwareCompare( "B" ) > 0; // see KDE bug #40131 - + TQStringList defaultAtomicExtensions; defaultAtomicExtensions += ".tar.gz"; defaultAtomicExtensions += ".tar.bz2"; defaultAtomicExtensions += ".moc.cpp"; + defaultAtomicExtensions += ".tar.xz"; TQStringList atomicExtensions = krConfig->readListEntry("Atomic Extensions", defaultAtomicExtensions); for (TQStringList::iterator i = atomicExtensions.begin(); i != atomicExtensions.end(); ) { @@ -1334,7 +1335,7 @@ void KrBriefView::initProperties() { ++i; } _properties->atomicExtensions = atomicExtensions; - + _config->setGroup( nameInTDEConfig() ); PROPS->numberOfColumns = _config->readNumEntry( "Number Of Brief Columns", _NumberOfBriefColumns ); if( PROPS->numberOfColumns < 1 ) @@ -1347,7 +1348,7 @@ void KrBriefView::setColumnNr() { TDEPopupMenu popup( this ); popup.insertTitle( i18n("Columns")); - + int COL_ID = 14700; for( int i=1; i <= MAX_COLS; i++ ) @@ -1355,11 +1356,11 @@ void KrBriefView::setColumnNr() popup.insertItem( TQString( "%1" ).arg( i ), COL_ID + i ); popup.setItemChecked( COL_ID + i, PROPS->numberOfColumns == i ); } - + int result=popup.exec(TQCursor::pos()); krConfig->setGroup( nameInTDEConfig() ); - + if( result > COL_ID && result <= COL_ID + MAX_COLS ) { krConfig->writeEntry( "Number Of Brief Columns", result - COL_ID ); @@ -1370,7 +1371,7 @@ void KrBriefView::setColumnNr() void KrBriefView::sortOrderChanged() { ensureItemVisible(currentItem()); - + if( !_focused ) op()->emitNeedFocus(); @@ -1400,14 +1401,14 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) { if( findItem( e->pos() ) != 0 ) return e; - + TQIconViewItem *closestItem = 0; int mouseX = e->pos().x(), mouseY = e->pos().y(); int closestDelta = 0x7FFFFFFF; - + int minX = ( mouseX / gridX() ) * gridX(); int maxX = minX + gridX(); - + TQIconViewItem *current = firstItem(); while( current ) { @@ -1422,7 +1423,7 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) } current = current->nextItem(); } - + if( closestItem != 0 ) { if( mouseX - closestItem->x() > gridX() ) @@ -1430,7 +1431,7 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) else if( mouseY - closestItem->y() > closestItem->height() ) closestItem = 0; } - + if( closestItem != 0 ) { TQRect rec = closestItem->textRect( false ); @@ -1449,12 +1450,12 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) glPos = TQPoint( mouseX - e->pos().x() + e->globalPos().x(), mouseY - e->pos().y() + e->globalPos().y() ); } - + if( mouseEvent ) delete mouseEvent; return mouseEvent = new TQMouseEvent( e->type(), newPos, glPos, e->button(), e->state() ); } - + return e; } diff --git a/krusader/Panel/krdetailedview.cpp b/krusader/Panel/krdetailedview.cpp index 59dd1d8..c3db5b9 100644 --- a/krusader/Panel/krdetailedview.cpp +++ b/krusader/Panel/krdetailedview.cpp @@ -59,28 +59,28 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD // Group name: KrDetailedView // // Ext Column -#define _ExtColumn true +#define _ExtColumn true // Mime Column -#define _MimeColumn false +#define _MimeColumn false // Size Column -#define _SizeColumn true +#define _SizeColumn true // DateTime Column -#define _DateTimeColumn true +#define _DateTimeColumn true // Perm Column -#define _PermColumn false +#define _PermColumn false // KrPerm Column -#define _KrPermColumn true +#define _KrPermColumn true // Owner Column -#define _OwnerColumn false +#define _OwnerColumn false // Group Column -#define _GroupColumn false +#define _GroupColumn false // Do Quicksearch -#define _DoQuicksearch true +#define _DoQuicksearch true ////////////////////////////////////////////////////////////////////////// #define CANCEL_TWO_CLICK_RENAME {singleClicked = false;renameTimer.stop();} #define COLUMN(X) static_cast(_properties)->column[ KrDetailedViewProperties::X ] -#define PROPS static_cast(_properties) +#define PROPS static_cast(_properties) #define VF getVfile() #define COLUMN_POPUP_IDS 91 @@ -140,7 +140,7 @@ void KrDetailedView::setup() { // add whatever columns are needed to the listview krConfig->setGroup( nameInTDEConfig() ); - + newColumn( KrDetailedViewProperties::Name ); // we always have a name setColumnWidthMode( COLUMN(Name), TQListView::Manual ); if ( _config->readBoolEntry( "Ext Column", _ExtColumn ) ) { @@ -186,7 +186,7 @@ void KrDetailedView::setup() { setColumnWidthMode( COLUMN(Group), TQListView::Manual ); setColumnWidth( COLUMN(Group), TQFontMetrics( font() ).width( 'X' ) * 6 ); } - + // determine basic settings for the listview setAcceptDrops( true ); setDragEnabled( true ); @@ -205,7 +205,7 @@ void KrDetailedView::setup() { header()->installEventFilter( this ); renameLineEdit()->installEventFilter( this ); - + // allow in-place renaming connect( renameLineEdit(), TQT_SIGNAL( done( TQListViewItem *, int ) ), this, TQT_SLOT( inplaceRenameFinished( TQListViewItem*, int ) ) ); @@ -235,7 +235,7 @@ void KrDetailedView::newColumn( KrDetailedViewProperties::ColumnType type ) { } if ( max >= KrDetailedViewProperties::MAX_COLUMNS ) perror( "KrDetailedView::newColumn() - too many columns" ); - + PROPS->column[type] = max; addColumn( ColumnName[type], -1 ); } @@ -535,7 +535,7 @@ void KrDetailedView::contentsMousePressEvent( TQMouseEvent * e ) { TQListViewItem *newCurrent = itemAt( contentsToViewport( e->pos() ) ); if (e->button() == Qt::RightButton) { - if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlRightButtonSelects()) { if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() && !(e->state() & ShiftButton) @@ -594,7 +594,7 @@ void KrDetailedView::contentsMousePressEvent( TQMouseEvent * e ) { if (e->button() == Qt::LeftButton) { dragStartPos = e->pos(); - if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlLeftButtonSelects()) { @@ -667,10 +667,10 @@ void KrDetailedView::contentsMousePressEvent( TQMouseEvent * e ) { callDefaultHandler = false; } } - + if (selectionChanged) updateView(); // don't call triggerUpdate directly! - + // TQListViewItem * i = itemAt( contentsToViewport( e->pos() ) ); if (callDefaultHandler) { @@ -745,8 +745,8 @@ void KrDetailedView::contentsMouseMoveEvent ( TQMouseEvent * e ) { if ( dragStartPos != TQPoint( -1, -1 ) && e->state() & Qt::LeftButton && ( dragStartPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) startDrag(); - if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() - && KrSelectionMode::getSelectionHandler()->rightButtonSelects() + if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() + && KrSelectionMode::getSelectionHandler()->rightButtonSelects() && KrSelectionMode::getSelectionHandler()->showContextMenu() >= 0 && e->state() == Qt::RightButton) { TQListViewItem *newItem = itemAt( contentsToViewport( e->pos() ) ); @@ -852,7 +852,7 @@ void KrDetailedView::contentsDragMoveEvent( TQDragMoveEvent * e ) { _currDragItem = getKrViewItemAt(contentsToViewport(e->pos())); if( _currDragItem && !_currDragItem->VF->vfile_isDir() ) _currDragItem = 0; - + TDEListView::contentsDragMoveEvent( e ); } @@ -1022,7 +1022,7 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { TQString tmp = i->name(); op()->emitExecuted(tmp); // thereby emulating a chdir } else if( i->VF->vfile_getUrl().isLocalFile() ) { - bool encrypted; + bool encrypted; KURL url = i->VF->vfile_getUrl(); TQString mime = ((vfile *)(i->VF))->vfile_getMime(); TQString type = KRarcHandler::getType( encrypted, url.path(), mime, false ); @@ -1061,7 +1061,7 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { #endif*/ case Key_Delete : // kill file SLOTS->deleteFiles( e->state() == ShiftButton || e->state() == ControlButton ); - + break ; case Key_Insert : { if (KrSelectionMode::getSelectionHandler()->insertMovesDown()) @@ -1071,7 +1071,7 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { TQKeyEvent ev = TQKeyEvent( TQKeyEvent::KeyPress, Key_Space, 0, 0 ); TDEListView::keyPressEvent( & ev ); } - break ; + break ; } case Key_Space : { KrDetailedViewItem * viewItem = static_cast ( getCurrentKrViewItem() ); @@ -1083,9 +1083,9 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { } else TDEListView::keyPressEvent( e ); - break ; + break ; } - if ( viewItem->VF->vfile_isDir() && viewItem->VF->vfile_getSize() <= 0 && + if ( viewItem->VF->vfile_isDir() && viewItem->VF->vfile_getSize() <= 0 && KrSelectionMode::getSelectionHandler()->spaceCalculatesDiskSpace()) { // // NOTE: this is buggy incase somewhere down in the folder we're calculating, @@ -1130,7 +1130,7 @@ mark: if (KrSelectionMode::getSelectionHandler()->spaceMovesDown()) ( e->key() >= Key_0 && e->key() <= Key_9 ) || ( e->key() == Key_Backspace ) || ( e->key() == Key_Down ) || - ( e->key() == Key_Period ) ) */{ + ( e->key() == Key_Period ) ) */{ // are we doing quicksearch? if not, send keys to panel //if ( _config->readBoolEntry( "Do Quicksearch", _DoQuicksearch ) ) { // are we using krusader's classic quicksearch, or wincmd style? @@ -1192,7 +1192,7 @@ void KrDetailedView::renameCurrentItem() { TQString newName, fileName; // handle inplace renaming, if possible - + KrDetailedViewItem *it = static_cast(getCurrentKrViewItem()); if ( it ) fileName = it->name(); @@ -1214,7 +1214,7 @@ void KrDetailedView::renameCurrentItem() { // if applicable, select only the name without extension TDEConfigGroupSaver svr(krConfig,"Look&Feel"); if (!krConfig->readBoolEntry("Rename Selects Extension", true)) { - if (it->hasExtension() && !it->VF->vfile_isDir() ) + if (it->hasExtension() && !it->VF->vfile_isDir() ) renameLineEdit()->setSelection(0, it->name().findRev(it->extension())-1); } // signal will be emited when renaming is done, and finalization @@ -1234,10 +1234,10 @@ void KrDetailedView::inplaceRenameFinished( TQListViewItem * it, int ) { krOut << "Major failure at inplaceRenameFinished(): item is null" << endl; return; } - + if( COLUMN( Extention ) != -1 && !currentlyRenamedItem ) return; /* does the event filter restored the original state? */ - + // check if the item was indeed renamed bool restoreView = false; if ( it->text( COLUMN( Name ) ) != static_cast( it ) ->name() ) { // was renamed @@ -1249,7 +1249,7 @@ void KrDetailedView::inplaceRenameFinished( TQListViewItem * it, int ) { #if 0 if ( COLUMN( Extention ) != -1 && restoreView ) { // nothing happened, restore the view (if needed) #endif - + TQString ext, name = static_cast( it ) ->name(); if ( !static_cast( it ) ->VF->vfile_isDir() && COLUMN( Extention ) != -1 ) { ext = static_cast( it ) ->extension(); @@ -1263,7 +1263,7 @@ void KrDetailedView::inplaceRenameFinished( TQListViewItem * it, int ) { #endif setFocus(); - + currentlyRenamedItem = 0; } @@ -1318,8 +1318,8 @@ void KrDetailedView::slotMouseClicked( int button, TQListViewItem * item, const void KrDetailedView::refreshColors() { krConfig->setGroup("Colors"); - bool kdeDefault = krConfig->readBoolEntry("KDE Default"); - bool alternateBackgroundEnabled = krConfig->readBoolEntry("Enable Alternate Background"); + bool kdeDefault = krConfig->readBoolEntry("KDE Default"); + bool alternateBackgroundEnabled = krConfig->readBoolEntry("Enable Alternate Background"); if ( !kdeDefault ) { // KDE default is not choosen: set the background color (as this paints the empty areas) and the alternate color bool isActive = hasFocus(); @@ -1364,7 +1364,7 @@ bool KrDetailedView::eventFilter( TQObject * watched, TQEvent * e ) for( TQListViewItem *it = firstChild(); it; it = it->nextSibling() ) if( it == currentlyRenamedItem ) { - if ( it->text( COLUMN( Name ) ) == dynamic_cast( it ) ->name() && COLUMN( Extention ) != -1 ) + if ( it->text( COLUMN( Name ) ) == dynamic_cast( it ) ->name() && COLUMN( Extention ) != -1 ) inplaceRenameFinished( it, COLUMN( Name ) ); break; } @@ -1385,7 +1385,7 @@ bool KrDetailedView::eventFilter( TQObject * watched, TQEvent * e ) void KrDetailedView::makeItemVisible( const KrViewItem *item ) { // tqApp->processEvents(); // Please don't remove the comment. Causes crash if it is inserted! - ensureItemVisible( static_cast( item ) ); + ensureItemVisible( static_cast( item ) ); } void KrDetailedView::initOperator() { @@ -1396,13 +1396,13 @@ void KrDetailedView::initOperator() { void KrDetailedView::initProperties() { _properties = new KrDetailedViewProperties; - TDEConfigGroupSaver grpSvr( _config, "Look&Feel" ); + TDEConfigGroupSaver grpSvr( _config, "Look&Feel" ); for (int i=0; icolumn[i]=-1; + PROPS->column[i]=-1; PROPS->displayIcons = _config->readBoolEntry( "With Icons", _WithIcons ); bool dirsByNameAlways = _config->readBoolEntry("Always sort dirs by name", false); PROPS->sortMode = static_cast( KrViewProperties::Name | - KrViewProperties::Descending | KrViewProperties::DirsFirst | + KrViewProperties::Descending | KrViewProperties::DirsFirst | (dirsByNameAlways ? KrViewProperties::AlwaysSortDirsByName : 0) ); PROPS->numericPermissions = _config->readBoolEntry("Numeric permissions", _NumericPermissions); if ( !_config->readBoolEntry( "Case Sensative Sort", _CaseSensativeSort ) ) @@ -1414,6 +1414,7 @@ void KrDetailedView::initProperties() { defaultAtomicExtensions += ".tar.gz"; defaultAtomicExtensions += ".tar.bz2"; defaultAtomicExtensions += ".moc.cpp"; + defaultAtomicExtensions += ".tar.xz"; TQStringList atomicExtensions = krConfig->readListEntry("Atomic Extensions", defaultAtomicExtensions); for (TQStringList::iterator i = atomicExtensions.begin(); i != atomicExtensions.end(); ) { @@ -1435,9 +1436,9 @@ void KrDetailedView::selectColumns() { TDEPopupMenu popup( this ); popup.insertTitle( i18n("Columns")); - + bool refresh = false; - + bool hasExtention = COLUMN( Extention ) != -1; bool hasMime = COLUMN( Mime ) != -1; bool hasSize = COLUMN( Size ) != -1; @@ -1446,7 +1447,7 @@ void KrDetailedView::selectColumns() bool hasKrPerms = COLUMN( KrPermissions ) != -1; bool hasOwner = COLUMN( Owner ) != -1; bool hasGroup = COLUMN( Group ) != -1; - + popup.insertItem( i18n( "Ext" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::Extention ); popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Extention, hasExtention ); @@ -1463,18 +1464,18 @@ void KrDetailedView::selectColumns() popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Permissions, hasPerms ); popup.insertItem( i18n( "rwx" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::KrPermissions ); - popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::KrPermissions, hasKrPerms ); + popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::KrPermissions, hasKrPerms ); popup.insertItem( i18n( "Owner" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::Owner ); - popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Owner, hasOwner ); + popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Owner, hasOwner ); popup.insertItem( i18n( "Group" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::Group ); - popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Group, hasGroup ); - + popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Group, hasGroup ); + int result=popup.exec(TQCursor::pos()); krConfig->setGroup( nameInTDEConfig() ); - + switch( result - COLUMN_POPUP_IDS ) { case KrDetailedViewProperties::Extention: @@ -1510,7 +1511,7 @@ void KrDetailedView::selectColumns() refresh = true; break; } - + if( refresh ) { PanelManager *p = ACTIVE_PANEL->view == this ? ACTIVE_MNG : OTHER_MNG; @@ -1523,7 +1524,7 @@ void KrDetailedView::sortOrderChanged(int) { } void KrDetailedView::updateView() { - triggerUpdate(); + triggerUpdate(); op()->emitSelectionChanged(); } @@ -1564,7 +1565,7 @@ void KrDetailedView::slotSortOrderChanged(int col) { sp = KrViewProperties::Group; break; default: tqFatal("slotSortOrderChanged: unknown column"); } - if (sortMode() & KrViewProperties::DirsFirst) + if (sortMode() & KrViewProperties::DirsFirst) sp = static_cast(sp | KrViewProperties::DirsFirst); if (sortMode() & KrViewProperties::IgnoreCase) sp = static_cast(sp | KrViewProperties::IgnoreCase); @@ -1574,12 +1575,12 @@ void KrDetailedView::slotSortOrderChanged(int col) { sp = static_cast(sp | KrViewProperties::AlwaysSortDirsByName); // fix the ascending/decending stuff if (sortMode() == sp) { - if (sp & KrViewProperties::Descending) + if (sp & KrViewProperties::Descending) sp = static_cast(sp &~ KrViewProperties::Descending); else sp = static_cast(sp | KrViewProperties::Descending); } PROPS->sortMode = sp; - + if( !_focused ) op()->emitNeedFocus(); } diff --git a/krusader/Panel/krviewitem.cpp b/krusader/Panel/krviewitem.cpp index 42d4562..916ed91 100644 --- a/krusader/Panel/krviewitem.cpp +++ b/krusader/Panel/krviewitem.cpp @@ -8,13 +8,14 @@ #define PROPS static_cast(_viewProperties) -TQString atomicExtensions[] = { - ".tar.gz", - ".tar.bz2", +TQString atomicExtensions[] = { + ".tar.gz", + ".tar.bz2", ".moc.cpp" + ".tar.xz", }; -KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties): +KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties): _vf(vf), dummyVfile(false), _viewProperties(properties), _hasExtension(false), _hidden(false), _extension("") { if (vf) { // check if the file has an extension @@ -32,7 +33,7 @@ KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties): _extension = vfName.mid(loc+1); _hasExtension=true; } - + if( vfName.startsWith(".") ) _hidden = true; } @@ -50,16 +51,16 @@ TQString KrViewItem::description() const { TQString comment = KMimeType::mimeType(_vf->vfile_getMime())->comment(text, false); TQString myLinkDest = _vf->vfile_getSymDest(); TDEIO::filesize_t mySize = _vf->vfile_getSize(); - + TQString text2 = text.copy(); mode_t m_fileMode = _vf->vfile_getMode(); - + if (_vf->vfile_isSymLink() ){ TQString tmp; if ( comment.isEmpty() ) tmp = i18n ( "Symbolic Link" ) ; else if( _vf->vfile_getMime() == "Broken Link !" ) tmp = i18n("(broken link !)"); else tmp = i18n("%1 (Link)").arg(comment); - + text += "->"; text += myLinkDest; text += " "; @@ -89,13 +90,13 @@ TQString KrViewItem::dateTime() const { } TQPixmap KrViewItem::icon() { -#if 0 +#if 0 TQPixmap *p; // This is bad - very bad. the function must return a valid reference, // This is an interface flow - shie please fix it with a function that return TQPixmap* // this way we can return 0 - and do our error checking... - + // shie answers: why? what's the difference? if we return an empty pixmap, others can use it as it // is, without worrying or needing to do error checking. empty pixmap displays nothing #endif diff --git a/krusader/Panel/panelfunc.cpp b/krusader/Panel/panelfunc.cpp index 3448b56..e5053fe 100755 --- a/krusader/Panel/panelfunc.cpp +++ b/krusader/Panel/panelfunc.cpp @@ -5,10 +5,10 @@ copyright : (C) 2000 by Shie Erlich & Rafi Yanai e-mail : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- -Description +Description *************************************************************************** -A +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 @@ -27,12 +27,12 @@ A * (at your option) any later version. * * * ***************************************************************************/ -#include +#include // TQt Includes #include #include #include -#include +#include // KDE Includes #include #include @@ -48,7 +48,7 @@ A #include #include #include -#include +#include #include #include #include @@ -91,7 +91,7 @@ panel( parent ), inRefresh( false ), vfsP( 0 ) { } void ListPanelFunc::openUrl( const TQString& url, const TQString& nameToMakeCurrent ) { - openUrl( vfs::fromPathOrURL( + openUrl( vfs::fromPathOrURL( // KURLRequester is buggy: it should return a string containing "/home/shie/downloads" // but it returns "~/downloads" which is parsed incorrectly by vfs::fromPathOrURL. // replacedPath should replace ONLY $HOME and environment variables @@ -121,7 +121,7 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { // if we are not refreshing to current URL bool is_equal_url = files() ->vfs_getOrigin().equals( url, true ); - + if ( !is_equal_url ) { // change the cursor to busy panel->setCursor( KCursor::waitCursor() ); @@ -135,7 +135,7 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { if ( is_equal_url ) { panel->view->setCurrentItem( nameToMakeCurrent ); panel->view->makeItemVisible( panel->view->getCurrentKrViewItem() ); - } + } } vfs* v = 0; @@ -152,11 +152,11 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { if ( !v ) continue; //this should not happen ! if ( v != vfsP ) { - if( vfsP->vfs_canDelete() ) + if( vfsP->vfs_canDelete() ) delete vfsP; else { connect( vfsP, TQT_SIGNAL( deleteAllowed() ), vfsP, TQT_SLOT( deleteLater() ) ); - vfsP->vfs_requestDelete(); + vfsP->vfs_requestDelete(); } vfsP = v; // v != 0 so this is safe } else { @@ -173,10 +173,10 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { break; // we have a valid refreshed URL now } if ( vfsP == 0 ) // the object was deleted during vfs_refresh? Hoping the best... - return; + return; // prevent repeated error messages if ( vfsP->vfs_isDeleting() ) - break; + break; vfsP->vfs_setQuiet( true ); } vfsP->vfs_setQuiet( false ); @@ -204,12 +204,12 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { panel, TQT_SLOT( slotItemDeleted( const TQString& ) ) ); connect( files(), TQT_SIGNAL( cleared() ), panel, TQT_SLOT( slotCleared() ) ); - + // on local file system change the working directory if ( files() ->vfs_getType() == vfs::NORMAL ) chdir( files() ->vfs_getOrigin().path().local8Bit() ); - - // see if the open url operation failed, and if so, + + // see if the open url operation failed, and if so, // put the attempted url in the origin bar and let the user change it if (refreshFailed) { panel->origin->setURL(urlIn.prettyURL()); @@ -529,25 +529,25 @@ void ListPanelFunc::mkdir() { KURL ListPanelFunc::getVirtualBaseURL() { if( files()->vfs_getType() != vfs::VIRT || otherFunc()->files()->vfs_getType() == vfs::VIRT ) return KURL(); - + TQStringList fileNames; panel->getSelectedNames( &fileNames ); - + KURL::List* fileUrls = files() ->vfs_getFiles( &fileNames ); if( fileUrls->count() == 0 ) return KURL(); - + KURL base = (*fileUrls)[ 0 ].upURL(); - + if( base.protocol() == "virt" ) // is it a virtual subfolder? return KURL(); // --> cannot keep the directory structure - + for( unsigned i=1; i < fileUrls->count(); i++ ) { if( base.isParentOf( (*fileUrls)[ i ] ) ) continue; if( base.protocol() != (*fileUrls)[ i ].protocol() ) return KURL(); - + do { KURL oldBase = base; base = base.upURL(); @@ -721,15 +721,13 @@ void ListPanelFunc::execute( TQString& name ) { dirUp(); return ; } - vfile *vf = files() ->vfs_search( name ); if ( vf == 0 ) return ; - + KURL origin = files() ->vfs_getOrigin(); TQString protocol = origin.isLocalFile() ? KrServices::registerdProtocol( vf->vfile_getMime() ) : ""; - if ( protocol == "tar" || protocol == "krarc" ) { bool encrypted; TQString type = KRarcHandler::getType( encrypted, vf->vfile_getUrl().path(), vf->vfile_getMime(), false ); @@ -748,7 +746,7 @@ void ListPanelFunc::execute( TQString& name ) { } else { KURL url = files() ->vfs_getFile( name ); KFileItem kfi( vf->vfile_getEntry(), url,true ); - kfi.run(); + kfi.run(); } } @@ -776,15 +774,15 @@ void ListPanelFunc::pack() { if ( PackGUI::type == TQString() ) return ; // the user canceled - // check for partial URLs + // check for partial URLs if( !PackGUI::destination.contains(":/") && !PackGUI::destination.startsWith("/") ){ PackGUI::destination = panel->virtualPath().prettyURL()+"/"+PackGUI::destination; } - + TQString destDir = PackGUI::destination; if( !destDir.endsWith( "/" ) ) destDir += "/"; - + bool packToOtherPanel = ( destDir == panel->otherPanel->virtualPath().prettyURL(1) ); // on remote URL-s first pack into a temp file then copy to its right place @@ -795,8 +793,8 @@ void ListPanelFunc::pack() { arcFile = destURL.path(); else if( destURL.protocol() == "virt" ) { KMessageBox::error( krApp, i18n( "Cannot pack files onto a virtual destination!" ) ); - return; - } + return; + } else { tempDestFile = new KTempFile( TQString(), "." + PackGUI::type ); tempDestFile->setAutoDelete( true ); @@ -884,15 +882,15 @@ void ListPanelFunc::testArchive() { TQString mime = files() ->vfs_search( arcName ) ->vfile_getMime(); bool encrypted = false; TQString type = KRarcHandler::getType( encrypted, url, mime ); - + // check we that archive is supported if ( !KRarcHandler::arcSupported( type ) ) { KMessageBox::sorry( krApp, i18n( "%1, unknown archive type." ).arg( arcName ) ); return ; } - + TQString password = encrypted ? KRarcHandler::getPassword( url ) : TQString(); - + // test the archive if ( KRarcHandler::test( url, type, password ) ) KMessageBox::information( krApp, i18n( "%1, test passed." ).arg( arcName ) ); @@ -964,9 +962,9 @@ void ListPanelFunc::unpack() { KMessageBox::sorry( krApp, i18n( "%1, unknown archive type" ).arg( arcName ) ); continue; } - + TQString password = encrypted ? KRarcHandler::getPassword( url ) : TQString(); - + // unpack the files KRarcHandler::unpack( url, type, password, dest.path( -1 ) ); @@ -1020,7 +1018,7 @@ void ListPanelFunc::matchChecksum() { TQValueList checksumFiles = files()->vfs_search( KRQuery(MatchChecksumDlg::checksumTypesFilter) ); - MatchChecksumDlg dlg(args, folders, panel->realPath(), + MatchChecksumDlg dlg(args, folders, panel->realPath(), (checksumFiles.size()==1 ? checksumFiles[0]->vfile_getUrl().prettyURL() : TQString())); } @@ -1149,7 +1147,7 @@ void ListPanelFunc::copyToClipboard( bool move ) { KMessageBox::error( krApp, i18n( "Cannot copy a virtual URL collection onto the clipboard!" ) ); return; } - + TQStringList fileNames; panel->getSelectedNames( &fileNames ); @@ -1160,10 +1158,10 @@ void ListPanelFunc::copyToClipboard( bool move ) { if ( fileUrls ) { KRDrag * urlData = KRDrag::newDrag( *fileUrls, move, krApp->mainView, "krusader" ); TQApplication::clipboard() ->setData( urlData ); - + if( move && files()->vfs_getType() == vfs::VIRT ) ( static_cast( files() ) )->vfs_removeFiles( &fileNames ); - + delete fileUrls; } } diff --git a/krusader/VFS/krarchandler.cpp b/krusader/VFS/krarchandler.cpp index 5431a0c..51a0b79 100644 --- a/krusader/VFS/krarchandler.cpp +++ b/krusader/VFS/krarchandler.cpp @@ -26,15 +26,15 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * -***************************************************************************/ +***************************************************************************/ // QT includes -#include +#include // KDE includes #include #include #include #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ #include "../krservices.h" #include "../Dialogs/krpleasewait.h" -static TQStringList arcProtocols = TQStringList::split(";", "tar;bzip;bzip2;gzip;krarc;zip"); +static TQStringList arcProtocols = TQStringList::split(";", "tar;bzip;bzip2;gzip;krarc;zip;xz"); TDEWallet::Wallet * KRarcHandler::wallet = 0; @@ -69,6 +69,7 @@ TQStringList KRarcHandler::supportedPackers() { if ( KrServices::cmdExist( "dpkg" ) ) packers.append( "dpkg" ); if ( KrServices::cmdExist( "7z" ) || KrServices::cmdExist( "7za" ) ) packers.append( "7z" ); if ( KrServices::cmdExist( "rpm" ) && KrServices::cmdExist( "rpm2cpio" ) ) packers.append( "rpm" ); + if ( KrServices::cmdExist( "xz" ) ) packers.append( "xz" ); // kdDebug() << "Supported Packers:" << endl; //TQStringList::Iterator it; //for( it = packers.begin(); it != packers.end(); ++it ) @@ -90,6 +91,8 @@ bool KRarcHandler::arcSupported( TQString type ) { return true; else if ( type == "-tgz" && lst.contains( "tar" ) ) return true; + else if ( type == "-txz" && lst.contains( "tar" ) ) + return true; else if ( type == "tarz" && lst.contains( "tar" ) ) return true; else if ( type == "gzip" && lst.contains( "gzip" ) ) @@ -110,7 +113,9 @@ bool KRarcHandler::arcSupported( TQString type ) { return true; else if ( type == "-deb" && ( lst.contains( "dpkg" ) && lst.contains( "tar" ) ) ) return true; - else if ( type == "-7z" && lst.contains( "7z" ) ) + else if ( type == "-7z" && lst.contains( "7z" ) ) + return true; + else if ( type == "-xz" && lst.contains( "xz" ) ) return true; // not supported : ( return false; @@ -123,19 +128,21 @@ bool KRarcHandler::arcHandled( TQString type ) { krConfig->setGroup( "Archives" ); if ( ( type == "-tgz" && krConfig->readBoolEntry( "Do GZip" , _DoGZip ) ) || ( type == "tarz" && krConfig->readBoolEntry( "Do GZip" , _DoGZip ) ) || - ( type == "-tar" && krConfig->readBoolEntry( "Do Tar" , _DoTar ) ) || + ( type == "-tar" && krConfig->readBoolEntry( "Do Tar" , _DoTar ) ) || ( type == "-tbz" && krConfig->readBoolEntry( "Do BZip2", _DoBZip2 ) ) || + ( type == "-txz" && krConfig->readBoolEntry( "Do Xz" , _DoXz ) ) || ( type == "gzip" && krConfig->readBoolEntry( "Do GZip" , _DoGZip ) ) || ( type == "zip2" && krConfig->readBoolEntry( "Do BZip2", _DoBZip2 ) ) || ( type == "-zip" && krConfig->readBoolEntry( "Do UnZip", _DoUnZip ) ) || - ( type == "-lha" && krConfig->readBoolEntry( "Do Lha", _DoUnZip ) ) || + ( type == "-lha" && krConfig->readBoolEntry( "Do Lha" , _DoUnZip ) ) || ( type == "-rar" && krConfig->readBoolEntry( "Do UnRar", _DoUnRar ) ) || ( type == "-arj" && krConfig->readBoolEntry( "Do UnArj", _DoUnarj ) ) || ( type == "-ace" && krConfig->readBoolEntry( "Do UnAce", _DoUnAce ) ) || - ( type == "cpio" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) || - ( type == "-rpm" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) || - ( type == "-deb" && krConfig->readBoolEntry( "Do DEB" , _DoDEB ) ) || - ( type == "-7z" && krConfig->readBoolEntry( "Do 7z" , _Do7z ) ) ) + ( type == "cpio" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) || + ( type == "-rpm" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) || + ( type == "-deb" && krConfig->readBoolEntry( "Do DEB" , _DoDEB ) ) || + ( type == "-7z" && krConfig->readBoolEntry( "Do 7z" , _Do7z ) ) || + ( type == "-xz" && krConfig->readBoolEntry( "Do Xz" , _DoXz ) ) ) return true; else return false; @@ -148,8 +155,8 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw // first check if supported if ( !arcSupported( type ) ) return 0; - // bzip an gzip archive contains only one file - if ( type == "zip2" || type == "gzip" ) return 1L; + // bzip, gzip and xz archives contain only one file + if ( type == "zip2" || type == "gzip" || type == "-xz") return 1L; // set the right lister to do the job TQString lister; @@ -159,6 +166,7 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw else if ( type == "-tgz" ) lister = KrServices::fullPathName( "tar" ) + " -tvzf"; else if ( type == "tarz" ) lister = KrServices::fullPathName( "tar" ) + " -tvzf"; else if ( type == "-tbz" ) lister = KrServices::fullPathName( "tar" ) + " -tjvf"; + else if ( type == "-txz" ) lister = KrServices::fullPathName( "tar" ) + " -tJvf"; else if ( type == "-lha" ) lister = KrServices::fullPathName( "lha" ) + " l"; else if ( type == "-rar" ) lister = KrServices::fullPathName( KrServices::cmdExist( "rar" ) ? "rar" : "unrar" ) + " l -v"; else if ( type == "-ace" ) lister = KrServices::fullPathName( "unace" ) + " l"; @@ -171,8 +179,9 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw else if ( type == "-rpm" ) lister = KrServices::fullPathName( "rpm" ) + " --dump -lpq"; else if ( type == "-deb" ) lister = KrServices::fullPathName( "dpkg" ) + " -c"; else if ( type == "-7z" ) lister = KrServices::fullPathName( "7z" ) + " -y l"; + else if ( type == "-xz" ) lister = KrServices::fullPathName( "xz" ) + " -l"; else return 0L; - + if ( !password.isNull() ) { if ( type == "-arj" ) lister += " -g'" + password + "'"; @@ -198,11 +207,11 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw list.kill(); } ; // busy wait - need to find something better... - + krApp->stopWait(); - + if( !list.normalExit() || !checkStatus( type, list.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to list the content of the archive (%1)!" ).arg( archive ), + KMessageBox::detailedError (krApp, i18n( "Failed to list the content of the archive (%1)!" ).arg( archive ), list.getErrorMsg(), i18n("Error" ) ); return 0; } @@ -241,6 +250,7 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T else if ( type == "-tgz" ) packer = KrServices::fullPathName( "tar" ) + " -xvzf"; else if ( type == "tarz" ) packer = KrServices::fullPathName( "tar" ) + " -xvzf"; else if ( type == "-tbz" ) packer = KrServices::fullPathName( "tar" ) + " -xjvf"; + else if ( type == "-txz" ) packer = KrServices::fullPathName( "tar" ) + " -xJvf"; else if ( type == "gzip" ) packer = KrServices::fullPathName( "gzip" ) + " -cd"; else if ( type == "zip2" ) packer = KrServices::fullPathName( "bzip2" ) + " -cdk"; else if ( type == "-lha" ) packer = KrServices::fullPathName( "lha" ) + " xf"; @@ -250,6 +260,7 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T KrServices::fullPathName( "arj" ) + " -y -v x" : KrServices::fullPathName( "unarj" ) + " x"; else if ( type == "-7z" ) packer = KrServices::fullPathName( "7z" ) + " -y x"; + else if ( type == "-xz" ) packer = KrServices::fullPathName( "xz" ) + " -cdk"; else if ( type == "-rpm" ) { TQString tempDir = locateLocal("tmp",TQString()); @@ -259,11 +270,11 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T cpio << KrServices::fullPathName( "rpm2cpio" ) << " " + KrServices::quote( archive ) << " > " << cpioName; cpio.start(TDEProcess::Block, TDEProcess::AllOutput ); if( !cpio.normalExit() || !checkStatus( "cpio", cpio.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to convert rpm (%1) to cpio!" ).arg( archive ), + KMessageBox::detailedError (krApp, i18n( "Failed to convert rpm (%1) to cpio!" ).arg( archive ), cpio.getErrorMsg(), i18n("Error" ) ); return 0; } - + archive = cpioName; packer = KrServices::fullPathName( "cpio" ) + " --force-local --no-absolute-filenames -iuvdF"; } @@ -276,18 +287,18 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T dpkg << KrServices::fullPathName( "dpkg" ) << " --fsys-tarfile " + KrServices::quote( archive ) << " > " << cpioName; dpkg.start(TDEProcess::Block, TDEProcess::AllOutput ); if( !dpkg.normalExit() || !checkStatus( "-deb", dpkg.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to convert deb (%1) to tar!" ).arg( archive ), + KMessageBox::detailedError (krApp, i18n( "Failed to convert deb (%1) to tar!" ).arg( archive ), dpkg.getErrorMsg(), i18n("Error" ) ); return 0; } - + archive = cpioName; packer = KrServices::fullPathName( "tar" ) + " xvf "; } else return false; if ( !password.isNull() ) { - if ( type == "-zip" ) + if ( type == "-zip" ) packer += " -P '" + password + "'"; if ( type == "-arj" ) packer += " -g'" + password + "'"; @@ -305,7 +316,7 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T } if( type == "-ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! proc << "<" << "/dev/ptmx"; - + TQString save = getcwd( 0, 0 ); chdir( dest.local8Bit() ); @@ -333,11 +344,11 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T if( !cpioName.isEmpty() ) TQFile( cpioName ).remove(); /* remove the cpio file */ - + // check the return value if ( !proc.normalExit() || !checkStatus( type, proc.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to unpack %1!" ).arg( archive ), - krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : + KMessageBox::detailedError (krApp, i18n( "Failed to unpack %1!" ).arg( archive ), + krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : proc.getErrorMsg(), i18n("Error" ) ); return false; } @@ -354,6 +365,7 @@ bool KRarcHandler::test( TQString archive, TQString type, TQString password, lon else if ( type == "-tgz" ) packer = KrServices::fullPathName( "tar" ) + " -tvzf"; else if ( type == "tarz" ) packer = KrServices::fullPathName( "tar" ) + " -tvzf"; else if ( type == "-tbz" ) packer = KrServices::fullPathName( "tar" ) + " -tjvf"; + else if ( type == "-txz" ) packer = KrServices::fullPathName( "tar" ) + " -tJvf"; else if ( type == "gzip" ) packer = KrServices::fullPathName( "gzip" ) + " -tv"; else if ( type == "zip2" ) packer = KrServices::fullPathName( "bzip2" ) + " -tv"; else if ( type == "-rar" ) packer = KrServices::fullPathName( KrServices::cmdExist( "rar" ) ? "rar" : "unrar" ) + " t"; @@ -362,10 +374,11 @@ bool KRarcHandler::test( TQString archive, TQString type, TQString password, lon else if ( type == "-arj" ) packer = KrServices::fullPathName( KrServices::cmdExist( "arj" ) ? "arj" : "unarj" ) + " t"; else if ( type == "cpio" ) packer = KrServices::fullPathName( "cpio" ) + " --only-verify-crc -tvF" ; else if ( type == "-7z" ) packer = KrServices::fullPathName( "7z" ) + " -y t"; + else if ( type == "-xz" ) packer = KrServices::fullPathName( "xz" ) + " -tv"; else return false; if ( !password.isNull() ) { - if ( type == "-zip" ) + if ( type == "-zip" ) packer += " -P '" + password + "'"; if ( type == "-arj" ) packer += " -g'" + password + "'"; @@ -379,7 +392,7 @@ bool KRarcHandler::test( TQString archive, TQString type, TQString password, lon if( type == "-ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! proc << "<" << "/dev/ptmx"; - + // tell the user to wait krApp->startWaiting( i18n( "Testing Archive" ), count, true ); if ( count != 0 ) connect( &proc, TQT_SIGNAL( receivedStdout( TDEProcess*, char*, int ) ), @@ -407,23 +420,25 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l // set the right packer to do the job TQString packer; - if ( type == "zip" ) { packer = KrServices::fullPathName( "zip" ) + " -ry"; type = "-zip"; } - else if ( type == "tar" ) { packer = KrServices::fullPathName( "tar" ) + " -cvf"; type = "-tar"; } - else if ( type == "tar.gz" ) { packer = KrServices::fullPathName( "tar" ) + " -cvzf"; type = "-tgz"; } - else if ( type == "tar.bz2" ) { packer = KrServices::fullPathName( "tar" ) + " -cvjf"; type = "-tbz"; } - else if ( type == "rar" ) { packer = KrServices::fullPathName( "rar" ) + " -r a"; type = "-rar"; } - else if ( type == "lha" ) { packer = KrServices::fullPathName( "lha" ) + " a"; type = "-lha"; } - else if ( type == "arj" ) { packer = KrServices::fullPathName( "arj" ) + " -r -y a"; type = "-arj"; } - else if ( type == "7z" ) { packer = KrServices::fullPathName( "7z" ) + " -y a"; type = "-7z"; } + if ( type == "zip" ) { packer = KrServices::fullPathName( "zip" ) + " -ry"; type = "-zip"; } + else if ( type == "tar" ) { packer = KrServices::fullPathName( "tar" ) + " -cvf"; type = "-tar"; } + else if ( type == "tar.gz" ) { packer = KrServices::fullPathName( "tar" ) + " -cvzf"; type = "-tgz"; } + else if ( type == "tar.bz2" ) { packer = KrServices::fullPathName( "tar" ) + " -cvjf"; type = "-tbz"; } + else if ( type == "tar.xz" ) { packer = KrServices::fullPathName( "tar" ) + " -cvJf"; type = "-txz"; } + else if ( type == "rar" ) { packer = KrServices::fullPathName( "rar" ) + " -r a"; type = "-rar"; } + else if ( type == "lha" ) { packer = KrServices::fullPathName( "lha" ) + " a"; type = "-lha"; } + else if ( type == "arj" ) { packer = KrServices::fullPathName( "arj" ) + " -r -y a"; type = "-arj"; } + else if ( type == "7z" ) { packer = KrServices::fullPathName( "7z" ) + " -y a"; type = "-7z"; } + else if ( type == "xz" ) { packer = KrServices::fullPathName( "xz" ) + " -z"; type = "-xz"; } else return false; TQString password = TQString(); - + if( extraProps.count( "Password" ) > 0 ) { password = extraProps[ "Password" ]; if ( !password.isNull() ) { - if ( type == "-zip" ) + if ( type == "-zip" ) packer += " -P '" + password + "'"; else if ( type == "-arj" ) packer += " -g'" + password + "'"; @@ -473,11 +488,15 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l static const int sevenZipLevels[] = { 0, 1, 2, 4, 5, 6, 7, 8, 9 }; packer += TQString( " -mx%1" ).arg( sevenZipLevels[ level ] ); } + else if( type == "-xz" ) { + static const int xzLevels[] = { 0, 1, 2, 4, 5, 6, 7, 8, 9 }; + packer += TQString( " -%1" ).arg( xzLevels[ level ] ); + } } if( extraProps.count( "CommandLineSwitches" ) > 0 ) packer += TQString( " %1" ).arg( extraProps[ "CommandLineSwitches" ] ); - + // prepare to pack KrShellProcess proc; proc << packer << KrServices::quote( dest ); @@ -505,8 +524,8 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l // check the return value if ( !proc.normalExit() || !checkStatus( type, proc.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to pack %1!" ).arg( dest ), - krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : proc.getErrorMsg(), + KMessageBox::detailedError (krApp, i18n( "Failed to pack %1!" ).arg( dest ), + krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : proc.getErrorMsg(), i18n("Error" ) ); return false; } @@ -522,9 +541,9 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l TQString KRarcHandler::getPassword( TQString path ) { TQString password; - + TQString key = "krarc-" + path; - + if( !TDEWallet::Wallet::keyDoesNotExist(TDEWallet::Wallet::NetworkWallet(), TDEWallet::Wallet::PasswordFolder(), key ) ) { if( !TDEWallet::Wallet::isOpen( TDEWallet::Wallet::NetworkWallet() ) && wallet != 0 ) { delete wallet; @@ -542,7 +561,7 @@ TQString KRarcHandler::getPassword( TQString path ) { } } } - + bool keep = true; TQString user = "archive"; TDEIO::PasswordDialog passDlg( i18n("This archive is encrypted, please supply the password:"), @@ -572,7 +591,7 @@ TQString KRarcHandler::getPassword( TQString path ) { } return password; } - + return ""; } @@ -580,7 +599,7 @@ bool KRarcHandler::isArchive(const KURL& url) { TQString protocol = url.protocol(); if (arcProtocols.find(protocol) != arcProtocols.end()) return true; - else return false; + else return false; } TQString KRarcHandler::getType( bool &encrypted, TQString fileName, TQString mime, bool checkEncrypted ) { @@ -589,10 +608,16 @@ TQString KRarcHandler::getType( bool &encrypted, TQString fileName, TQString mim result = mime; else result = "-" + result; - - if( result.endsWith( "-7z" ) ) + + if (result.endsWith("-7z")) + { result = "-7z"; - + } + if (result.endsWith("-xz")) + { + result = "-xz"; + } + return result.right( 4 ); } @@ -602,9 +627,9 @@ bool KRarcHandler::checkStatus( TQString type, int exitCode ) { return exitCode == 0 || exitCode == 1; else if( type == "-ace" || type == "zip2" || type == "-lha" || type == "-rpm" || type == "cpio" || type == "-tar" || type == "tarz" || type == "-tbz" || type == "-tgz" || type == "-arj" || - type == "-deb" ) + type == "-deb" || type == "-txz" || type == "-xz") return exitCode == 0; - else if( type == "gzip" ) + else if (type == "gzip" || type == "-xz") return exitCode == 0 || exitCode == 2; else return exitCode == 0; @@ -623,27 +648,28 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c {"rpm", 0, "\xed\xab\xee\xdb"}, {"ace", 7, "**ACE**" }, {"bzip2",0, "\x42\x5a\x68\x39\x31" }, - {"gzip", 0, "\x1f\x8b"}, + {"gzip", 0, "\x1f\x8b"}, {"deb", 0, "!\ndebian-binary " }, - {"7z", 0, "7z\xbc\xaf\x27\x1c" } }; + {"7z", 0, "7z\xbc\xaf\x27\x1c" }, + {"xz", 0, "\xfd7zXZ\x00" } }; static int autoDetectElems = sizeof( autoDetectParams ) / sizeof( AutoDetectParams ); - + encrypted = false; - + TQFile arcFile( fileName ); if ( arcFile.open( IO_ReadOnly ) ) { char buffer[ 1024 ]; long sizeMax = arcFile.readBlock( buffer, sizeof( buffer ) ); arcFile.close(); - + for( int i=0; i < autoDetectElems; i++ ) { TQString detectionString = autoDetectParams[ i ].detectionString; int location = autoDetectParams[ i ].location; - + int endPtr = detectionString.length() + location; if( endPtr > sizeMax ) continue; - + unsigned int j=0; for(; j != detectionString.length(); j++ ) { if( detectionString[ j ] == '?' ) @@ -651,7 +677,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c if( buffer[ location + j ] != detectionString[ j ] ) break; } - + if( j == detectionString.length() ) { TQString type = autoDetectParams[ i ].type; if( type == "bzip2" || type == "gzip" ) { @@ -686,7 +712,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c long headerSize = ((unsigned char *)buffer)[ offset+5 ] + 256*((unsigned char *)buffer)[ offset+6 ]; bool isDir = (buffer[ offset+7 ] == '\0' ) && (buffer[ offset+8 ] == '\0' ) && (buffer[ offset+9 ] == '\0' ) && (buffer[ offset+10 ] == '\0' ); - + if( buffer[ offset + 2 ] != (char)0x74 ) break; if( !isDir ) { @@ -706,7 +732,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c long headerSize = ((unsigned char *)buffer)[ offset+2 ] + 256*((unsigned char *)buffer)[ offset+3 ] + 4; bool isDir = (buffer[ offset+11 ] == '\0' ) && (buffer[ offset+12 ] == '\0' ) && (buffer[ offset+13 ] == '\0' ) && (buffer[ offset+14 ] == '\0' ); - + if( buffer[ offset + 4 ] != (char)0x01 ) break; if( !isDir ) { @@ -729,7 +755,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c return type; } } - + if( sizeMax >= 512 ) { /* checking if it's a tar file */ unsigned checksum = 32*8; @@ -749,6 +775,16 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c } } } + + if (fileName.endsWith(".tar.xz")) + { + return "txz"; + } + else if (fileName.endsWith(".xz")) + { + return "xz"; + } + return TQString(); } diff --git a/krusader/defaults.h b/krusader/defaults.h index 82cf1db..309449b 100644 --- a/krusader/defaults.h +++ b/krusader/defaults.h @@ -33,19 +33,19 @@ /////////////////////// [Startup] // UI Save Settings -#define _UiSave false +#define _UiSave false // Show Cmd Line -#define _ShowCmdline true +#define _ShowCmdline true // Show status bar -#define _ShowStatusBar true +#define _ShowStatusBar true // Show tool bar -#define _ShowToolBar true +#define _ShowToolBar true // Show FN Keys -#define _ShowFNkeys true +#define _ShowFNkeys true // Show Terminal Emulator -#define _ShowTerminalEmulator false +#define _ShowTerminalEmulator false // Remember Position -#define _RememberPos true +#define _RememberPos true // Start to tray #define _StartToTray false // Left Tab Bar @@ -60,21 +60,21 @@ // Filelist Font /////// #define _FilelistFont new TQFont(TDEGlobalSettings::generalFont()) // Warn On Exit //////// -#define _WarnOnExit false +#define _WarnOnExit false // Minimize To Tray //// -#define _MinimizeToTray false +#define _MinimizeToTray false // Mark Dirs /////////// -#define _MarkDirs false +#define _MarkDirs false // Show Hidden ///////// -#define _ShowHidden true +#define _ShowHidden true // Sort By Extention /// -#define _SortByExt false +#define _SortByExt false // Case Sensative Sort / -#define _CaseSensativeSort false +#define _CaseSensativeSort false // Html Min Font Size // -#define _HtmlMinFontSize 12 +#define _HtmlMinFontSize 12 // Filelist Icon Size // -#define _FilelistIconSize TQString("22") +#define _FilelistIconSize TQString("22") // Mouse Selection ///// #define _MouseSelection 0 // 0 - normal (shift+click, ctrl+click), 1 - left click, 2 - right click // Use fullpath tab names ///// @@ -82,23 +82,23 @@ // Panel Toolbar Checkboxes // Panel Toolbar Visible checkbox turned off -#define _PanelToolBar true +#define _PanelToolBar true // cd / is turned on -#define _cdRoot true +#define _cdRoot true // cd ~ is turned on -#define _cdHome false +#define _cdHome false // cd .. is turned on -#define _cdUp true +#define _cdUp true // cd other panel is turned on -#define _cdOther false +#define _cdOther false // Open directory is turned on -#define _Open false +#define _Open false // syncBrowseButton is turned on -#define _syncBrowseButton false +#define _syncBrowseButton false // Clear Location Bar Visible #define _ClearLocation true // Use the default colors of KDE -#define _KDEDefaultColors true +#define _KDEDefaultColors true // Enable Alternate Background colors #define _AlternateBackground true // Show current item even if not focussed @@ -124,19 +124,19 @@ /////////////////////// [General] // Mimetype Magic ///// -#define _MimetypeMagic true +#define _MimetypeMagic true // Move To Trash ////// -#define _MoveToTrash false +#define _MoveToTrash false // Terminal /////////// #define _Terminal "konsole" // Send CDs /////////// #define _SendCDs true // Editor ///////////// -#define _Editor "internal editor" +#define _Editor "internal editor" // Temp Directory ///// -#define _TempDirectory "/tmp/krusader.tmp" +#define _TempDirectory "/tmp/krusader.tmp" // Classic Quicksearch -#define _NewStyleQuicksearch true +#define _NewStyleQuicksearch true // Case Sensitive quick search, if _NewStyleQuicksearch is true #define _CaseSensitiveQuicksearch false // View In Separate Window @@ -146,57 +146,59 @@ // Permission Check /// //#define _PermCheck true // AutoMount ////////// -#define _AutoMount false +#define _AutoMount false // Preserving date ////////// #define _PreserveAttributes false // Nonmount Points //// #define _NonMountPoints "/, " // Confirm Unempty Dir // (for delete) -#define _ConfirmUnemptyDir true +#define _ConfirmUnemptyDir true // Confirm Delete ///// (for deleting files) -#define _ConfirmDelete true +#define _ConfirmDelete true // Confirm Copy /////// (for copying files) -#define _ConfirmCopy true +#define _ConfirmCopy true // Confirm Move /////// (for moving files) -#define _ConfirmMove true +#define _ConfirmMove true // Icon Cache Size //// #define _IconCacheSize 2048 /////////////////////// [Archives] // Do Tar ///////////// -#define _DoTar true +#define _DoTar true // Do GZip //////////// -#define _DoGZip true +#define _DoGZip true // Do Zip ///////////// -#define _DoZip true +#define _DoZip true // Do UnZip /////////// -#define _DoUnZip true +#define _DoUnZip true // Do BZip2 /////////// -#define _DoBZip2 true +#define _DoBZip2 true // Do Rar ///////////// -#define _DoRar true +#define _DoRar true // Do UnRar /////////// -#define _DoUnRar true +#define _DoUnRar true // Do UnAce /////////// -#define _DoUnAce true +#define _DoUnAce true // Do Arj ///////////// -#define _DoArj true +#define _DoArj true // Do UnArj /////////// -#define _DoUnarj true +#define _DoUnarj true // Do RPM ///////////// -#define _DoRPM true +#define _DoRPM true // Do DEB ///////////// ====> new #define _DoDEB true // Do Lha ///////////// -#define _DoLha true -// Do 7z ///////////// ====> new +#define _DoLha true +// Do 7z ////////////// ====> new #define _Do7z true +// Do Xz ////////////// +#define _DoXz true // Allow Move Into Archive // -#define _MoveIntoArchive false +#define _MoveIntoArchive false // Test Archives ////// -#define _TestArchives false +#define _TestArchives false // Test Before Unpack //// -#define _TestBeforeUnpack true +#define _TestBeforeUnpack true // Supported Packers // ====> a TQStringList of SYSTEM supported archives ( also new ) /////////////////////// [UserActions] @@ -211,13 +213,13 @@ /////////////////////// [Private] // Start Position ///// -#define _StartPosition new TQPoint(TQApplication::desktop()->width()/2 - mainView->sizeHint().width()/2,TQApplication::desktop()->height()/2 - 250) +#define _StartPosition new TQPoint(TQApplication::desktop()->width()/2 - mainView->sizeHint().width()/2,TQApplication::desktop()->height()/2 - 250) // Start Size ///////// -#define _StartSize new TQSize(mainView->sizeHint().width(),500) +#define _StartSize new TQSize(mainView->sizeHint().width(),500) // Panel Size ///////// -#define _PanelSize 0 +#define _PanelSize 0 // Terminal Size ////// -#define _TerminalSize 0 +#define _TerminalSize 0 // Left Name Size - size of the left panel's name column // Left Size Size - size of the left panel's size column // Left Date Size - size of the left panel's date column @@ -251,33 +253,33 @@ /////////////////////// [Synchronize directories] // Don't overwrite automatically ///////////// -#define _ConfirmOverWrites false +#define _ConfirmOverWrites false // Recursive search in the subdirectories ///////////// -#define _RecurseSubdirs true +#define _RecurseSubdirs true // The searcher follows symlinks ///////////// -#define _FollowSymlinks false +#define _FollowSymlinks false // Files with similar size are compared by content ///////////// -#define _CompareByContent false +#define _CompareByContent false // The date information is ignored at synchronization ///////////// -#define _IgnoreDate false +#define _IgnoreDate false // Asymmetric Client-File Server compare mode ///////////// -#define _Asymmetric false +#define _Asymmetric false // Case insensitive compare in synchronizer ///////////// -#define _IgnoreCase false +#define _IgnoreCase false // Scrolls the results of the synchronization ///////////// -#define _ScrollResults false +#define _ScrollResults false // The right arrow button is turned on ///////////// -#define _BtnLeftToRight true +#define _BtnLeftToRight true // The equals button is turned on ///////////// -#define _BtnEquals true +#define _BtnEquals true // The not equals button is turned on ///////////// -#define _BtnDifferents true +#define _BtnDifferents true // The left arrow button is turned on ///////////// -#define _BtnRightToLeft true +#define _BtnRightToLeft true // The trash button is turned on ///////////// -#define _BtnDeletable true +#define _BtnDeletable true // The duplicates button is turned on ///////////// -#define _BtnDuplicates true +#define _BtnDuplicates true // The singles button is turned on ///////////// #define _BtnSingles true diff --git a/krusader/krusader.cpp b/krusader/krusader.cpp index 2545aa5..560426a 100644 --- a/krusader/krusader.cpp +++ b/krusader/krusader.cpp @@ -5,10 +5,10 @@ copyright : (C) 2000 by Shie Erlich & Rafi Yanai e-mail : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- -Description +Description *************************************************************************** -A +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 @@ -28,7 +28,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD * * ***************************************************************************/ #include -#include +#include #include #include #ifdef BSD @@ -51,7 +51,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD #include #endif -#include +#include // QT includes #include #include @@ -59,7 +59,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD #include #include #include -#include +#include #include #include #include @@ -181,7 +181,7 @@ TDERadioAction *Krusader::actSelectSingle = 0; TDERadioAction *Krusader::actSelectNewer = 0; TDERadioAction *Krusader::actSelectDifferentAndSingle = 0; TDERadioAction *Krusader::actSelectDifferent = 0; -TDERadioAction **Krusader::compareArray[] = {&actSelectNewerAndSingle, &actSelectNewer, &actSelectSingle, +TDERadioAction **Krusader::compareArray[] = {&actSelectNewerAndSingle, &actSelectNewer, &actSelectSingle, &actSelectDifferentAndSingle, &actSelectDifferent, 0}; TDERadioAction *Krusader::actExecStartAndForget = 0; TDERadioAction *Krusader::actExecCollectSeparate = 0; @@ -278,7 +278,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T int rightActiveTab = krConfig->readNumEntry( "Right Active Tab", 0 ); TQString startProfile = krConfig->readEntry("Starter Profile Name", TQString() ); bool leftActive = krConfig->readBoolEntry( "Left Side Is Active", false ); - + // get command-line arguments if ( args->isSet( "left" ) ) { leftTabs = TQStringList::split( ',', args->getOption( "left" ) ); @@ -329,8 +329,8 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T leftTabs.clear(); leftTabTypes.clear(); leftTabProps.clear(); - rightTabs.clear(); - rightTabTypes.clear(); + rightTabs.clear(); + rightTabTypes.clear(); rightTabProps.clear(); leftActiveTab = rightActiveTab = 0; } @@ -349,7 +349,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T } // starting the panels - mainView->start( leftTabs, leftTabTypes, leftTabProps, leftActiveTab, rightTabs, + mainView->start( leftTabs, leftTabTypes, leftTabProps, leftActiveTab, rightTabs, rightTabTypes, rightTabProps, rightActiveTab, leftActive ); // create the user menu @@ -397,7 +397,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T if ( runKonfig ) slot->runKonfigurator( true ); - + if (!runKonfig) { config->setGroup( "Private" ); if ( krConfig->readBoolEntry( "Maximized" ) ) @@ -407,7 +407,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T resize( oldSize = krConfig->readSizeEntry( "Start Size", _StartSize )); } } - + if( startToTray ) { sysTray->show(); hide(); @@ -436,7 +436,7 @@ bool Krusader::versionControl() { config = kapp->config(); bool firstRun = config->readBoolEntry(FIRST_RUN, true); -#if 0 +#if 0 TQString oldVerText = config->readEntry( "Version", "10.0" ); oldVerText.truncate( oldVerText.findRev( "." ) ); // remove the third dot float oldVer = oldVerText.toFloat(); @@ -459,13 +459,28 @@ bool Krusader::versionControl() { } config->writeEntry( "Version", VERSION ); config->writeEntry( FIRST_RUN, false); + + // Check whether Krusader is run for the first time under a new TDE version. + TQString lastVersion = config->readEntry("Last version"); + if (lastVersion != TDE_VERSION_STRING) + { + config->writeEntry("Last version", TDE_VERSION_STRING); + if (!retval) + { + KMessageBox::information(krApp, i18n( "Welcome to Krusader!

As this is your first run " + "under TDE " TDE_VERSION_STRING ", your machine will now be checked for external applications updates. " + "Then the Konfigurator will be launched where you can customize Krusader to your needs.

" ) ); + } + retval = true; + } + config->sync(); return retval; } void Krusader::statusBarUpdate( TQString& mess ) { // change the message on the statusbar for 2 seconds - if (status) // ugly!!!! But as statusBar() creates a status bar if there is no, I have to ask status to prevent + if (status) // ugly!!!! But as statusBar() creates a status bar if there is no, I have to ask status to prevent // the creation of the TDE default status bar instead of KrusaderStatus. statusBar() ->message( mess, 5000 ); } @@ -476,7 +491,7 @@ void Krusader::showEvent ( TQShowEvent * ) { config->setGroup( "Look&Feel" ); bool showTrayIcon = krConfig->readBoolEntry( "Minimize To Tray", _MinimizeToTray ); bool singleInstanceMode = krConfig->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ); - + if( showTrayIcon && !singleInstanceMode ) sysTray->hide(); show(); // needed to make sure krusader is removed from @@ -706,7 +721,7 @@ void Krusader::setupActions() { actRoot = new TDEAction( i18n( "Root" ), "go-top", CTRL + Key_Backspace, SLOTS, TQT_SLOT( root() ), actionCollection(), "root" ); actSavePosition = new TDEAction( i18n( "Save &Position" ), 0, - TQT_TQOBJECT(krApp), TQT_SLOT( savePosition() ), actionCollection(), "save position" ); + TQT_TQOBJECT(krApp), TQT_SLOT( savePosition() ), actionCollection(), "save position" ); actAllFilter = new TDEAction( i18n( "&All Files" ), SHIFT + Key_F10, SLOTS, TQT_SLOT( allFilter() ), actionCollection(), "all files" ); //actExecFilter = new TDEAction( i18n( "&Executables" ), SHIFT + Key_F11, @@ -745,7 +760,7 @@ void Krusader::setupActions() { SLOTS, TQT_SLOT( newSymlink() ), actionCollection(), "new symlink"); new TDEToggleAction( i18n( "Toggle Popup Panel" ), ALT + Key_Down, SLOTS, TQT_SLOT( togglePopupPanel() ), actionCollection(), "toggle popup panel" ); - actVerticalMode = new TDEToggleAction( i18n( "Vertical Mode" ), "view_top_bottom", ALT + CTRL + Key_R, TQT_TQOBJECT(MAIN_VIEW), + actVerticalMode = new TDEToggleAction( i18n( "Vertical Mode" ), "view_top_bottom", ALT + CTRL + Key_R, TQT_TQOBJECT(MAIN_VIEW), TQT_SLOT( toggleVerticalMode() ), actionCollection(), "toggle vertical mode" ); actNewTab = new TDEAction( i18n( "New Tab" ), "tab_new", ALT + CTRL + Key_N, SLOTS, TQT_SLOT( newTab() ), actionCollection(), "new tab" ); @@ -833,11 +848,11 @@ void Krusader::savePosition() { mainView->right->popup->saveSizes(); if( !MAIN_VIEW->getTerminalEmulatorSplitterSizes().isEmpty() ) config->writeEntry( "Terminal Emulator Splitter Sizes", MAIN_VIEW->getTerminalEmulatorSplitterSizes() ); - + // save view settings ---> fix when we have tabbed-browsing mainView->left->view->saveSettings(); mainView->right->view->saveSettings(); - + config->setGroup( "Startup" ); config->writeEntry( "Vertical Mode", actVerticalMode->isChecked()); config->sync(); @@ -846,13 +861,13 @@ void Krusader::savePosition() { void Krusader::saveSettings() { toolBar() ->saveSettings( krConfig, "Private" ); toolBar("actionsToolBar")->saveSettings( krConfig, "Actions Toolbar" ); - config->setGroup( "Startup" ); + config->setGroup( "Startup" ); config->writeEntry( "Left Active Tab", mainView->leftMng->activeTab() ); config->writeEntry( "Right Active Tab", mainView->rightMng->activeTab() ); config->writeEntry( "Left Side Is Active", MAIN_VIEW->activePanel->isLeft() ); mainView->leftMng->saveSettings( krConfig, "Left Tab Bar" ); mainView->rightMng->saveSettings( krConfig, "Right Tab Bar" ); - + bool rememberpos = config->readBoolEntry( "Remember Position", _RememberPos ); bool uisavesettings = config->readBoolEntry( "UI Save Settings", _UiSave ); @@ -898,7 +913,7 @@ void Krusader::configChanged() { config->setGroup( "Look&Feel" ); bool minimizeToTray = config->readBoolEntry( "Minimize To Tray", _MinimizeToTray ); bool singleInstanceMode = config->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ); - + if( !isHidden() ) { if( singleInstanceMode && minimizeToTray ) sysTray->show(); @@ -918,9 +933,9 @@ void Krusader::slotClose() { bool Krusader::queryClose() { if( isStarting || isExiting ) return false; - + if( kapp->sessionSaving() ) // KDE is logging out, accept the close - { + { saveSettings(); kapp->dcopClient()->registerAs( TDEApplication::kApplication()->name(), true ); @@ -929,9 +944,9 @@ bool Krusader::queryClose() { kapp->deref(); // and close the application return isExiting = true; // this will also kill the pending jobs } - + krConfig->setGroup( "Look&Feel" ); - if( !directExit && krConfig->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ) && + if( !directExit && krConfig->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ) && krConfig->readBoolEntry( "Minimize To Tray", _MinimizeToTray ) ) { hide(); return false; @@ -942,7 +957,7 @@ bool Krusader::queryClose() { directExit = false; bool quit = true; - + if ( krConfig->readBoolEntry( "Warn On Exit", _WarnOnExit ) ) { switch ( KMessageBox::warningYesNo( this, i18n( "Are you sure you want to quit?" ) ) ) { @@ -989,11 +1004,11 @@ bool Krusader::queryClose() { if( w->inherits( TQDIALOG_OBJECT_NAME_STRING ) ) fprintf( stderr, "Failed to close: %s\n", w->className() ); - + return false; } } - + saveSettings(); isExiting = true; @@ -1016,8 +1031,8 @@ void Krusader::startWaiting( TQString msg, int count , bool cancel ) { plzWait->startWaiting( msg , count, cancel ); } -bool Krusader::wasWaitingCancelled() const { - return plzWait->wasCancelled(); +bool Krusader::wasWaitingCancelled() const { + return plzWait->wasCancelled(); } void Krusader::incProgress( TDEProcess *, char *buffer, int buflen ) { @@ -1039,18 +1054,18 @@ void Krusader::updateGUI( bool enforce ) { // call the XML GUI function to draw the UI createGUI( mainView->konsole_part ); - + // this needs to be called AFTER createGUI() !!! userActionMenu = (TDEPopupMenu*) guiFactory()->container( "useractionmenu", this ); if ( userActionMenu ) userAction->populateMenu( userActionMenu ); - + toolBar() ->applySettings( krConfig, "Private" ); - + toolBar("actionsToolBar") ->applySettings( krConfig, "Actions Toolbar" ); static_cast(actionCollection()->action("toggle actions toolbar"))-> setChecked(toolBar("actionsToolBar")->isVisible()); - + if ( enforce ) { // now, hide what need to be hidden if ( !krConfig->readBoolEntry( "Show tool bar", _ShowToolBar ) ) { -- cgit v1.2.3