00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "katefileselector.h"
00023 #include "katefileselector.moc"
00024
00025 #include "katemainwindow.h"
00026 #include "kateviewmanager.h"
00027 #include "kbookmarkhandler.h"
00028
00029 #include <kio/netaccess.h>
00030
00031 #include "kactionselector.h"
00032
00033 #include <qlayout.h>
00034 #include <qtoolbutton.h>
00035 #include <qhbox.h>
00036 #include <qvbox.h>
00037 #include <qlabel.h>
00038 #include <qstrlist.h>
00039 #include <qtooltip.h>
00040 #include <qwhatsthis.h>
00041 #include <qapplication.h>
00042 #include <qlistbox.h>
00043 #include <qscrollbar.h>
00044 #include <qspinbox.h>
00045 #include <qgroupbox.h>
00046 #include <qcheckbox.h>
00047 #include <qregexp.h>
00048 #include <qdockarea.h>
00049 #include <qtimer.h>
00050 #include <qdir.h>
00051
00052 #include <kapplication.h>
00053 #include <kiconloader.h>
00054 #include <kurlcombobox.h>
00055 #include <kurlcompletion.h>
00056 #include <kprotocolinfo.h>
00057 #include <kdiroperator.h>
00058 #include <kconfig.h>
00059 #include <klocale.h>
00060 #include <kcombobox.h>
00061 #include <kaction.h>
00062 #include <kmessagebox.h>
00063 #include <ktoolbarbutton.h>
00064 #include <qtoolbar.h>
00065 #include <kpopupmenu.h>
00066 #include <kdialog.h>
00067 #include <kio/netaccess.h>
00068
00069 #include <kdebug.h>
00070
00071
00072
00073
00074 static void silenceQToolBar(QtMsgType, const char *){}
00075
00076
00077 KateFileSelectorToolBar::KateFileSelectorToolBar(QWidget *parent)
00078 : KToolBar( parent, "Kate FileSelector Toolbar", true )
00079 {
00080 setMinimumWidth(10);
00081 }
00082
00083 KateFileSelectorToolBar::~KateFileSelectorToolBar(){}
00084
00085 void KateFileSelectorToolBar::setMovingEnabled( bool)
00086 {
00087 KToolBar::setMovingEnabled(false);
00088 }
00089
00090
00091 KateFileSelectorToolBarParent::KateFileSelectorToolBarParent(QWidget *parent)
00092 :QFrame(parent),m_tb(0){}
00093 KateFileSelectorToolBarParent::~KateFileSelectorToolBarParent(){}
00094 void KateFileSelectorToolBarParent::setToolBar(KateFileSelectorToolBar *tb)
00095 {
00096 m_tb=tb;
00097 }
00098
00099 void KateFileSelectorToolBarParent::resizeEvent ( QResizeEvent * )
00100 {
00101 if (m_tb)
00102 {
00103 setMinimumHeight(m_tb->sizeHint().height());
00104 m_tb->resize(width(),height());
00105 }
00106 }
00107
00108
00109
00110
00111 KateFileSelector::KateFileSelector( KateMainWindow *mainWindow,
00112 KateViewManager *viewManager,
00113 QWidget * parent, const char * name )
00114 : QWidget(parent, name),
00115 mainwin(mainWindow),
00116 viewmanager(viewManager)
00117 {
00118 mActionCollection = new KActionCollection( this );
00119
00120 QVBoxLayout* lo = new QVBoxLayout(this);
00121
00122 QtMsgHandler oldHandler = qInstallMsgHandler( silenceQToolBar );
00123
00124 KateFileSelectorToolBarParent *tbp=new KateFileSelectorToolBarParent(this);
00125 toolbar = new KateFileSelectorToolBar(tbp);
00126 tbp->setToolBar(toolbar);
00127 lo->addWidget(tbp);
00128 toolbar->setMovingEnabled(false);
00129 toolbar->setFlat(true);
00130 qInstallMsgHandler( oldHandler );
00131
00132 cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" );
00133 cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
00134 KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion);
00135 cmbPath->setCompletionObject( cmpl );
00136 cmbPath->setAutoDeleteCompletionObject( true );
00137 lo->addWidget(cmbPath);
00138 cmbPath->listBox()->installEventFilter( this );
00139
00140 dir = new KDirOperator(KURL(), this, "operator");
00141 dir->setView(KFile::Detail);
00142 dir->view()->setSelectionMode(KFile::Multi);
00143
00144 KActionCollection *coll = dir->actionCollection();
00145
00146 coll->action( "delete" )->setShortcut( KShortcut( ALT + Key_Delete ) );
00147 coll->action( "reload" )->setShortcut( KShortcut( ALT + Key_F5 ) );
00148 coll->action( "back" )->setShortcut( KShortcut( ALT + SHIFT + Key_Left ) );
00149 coll->action( "forward" )->setShortcut( KShortcut( ALT + SHIFT + Key_Right ) );
00150
00151 coll->action( "up" )->setShortcut( KShortcut( ALT + SHIFT + Key_Up ) );
00152 coll->action( "home" )->setShortcut( KShortcut( CTRL + ALT + Key_Home ) );
00153
00154 lo->addWidget(dir);
00155 lo->setStretchFactor(dir, 2);
00156
00157
00158 KActionMenu *acmBookmarks = new KActionMenu( i18n("Bookmarks"), "bookmark",
00159 mActionCollection, "bookmarks" );
00160 acmBookmarks->setDelayed( false );
00161 bookmarkHandler = new KBookmarkHandler( this, acmBookmarks->popupMenu() );
00162 QHBox* filterBox = new QHBox(this);
00163
00164 btnFilter = new QToolButton( filterBox );
00165 btnFilter->setIconSet( SmallIconSet("filter" ) );
00166 btnFilter->setToggleButton( true );
00167 filter = new KHistoryCombo( true, filterBox, "filter");
00168 filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
00169 filterBox->setStretchFactor(filter, 2);
00170 connect( btnFilter, SIGNAL( clicked() ), this, SLOT( btnFilterClick() ) );
00171 lo->addWidget(filterBox);
00172
00173 connect( filter, SIGNAL( activated(const QString&) ),
00174 SLOT( slotFilterChange(const QString&) ) );
00175 connect( filter, SIGNAL( returnPressed(const QString&) ),
00176 filter, SLOT( addToHistory(const QString&) ) );
00177
00178
00179 acSyncDir = new KAction( i18n("Current Document Folder"), "curfiledir", 0,
00180 this, SLOT( setActiveDocumentDir() ), mActionCollection, "sync_dir" );
00181 toolbar->setIconText( KToolBar::IconOnly );
00182 toolbar->setIconSize( 16 );
00183 toolbar->setEnableContextMenu( false );
00184
00185 connect( cmbPath, SIGNAL( urlActivated( const KURL& )),
00186 this, SLOT( cmbPathActivated( const KURL& ) ));
00187 connect( cmbPath, SIGNAL( returnPressed( const QString& )),
00188 this, SLOT( cmbPathReturnPressed( const QString& ) ));
00189 connect(dir, SIGNAL(urlEntered(const KURL&)),
00190 this, SLOT(dirUrlEntered(const KURL&)) );
00191
00192 connect(dir, SIGNAL(finishedLoading()),
00193 this, SLOT(dirFinishedLoading()) );
00194
00195
00196 connect ( viewmanager, SIGNAL( viewChanged() ),
00197 this, SLOT( kateViewChanged() ) );
00198
00199
00200 connect( bookmarkHandler, SIGNAL( openURL( const QString& )),
00201 this, SLOT( setDir( const QString& ) ) );
00202
00203 waitingUrl = QString::null;
00204
00205
00206 QWhatsThis::add( cmbPath,
00207 i18n("<p>Here you can enter a path for a folder to display."
00208 "<p>To go to a folder previously entered, press the arrow on "
00209 "the right and choose one. <p>The entry has folder "
00210 "completion. Right-click to choose how completion should behave.") );
00211 QWhatsThis::add( filter,
00212 i18n("<p>Here you can enter a name filter to limit which files are displayed."
00213 "<p>To clear the filter, toggle off the filter button to the left."
00214 "<p>To reapply the last filter used, toggle on the filter button." ) );
00215 QWhatsThis::add( btnFilter,
00216 i18n("<p>This button clears the name filter when toggled off, or "
00217 "reapplies the last filter used when toggled on.") );
00218
00219 }
00220
00221 KateFileSelector::~KateFileSelector()
00222 {
00223 }
00224
00225
00226
00227
00228 void KateFileSelector::readConfig(KConfig *config, const QString & name)
00229 {
00230 dir->setViewConfig( config, name + ":view" );
00231 dir->readConfig(config, name + ":dir");
00232 dir->setView( KFile::Default );
00233 dir->view()->setSelectionMode(KFile::Multi);
00234 config->setGroup( name );
00235
00236
00237 setupToolbar( config );
00238
00239 cmbPath->setMaxItems( config->readNumEntry( "pathcombo history len", 9 ) );
00240 cmbPath->setURLs( config->readPathListEntry( "dir history" ) );
00241
00242 if ( config->readBoolEntry( "restore location", true ) || kapp->isRestored() ) {
00243 QString loc( config->readPathEntry( "location" ) );
00244 if ( ! loc.isEmpty() ) {
00245
00246
00247 setDir( loc );
00248 }
00249 }
00250
00251
00252
00253 filter->setMaxCount( config->readNumEntry( "filter history len", 9 ) );
00254 filter->setHistoryItems( config->readListEntry("filter history"), true );
00255 lastFilter = config->readEntry( "last filter" );
00256 QString flt("");
00257 if ( config->readBoolEntry( "restore last filter", true ) || kapp->isRestored() )
00258 flt = config->readEntry("current filter");
00259 filter->lineEdit()->setText( flt );
00260 slotFilterChange( flt );
00261
00262 autoSyncEvents = config->readNumEntry( "AutoSyncEvents", 0 );
00263 }
00264
00265 void KateFileSelector::initialDirChangeHack()
00266 {
00267 setDir( waitingDir );
00268 }
00269
00270 void KateFileSelector::setupToolbar( KConfig *config )
00271 {
00272 toolbar->clear();
00273 QStringList tbactions = config->readListEntry( "toolbar actions", ',' );
00274 if ( tbactions.isEmpty() ) {
00275
00276 tbactions << "up" << "back" << "forward" << "home" <<
00277 "short view" << "detailed view" <<
00278 "bookmarks" << "sync_dir";
00279 }
00280 KAction *ac;
00281 for ( QStringList::Iterator it=tbactions.begin(); it != tbactions.end(); ++it ) {
00282 if ( *it == "bookmarks" || *it == "sync_dir" )
00283 ac = mActionCollection->action( (*it).latin1() );
00284 else
00285 ac = dir->actionCollection()->action( (*it).latin1() );
00286 if ( ac )
00287 ac->plug( toolbar );
00288 }
00289 }
00290
00291 void KateFileSelector::writeConfig(KConfig *config, const QString & name)
00292 {
00293 dir->writeConfig(config,name + ":dir");
00294
00295 config->setGroup( name );
00296 config->writeEntry( "pathcombo history len", cmbPath->maxItems() );
00297 QStringList l;
00298 for (int i = 0; i < cmbPath->count(); i++) {
00299 l.append( cmbPath->text( i ) );
00300 }
00301 config->writePathEntry( "dir history", l );
00302 config->writePathEntry( "location", cmbPath->currentText() );
00303
00304 config->writeEntry( "filter history len", filter->maxCount() );
00305 config->writeEntry( "filter history", filter->historyItems() );
00306 config->writeEntry( "current filter", filter->currentText() );
00307 config->writeEntry( "last filter", lastFilter );
00308 config->writeEntry( "AutoSyncEvents", autoSyncEvents );
00309 }
00310
00311 void KateFileSelector::setView(KFile::FileView view)
00312 {
00313 dir->setView(view);
00314 dir->view()->setSelectionMode(KFile::Multi);
00315 }
00316
00317
00318
00319
00320
00321 void KateFileSelector::slotFilterChange( const QString & nf )
00322 {
00323 QString f = nf.stripWhiteSpace();
00324 bool empty = f.isEmpty() || f == "*";
00325 QToolTip::remove( btnFilter );
00326 if ( empty ) {
00327 dir->clearFilter();
00328 filter->lineEdit()->setText( QString::null );
00329 QToolTip::add( btnFilter,
00330 QString( i18n("Apply last filter (\"%1\")") ).arg( lastFilter ) );
00331 }
00332 else {
00333 dir->setNameFilter( f );
00334 lastFilter = f;
00335 QToolTip::add( btnFilter, i18n("Clear filter") );
00336 }
00337 btnFilter->setOn( !empty );
00338 dir->updateDir();
00339
00340 btnFilter->setEnabled( !( empty && lastFilter.isEmpty() ) );
00341
00342 }
00343
00344 bool kateFileSelectorIsReadable ( const KURL& url )
00345 {
00346 if ( !url.isLocalFile() )
00347 return true;
00348
00349 QDir dir (url.path());
00350 return dir.exists ();
00351 }
00352
00353 void KateFileSelector::setDir( KURL u )
00354 {
00355 KURL newurl;
00356
00357 if ( !u.isValid() )
00358 newurl.setPath( QDir::homeDirPath() );
00359 else
00360 newurl = u;
00361
00362 QString pathstr = newurl.path(+1);
00363 newurl.setPath(pathstr);
00364
00365 if ( !kateFileSelectorIsReadable ( newurl ) )
00366 newurl.cd(QString::fromLatin1(".."));
00367
00368 if ( !kateFileSelectorIsReadable (newurl) )
00369 newurl.setPath( QDir::homeDirPath() );
00370
00371 dir->setURL(newurl, true);
00372 }
00373
00374
00375
00376
00377
00378 void KateFileSelector::cmbPathActivated( const KURL& u )
00379 {
00380 cmbPathReturnPressed( u.url() );
00381 }
00382
00383 void KateFileSelector::cmbPathReturnPressed( const QString& u )
00384 {
00385
00386 KURL typedURL( u );
00387 if ( typedURL.hasPass() )
00388 typedURL.setPass( QString::null );
00389 QStringList urls = cmbPath->urls();
00390 urls.remove( typedURL.url() );
00391 urls.prepend( typedURL.url() );
00392 cmbPath->setURLs( urls, KURLComboBox::RemoveBottom );
00393 dir->setFocus();
00394 dir->setURL( KURL(u), true );
00395 }
00396
00397 void KateFileSelector::dirUrlEntered( const KURL& u )
00398 {
00399 cmbPath->setURL( u );
00400 }
00401
00402 void KateFileSelector::dirFinishedLoading()
00403 {
00404 }
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414 void KateFileSelector::btnFilterClick()
00415 {
00416 if ( !btnFilter->isOn() ) {
00417 slotFilterChange( QString::null );
00418 }
00419 else {
00420 filter->lineEdit()->setText( lastFilter );
00421 slotFilterChange( lastFilter );
00422 }
00423 }
00424
00425
00426 void KateFileSelector::setActiveDocumentDir()
00427 {
00428
00429 KURL u = mainwin->activeDocumentUrl();
00430
00431 if (!u.isEmpty())
00432 setDir( u.upURL() );
00433
00434 }
00435
00436 void KateFileSelector::kateViewChanged()
00437 {
00438 if ( autoSyncEvents & DocumentChanged )
00439 {
00440 kdDebug(13001)<<"KateFileSelector::do a sync ()"<<endl;
00441
00442 if ( isVisible() ) {
00443 setActiveDocumentDir();
00444 waitingUrl = QString::null;
00445 }
00446
00447 else {
00448 KURL u = mainwin->activeDocumentUrl();
00449 if (!u.isEmpty())
00450 waitingUrl = u.directory();
00451 }
00452 }
00453
00454
00455
00456 acSyncDir->setEnabled( ! mainwin->activeDocumentUrl().directory().isEmpty() );
00457 }
00458
00459
00460
00461
00462
00463 void KateFileSelector::focusInEvent( QFocusEvent * )
00464 {
00465 dir->setFocus();
00466 }
00467
00468 void KateFileSelector::showEvent( QShowEvent * )
00469 {
00470
00471 if ( autoSyncEvents & GotVisible ) {
00472
00473 setActiveDocumentDir();
00474 waitingUrl = QString::null;
00475 }
00476
00477 else if ( ! waitingUrl.isEmpty() ) {
00478 setDir( waitingUrl );
00479 waitingUrl = QString::null;
00480 }
00481 }
00482
00483 bool KateFileSelector::eventFilter( QObject* o, QEvent *e )
00484 {
00485
00486
00487
00488
00489
00490
00491
00492 QListBox *lb = cmbPath->listBox();
00493 if ( o == lb && e->type() == QEvent::Show ) {
00494 int add = lb->height() < lb->contentsHeight() ? lb->verticalScrollBar()->width() : 0;
00495 int w = QMIN( mainwin->width(), lb->contentsWidth() + add );
00496 lb->resize( w, lb->height() );
00497
00498
00499
00500 }
00501
00502 return QWidget::eventFilter( o, e );
00503 }
00504
00505
00506
00507
00508
00509
00510
00511
00512 class ActionLBItem : public QListBoxPixmap {
00513 public:
00514 ActionLBItem( QListBox *lb=0,
00515 const QPixmap &pm = QPixmap(),
00516 const QString &text=QString::null,
00517 const QString &str=QString::null ) :
00518 QListBoxPixmap( lb, pm, text ),
00519 _str(str) {};
00520 QString idstring() { return _str; };
00521 private:
00522 QString _str;
00523 };
00524
00525
00526
00528
00530 KFSConfigPage::KFSConfigPage( QWidget *parent, const char *name, KateFileSelector *kfs )
00531 : Kate::ConfigPage( parent, name ),
00532 fileSelector( kfs ),
00533 bDirty( false )
00534 {
00535 QVBoxLayout *lo = new QVBoxLayout( this );
00536 int spacing = KDialog::spacingHint();
00537 lo->setSpacing( spacing );
00538
00539
00540 QGroupBox *gbToolbar = new QGroupBox( 1, Qt::Vertical, i18n("Toolbar"), this );
00541 acSel = new KActionSelector( gbToolbar );
00542 acSel->setAvailableLabel( i18n("A&vailable actions:") );
00543 acSel->setSelectedLabel( i18n("S&elected actions:") );
00544 lo->addWidget( gbToolbar );
00545 connect( acSel, SIGNAL( added( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
00546 connect( acSel, SIGNAL( removed( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
00547 connect( acSel, SIGNAL( movedUp( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
00548 connect( acSel, SIGNAL( movedDown( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
00549
00550
00551 QGroupBox *gbSync = new QGroupBox( 1, Qt::Horizontal, i18n("Auto Synchronization"), this );
00552 cbSyncActive = new QCheckBox( i18n("When a docu&ment becomes active"), gbSync );
00553 cbSyncShow = new QCheckBox( i18n("When the file selector becomes visible"), gbSync );
00554 lo->addWidget( gbSync );
00555 connect( cbSyncActive, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00556 connect( cbSyncShow, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00557
00558
00559 QHBox *hbPathHist = new QHBox ( this );
00560 QLabel *lbPathHist = new QLabel( i18n("Remember &locations:"), hbPathHist );
00561 sbPathHistLength = new QSpinBox( hbPathHist );
00562 lbPathHist->setBuddy( sbPathHistLength );
00563 lo->addWidget( hbPathHist );
00564 connect( sbPathHistLength, SIGNAL( valueChanged ( int ) ), this, SLOT( slotChanged() ) );
00565
00566 QHBox *hbFilterHist = new QHBox ( this );
00567 QLabel *lbFilterHist = new QLabel( i18n("Remember &filters:"), hbFilterHist );
00568 sbFilterHistLength = new QSpinBox( hbFilterHist );
00569 lbFilterHist->setBuddy( sbFilterHistLength );
00570 lo->addWidget( hbFilterHist );
00571 connect( sbFilterHistLength, SIGNAL( valueChanged ( int ) ), this, SLOT( slotChanged() ) );
00572
00573
00574 QGroupBox *gbSession = new QGroupBox( 1, Qt::Horizontal, i18n("Session"), this );
00575 cbSesLocation = new QCheckBox( i18n("Restore loca&tion"), gbSession );
00576 cbSesFilter = new QCheckBox( i18n("Restore last f&ilter"), gbSession );
00577 lo->addWidget( gbSession );
00578 connect( cbSesLocation, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00579 connect( cbSesFilter, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00580
00581
00582 lo->addStretch( 1 );
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595 QString lhwt( i18n(
00596 "<p>Decides how many locations to keep in the history of the location "
00597 "combo box.") );
00598 QWhatsThis::add( lbPathHist, lhwt );
00599 QWhatsThis::add( sbPathHistLength, lhwt );
00600 QString fhwt( i18n(
00601 "<p>Decides how many filters to keep in the history of the filter "
00602 "combo box.") );
00603 QWhatsThis::add( lbFilterHist, fhwt );
00604 QWhatsThis::add( sbFilterHistLength, fhwt );
00605 QString synwt( i18n(
00606 "<p>These options allow you to have the File Selector automatically "
00607 "change location to the folder of the active document on certain "
00608 "events."
00609 "<p>Auto synchronization is <em>lazy</em>, meaning it will not take "
00610 "effect until the file selector is visible."
00611 "<p>None of these are enabled by default, but you can always sync the "
00612 "location by pressing the sync button in the toolbar.") );
00613 QWhatsThis::add( gbSync, synwt );
00614 QWhatsThis::add( cbSesLocation, i18n(
00615 "<p>If this option is enabled (default), the location will be restored "
00616 "when you start Kate.<p><strong>Note</strong> that if the session is "
00617 "handled by the KDE session manager, the location is always restored.") );
00618 QWhatsThis::add( cbSesFilter, i18n(
00619 "<p>If this option is enabled (default), the current filter will be "
00620 "restored when you start Kate.<p><strong>Note</strong> that if the "
00621 "session is handled by the KDE session manager, the filter is always "
00622 "restored."
00623 "<p><strong>Note</strong> that some of the autosync settings may "
00624 "override the restored location if on.") );
00625
00626 init();
00627
00628 }
00629
00630 void KFSConfigPage::apply()
00631 {
00632 KConfig *config = kapp->config();
00633 config->setGroup( "fileselector" );
00634
00635 QStringList l;
00636 QListBoxItem *item = acSel->selectedListBox()->firstItem();
00637 ActionLBItem *aItem;
00638 while ( item )
00639 {
00640 aItem = (ActionLBItem*)item;
00641 if ( aItem )
00642 {
00643 l << aItem->idstring();
00644 }
00645 item = item->next();
00646 }
00647 config->writeEntry( "toolbar actions", l );
00648 fileSelector->setupToolbar( config );
00649
00650 int s = 0;
00651 if ( cbSyncActive->isChecked() )
00652 s |= KateFileSelector::DocumentChanged;
00653 if ( cbSyncShow->isChecked() )
00654 s |= KateFileSelector::GotVisible;
00655 fileSelector->autoSyncEvents = s;
00656
00657
00658 fileSelector->cmbPath->setMaxItems( sbPathHistLength->value() );
00659 fileSelector->filter->setMaxCount( sbFilterHistLength->value() );
00660
00661
00662 config->writeEntry( "restore location", cbSesLocation->isChecked() );
00663 config->writeEntry( "restore last filter", cbSesFilter->isChecked() );
00664 }
00665
00666 void KFSConfigPage::reload()
00667 {
00668
00669 init();
00670 }
00671 void KFSConfigPage::init()
00672 {
00673 KConfig *config = kapp->config();
00674 config->setGroup( "fileselector" );
00675
00676 QStringList l = config->readListEntry( "toolbar actions", ',' );
00677 if ( l.isEmpty() )
00678 l << "up" << "back" << "forward" << "home" <<
00679 "short view" << "detailed view" <<
00680 "bookmarks" << "sync_dir";
00681
00682
00683 QStringList allActions;
00684 allActions << "up" << "back" << "forward" << "home" <<
00685 "reload" << "mkdir" << "delete" <<
00686 "short view" << "detailed view"
00687 <<
00688 "bookmarks" << "sync_dir";
00689 QRegExp re("&(?=[^&])");
00690 KAction *ac;
00691 QListBox *lb;
00692 for ( QStringList::Iterator it=allActions.begin(); it != allActions.end(); ++it ) {
00693 lb = l.contains( *it ) ? acSel->selectedListBox() : acSel->availableListBox();
00694 if ( *it == "bookmarks" || *it == "sync_dir" )
00695 ac = fileSelector->actionCollection()->action( (*it).latin1() );
00696 else
00697 ac = fileSelector->dirOperator()->actionCollection()->action( (*it).latin1() );
00698 if ( ac )
00699 new ActionLBItem( lb, SmallIcon( ac->icon() ), ac->text().replace( re, "" ), *it );
00700 }
00701
00702
00703 int s = fileSelector->autoSyncEvents;
00704 cbSyncActive->setChecked( s & KateFileSelector::DocumentChanged );
00705 cbSyncShow->setChecked( s & KateFileSelector::GotVisible );
00706
00707 sbPathHistLength->setValue( fileSelector->cmbPath->maxItems() );
00708 sbFilterHistLength->setValue( fileSelector->filter->maxCount() );
00709
00710 cbSesLocation->setChecked( config->readBoolEntry( "restore location", true ) );
00711 cbSesFilter->setChecked( config->readBoolEntry( "restore last filter", true ) );
00712 }
00713