[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Speedbar in Filedialog toggleable
From:       Carsten Pfeiffer <carpdjih () cetus ! zrz ! tu-berlin ! de>
Date:       2002-03-09 1:55:27
[Download RAW message or body]

Hiya,

some people asked for making the speedbar optional in KFileDialog. I asked on 
kde-i18n-doc for approval of the new string, but got no response.

So here's the patch -- if people want it committed, tell me, otherwise you 
need to patch your sources yourself.

PS: yes, it's the "lazy" way of simply hiding the speedbar instead of not 
creating it in the first place. That can wait for the next release.

Cheers
Carsten Pfeiffer
["speedbar.patch" (text/x-diff)]

? temp
? test
? kfilednddetailview.cpp
? patch
? test2
? kfiledndiconview.h
? kfilednddetailview.h
? speedbar.patch
? kicondialog.patch
? kdirselect.h
? kdirselect.cpp
? kfiledndiconview.cpp
? ideas.log
? kfile.patch
? DESIGN
? tests/foo.txt
Index: config-kfile.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kfile/config-kfile.h,v
retrieving revision 1.17
diff -u -p -B -w -r1.17 config-kfile.h
--- config-kfile.h	2001/05/29 19:51:55	1.17
+++ config-kfile.h	2002/03/09 01:50:17
@@ -24,5 +24,6 @@ const int kfile_area = 250;
 #define AutoDirectoryFollowing QString::fromLatin1("Automatic directory following")
 #define PathComboCompletionMode QString::fromLatin1("PathCombo Completionmode")
 #define LocationComboCompletionMode QString::fromLatin1("LocationCombo Completionmode")
+#define ShowSpeedbar QString::fromLatin1("Show Speedbar")
 
 #endif
Index: kfiledialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kfile/kfiledialog.cpp,v
retrieving revision 1.294
diff -u -p -B -w -r1.294 kfiledialog.cpp
--- kfiledialog.cpp	2002/03/07 01:52:51	1.294
+++ kfiledialog.cpp	2002/03/09 01:50:18
@@ -310,6 +310,11 @@ KFileDialog::KFileDialog(const QString& 
                           i18n("Configure this dialog"));
     */
 
+    KToggleAction *showSidebarAction = 
+        new KToggleAction(i18n("Show Sidebar"), Key_F9, coll,"toggleSpeedbar");
+    connect( showSidebarAction, SIGNAL( toggled( bool ) ),
+             SLOT( toggleSpeedbar( bool )) );
+
     KActionMenu *menu = new KActionMenu( i18n("Extras"), "misc", this, "extra menu" );
     menu->insert( coll->action( "mkdir" ));
     menu->insert( coll->action( "delete" ));
@@ -317,6 +322,7 @@ KFileDialog::KFileDialog(const QString& 
     menu->insert( coll->action( "sorting menu" ));
     menu->insert( coll->action( "separator" ));
     menu->insert( coll->action( "view menu" ));
+    menu->insert( showSidebarAction );
     menu->insert( coll->action( "separator" ));
     menu->insert( coll->action( "properties" ));
     menu->setDelayed( false );
@@ -1557,6 +1563,10 @@ void KFileDialog::readConfig( KConfig *k
     if ( cm != KGlobalSettings::completionMode() )
 	locationEdit->setCompletionMode( cm );
 
+    bool showSpeedbar = kc->readBoolEntry(ShowSpeedbar, true);
+    toggleSpeedbar( showSpeedbar );
+    ((KToggleAction *) actionCollection()->action("toggleSpeedbar"))->setChecked( showSpeedbar );
+    
     int w1 = minimumSize().width();
     int w2 = toolbar->sizeHint().width() + 10;
     if (w1 < w2)
@@ -1580,6 +1590,7 @@ void KFileDialog::writeConfig( KConfig *
     saveDialogSize( group, true );
     kc->writeEntry( PathComboCompletionMode, d->pathCombo->completionMode() );
     kc->writeEntry(LocationComboCompletionMode,locationEdit->completionMode());
+    kc->writeEntry( ShowSpeedbar, !d->urlBar->isHidden() );
 
     ops->writeConfig( kc, group );
     kc->setGroup( oldGroup );
@@ -1675,6 +1686,14 @@ void KFileDialog::addToRecentDocuments()
 KActionCollection * KFileDialog::actionCollection() const
 {
     return ops->actionCollection();
+}
+
+void KFileDialog::toggleSpeedbar( bool show )
+{
+    if ( show )
+        d->urlBar->show();
+    else
+        d->urlBar->hide();
 }
 
 #include "kfiledialog.moc"
Index: kfiledialog.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kfile/kfiledialog.h,v
retrieving revision 1.108
diff -u -p -B -w -r1.108 kfiledialog.h
--- kfiledialog.h	2002/03/04 13:41:17	1.108
+++ kfiledialog.h	2002/03/09 01:50:18
@@ -733,6 +733,8 @@ protected slots:
     void dirCompletion( const QString& );
     void fileCompletion( const QString& );
 
+    void toggleSpeedbar( bool );
+    
     virtual void updateStatusLine(int dirs, int files);
     virtual void slotOk();
     virtual void accept();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic