From: gdd Date: Mon, 7 Feb 2011 18:29:45 +0000 (+0000) Subject: Quick dir paths appears now into the Sidebar of QFileDialogs X-Git-Tag: V6_3_0a1~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2b15baf9689afe280d86b23231b1f205e73530a4;p=modules%2Fgui.git Quick dir paths appears now into the Sidebar of QFileDialogs --- diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index ccfdd61f1..958f6165e 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -92,6 +92,9 @@ #include #include #include +// GDD +#include +#include /*! \brief Defines extension behavior. @@ -127,6 +130,11 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool if ( parent ) setWindowIcon( parent->windowIcon() ); + // GDD + myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation))); + myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))); + setSidebarUrls(myUrls); + // add quick directories widgets if ( showQuickDir ) { myQuickLab = new QLabel( tr( "LAB_QUICK_PATH" ), this ); @@ -146,8 +154,15 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool if ( dirList.isEmpty() ) dirList << QDir::homePath(); - for ( int i = 0; i < dirList.count(); i++ ) + // GDD + for ( int i = 0; i < dirList.count(); i++ ) { myQuickCombo->addItem( dirList[i] ); + myUrls.append(QUrl::fromLocalFile(dirList[i])); + } + + // GDD + setSidebarUrls(myUrls); + } else { delete myQuickLab; myQuickLab = 0; @@ -668,8 +683,12 @@ void SUIT_FileDlg::addQuickDir() if ( !found ) { dirList.append( dp ); resMgr->setValue( "FileDlg", "QuickDirList", dirList.join( ";" ) ); - if ( !emptyAndHome ) + // GDD + if ( !emptyAndHome ) { myQuickCombo->addItem( dp ); + myUrls.append(QUrl::fromLocalFile( dp )); + setSidebarUrls(myUrls); + } } } } diff --git a/src/SUIT/SUIT_FileDlg.h b/src/SUIT/SUIT_FileDlg.h index 6be781d58..29f921fa6 100755 --- a/src/SUIT/SUIT_FileDlg.h +++ b/src/SUIT/SUIT_FileDlg.h @@ -34,6 +34,7 @@ class QLabel; class QLineEdit; class QComboBox; class QPushButton; +class QUrl; class SUIT_FileValidator; class SUIT_EXPORT SUIT_FileDlg : public QFileDialog @@ -118,6 +119,7 @@ private: SUIT_FileValidator* myValidator; //!< file validator QLabel* myQuickLab; //!< quick dir combo box QComboBox* myQuickCombo; //!< quick dir combo box + QList myUrls; //!< quick dir Sidebar Urls QPushButton* myQuickButton; //!< quick dir add button bool myCheckPermissions; //!< check permissions option static QString myLastVisitedPath; //!< last visited path