[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/filebrowser
From: Christian Weilbach <christian () whiletaker ! homeip ! net>
Date: 2007-12-11 5:55:23
Message-ID: 1197352523.368345.13808.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 747129 by weilbach:
Changed the KUrlComboBox for a KUrlNavigator as it is used in KDE
nowadays. Haven't removed the old code yet, but once it is accepted
one has to cleanup the rest as it saves a lot of duplicate code in
here.
M +43 -30 FileBrowser.cpp
M +6 -2 FileBrowser.h
M +1 -1 kbookmarkhandler.cpp
--- trunk/extragear/multimedia/amarok/src/filebrowser/FileBrowser.cpp #747128:747129
@@ -62,6 +62,7 @@
#include <KDebug>
#include <KDialog>
#include <KFileItem>
+#include <kfileplacesmodel.h>
#include <KGenericFactory>
#include <KGlobal>
#include <KIconLoader>
@@ -69,7 +70,8 @@
#include <KMenu>
#include <KMessageBox>
#include <KProtocolInfo>
-#include <KUrlComboBox>
+// #include <KUrlComboBox>
+#include <KUrlNavigator>
#include <KUrlCompletion>
#include <KConfigGroup>
#include <KHistoryComboBox>
@@ -99,7 +101,9 @@
m_toolbar( 0 ),
m_actionCollection( 0 ),
m_bookmarkHandler( 0 ),
- m_cmbPath( 0 ),
+ m_filePlacesModel( 0 ),
+// m_cmbPath( 0 ),
+ m_urlNav( 0 ),
m_dir( 0 ),
m_acSyncDir( 0 ),
m_filter( 0 ),
@@ -114,17 +118,19 @@
m_toolbar->setMovable(false);
qInstallMsgHandler( oldHandler );
- m_cmbPath = new KUrlComboBox( KUrlComboBox::Directories, true, this);
- m_cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed \
));
- KUrlCompletion* cmpl = new KUrlCompletion(KUrlCompletion::DirCompletion);
- m_cmbPath->setCompletionObject( cmpl );
- m_cmbPath->setAutoDeleteCompletionObject( true );
+// m_cmbPath = new KUrlComboBox( KUrlComboBox::Directories, true, this);
+// m_cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, \
QSizePolicy::Fixed )); +// KUrlCompletion* cmpl = new \
KUrlCompletion(KUrlCompletion::DirCompletion); +// m_cmbPath->setCompletionObject( \
cmpl ); +// m_cmbPath->setAutoDeleteCompletionObject( true );
+ m_filePlacesModel = new KFilePlacesModel( this );
+ m_urlNav = new KUrlNavigator( m_filePlacesModel, KUrl(QDir::home().path()), this \
);
// FIXME
// m_cmbPath->listBox()->installEventFilter( this );
m_dir = new MyDirOperator(KUrl(QDir::home().path()), this);
- m_cmbPath->setUrl( KUrl(QDir::home().path()) );
+// m_cmbPath->setUrl( KUrl(QDir::home().path()) );
m_dir->setView( KFile::Simple );
m_dir->view()->setSelectionMode(QAbstractItemView::ExtendedSelection);
connect ( m_dir, SIGNAL( viewChanged(QAbstractItemView *) ),
@@ -171,10 +177,12 @@
m_toolbar->setIconDimensions( 16 );
m_toolbar->setContextMenuPolicy( Qt::NoContextMenu );
- connect( m_cmbPath, SIGNAL( urlActivated( const KUrl& )),
+// connect( m_cmbPath, SIGNAL( urlActivated( const KUrl& )),
+// this, SLOT( cmbPathActivated( const KUrl& ) ));
+ connect( m_urlNav, SIGNAL( urlChanged( const KUrl& )),
this, SLOT( cmbPathActivated( const KUrl& ) ));
- connect( m_cmbPath, SIGNAL( returnPressed( const QString& )),
- this, SLOT( cmbPathReturnPressed( const QString& ) ));
+// connect( m_cmbPath, SIGNAL( returnPressed( const QString& )),
+// this, SLOT( cmbPathReturnPressed( const QString& ) ));
connect(m_dir, SIGNAL(urlEntered(const KUrl&)),
this, SLOT(dirUrlEntered(const KUrl&)) );
@@ -188,7 +196,11 @@
waitingUrl.clear();
// whatsthis help
- m_cmbPath->setWhatsThis( i18n("<p>Here you can enter a path for a folder to \
display.</p>" +// m_cmbPath->setWhatsThis( i18n("<p>Here you can enter a path \
for a folder to display.</p>" +// "<p>To go to a \
folder previously entered, press the arrow on " +// \
"the right and choose one.</p><p>The entry has folder " +// \
"completion. Right-click to choose how completion should behave.</p>") ); + \
m_urlNav->setWhatsThis( i18n("<p>Here you can enter a path for a folder to \
display.</p>"
"<p>To go to a folder previously entered, press \
the arrow on "
"the right and choose one.</p><p>The entry has \
folder "
"completion. Right-click to choose how \
completion should behave.</p>") ); @@ -227,7 +239,7 @@
KConfigGroup fileselectorConfigGroup(KGlobal::config(), "fileselector");
setupToolbar( fileselectorConfigGroup.readEntry( "toolbar actions", QStringList() \
) );
- m_cmbPath->setMaxItems( fileselectorConfigGroup.readEntry( "pathcombo history \
len", 9 ) ); +// m_cmbPath->setMaxItems( fileselectorConfigGroup.readEntry( \
"pathcombo history len", 9 ) ); // if we restore history
m_filter->setMaxCount( fileselectorConfigGroup.readEntry( "filter history len", 9 \
) ); @@ -244,7 +256,7 @@
m_dir->readConfig(cgDir);
KConfigGroup cg (config, name );
- m_cmbPath->setUrls( cg.readPathEntry( "dir history", QStringList() ) );
+// m_cmbPath->setUrls( cg.readPathEntry( "dir history", QStringList() ) );
KConfigGroup globalConfig( KGlobal::config(), "fileselector" );
@@ -295,7 +307,7 @@
{
KConfigGroup cg = KConfigGroup( KGlobal::config(), "fileselector" );
- cg.writeEntry( "pathcombo history len", m_cmbPath->maxItems() );
+// cg.writeEntry( "pathcombo history len", m_cmbPath->maxItems() );
cg.writeEntry( "filter history len", m_filter->maxCount() );
cg.writeEntry( "filter history", m_filter->historyItems() );
}
@@ -307,12 +319,12 @@
KConfigGroup cg = KConfigGroup( config, name );
QStringList l;
- for (int i = 0; i < m_cmbPath->count(); i++)
- {
- l.append( m_cmbPath->itemText( i ) );
- }
- cg.writePathEntry( "dir history", l );
- cg.writePathEntry( "location", m_cmbPath->currentText() );
+// for (int i = 0; i < m_cmbPath->count(); i++)
+// {
+// l.append( m_cmbPath->itemText( i ) );
+// }
+// cg.writePathEntry( "dir history", l );
+// cg.writePathEntry( "location", m_cmbPath->currentText() );
cg.writeEntry( "current filter", m_filter->currentText() );
cg.writeEntry( "last filter", lastFilter );
}
@@ -413,21 +425,22 @@
void FileBrowser::Widget::cmbPathReturnPressed( const QString& u )
{
- KUrl typedURL( u );
- if ( typedURL.hasPass() )
- typedURL.setPass( QString() );
-
- QStringList urls = m_cmbPath->urls();
- urls.removeAll( typedURL.url() );
- urls.prepend( typedURL.url() );
- m_cmbPath->setUrls( urls, KUrlComboBox::RemoveBottom );
+// KUrl typedURL( u );
+// if ( typedURL.hasPass() )
+// typedURL.setPass( QString() );
+//
+// QStringList urls = m_cmbPath->urls();
+// urls.removeAll( typedURL.url() );
+// urls.prepend( typedURL.url() );
+// m_cmbPath->setUrls( urls, KUrlComboBox::RemoveBottom );
m_dir->setFocus();
m_dir->setUrl( KUrl(u), true );
}
void FileBrowser::Widget::dirUrlEntered( const KUrl& u )
{
- m_cmbPath->setUrl( u );
+ m_urlNav->setUrl( u );
+// m_cmbPath->setUrl( u );
}
void FileBrowser::Widget::dirFinishedLoading()
--- trunk/extragear/multimedia/amarok/src/filebrowser/FileBrowser.h #747128:747129
@@ -36,8 +36,10 @@
class KConfigBase;
class KBookmarkHandler;
class KDirOperator;
+class KFilePlacesModel;
class KHistoryComboBox;
-class KUrlComboBox;
+class KUrlNavigator;
+// class KUrlComboBox;
class QAction;
class QToolButton;
class QCheckBox;
@@ -114,7 +116,9 @@
ToolBar *m_toolbar;
KActionCollection *m_actionCollection;
KBookmarkHandler *m_bookmarkHandler;
- KUrlComboBox *m_cmbPath;
+ KUrlNavigator *m_urlNav;
+ KFilePlacesModel *m_filePlacesModel;
+// KUrlComboBox *m_cmbPath;
KDirOperator * m_dir;
QAction *m_acSyncDir;
KHistoryComboBox * m_filter;
--- trunk/extragear/multimedia/amarok/src/filebrowser/kbookmarkhandler.cpp \
#747128:747129 @@ -80,7 +80,7 @@
emit openUrl(bm.url().url());
}
-void KBookmarkHandler::slotNewBookmark( const QString& /*text*/,
+void KBookmarkHandler::slotNewBookmark( const QString& text,
const QByteArray& url,
const QString& additionalInfo )
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic