@@ -78,15 +78,8 @@ QgsBrowser::QgsBrowser( QWidget *parent, Qt::WindowFlags flags )
78
78
79
79
mapCanvas->setCanvasColor ( Qt::white );
80
80
81
- QSettings settings;
82
- QString lastPath = settings.value ( " /Browser/lastExpanded" ).toString ();
83
- QgsDebugMsg ( " lastPath = " + lastPath );
84
- if ( !lastPath.isEmpty () )
85
- {
86
- expandPath ( lastPath );
87
- }
88
-
89
81
// Set the icon size of for all the toolbars created in the future.
82
+ QSettings settings;
90
83
int size = settings.value ( " /IconSize" , QGIS_ICON_SIZE ).toInt ();
91
84
setIconSize ( QSize ( size, size ) );
92
85
@@ -258,34 +251,18 @@ void QgsBrowser::itemDoubleClicked( const QModelIndex& index )
258
251
QgsDebugMsg ( QString ( " %1 %2 %3" ).arg ( index.row () ).arg ( index.column () ).arg ( item->name () ) );
259
252
}
260
253
261
- void QgsBrowser::itemExpanded ( const QModelIndex& index )
262
- {
263
- QSettings settings;
264
- QgsDataItem *item = mModel ->dataItem ( index );
265
- if ( !item )
266
- return ;
267
-
268
- #if 0
269
- if ( item->mType == QgsDataItem::Directory || item->mType == QgsDataItem::Collection )
270
- {
271
- QgsDirectoryItem *i = qobject_cast<QgsDirectoryItem*>( item );
272
- settings.setValue( "/Browser/lastExpandedDir", i->mPath );
273
- }
274
- #endif
275
-
276
- // TODO: save separately each type (FS, WMS)
277
- settings.setValue ( " /Browser/lastExpanded" , item->path () );
278
- QgsDebugMsg ( " last expanded: " + item->path () );
279
- }
280
-
281
254
void QgsBrowser::newVectorLayer ()
282
255
{
283
256
// Set file dialog to last selected dir
284
- QSettings settings;
285
- QString lastPath = settings.value ( " /Browser/lastExpanded" ).toString ();
286
- if ( !lastPath.isEmpty () )
257
+ QModelIndex selectedIndex = treeView->selectionModel ()->currentIndex ();
258
+ if ( selectedIndex.isValid () )
287
259
{
288
- settings.setValue ( " /UI/lastVectorFileFilterDir" , lastPath );
260
+ QgsDirectoryItem * dirItem = qobject_cast<QgsDirectoryItem *>( mModel ->dataItem ( selectedIndex ) );
261
+ if ( dirItem )
262
+ {
263
+ QSettings settings;
264
+ settings.setValue ( " /UI/lastVectorFileFilterDir" , dirItem->dirPath () );
265
+ }
289
266
}
290
267
291
268
QString fileName = QgsNewVectorLayerDialog::runAndCreateLayer ( this );
0 commit comments