]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Quick dir paths appears now into the Sidebar of QFileDialogs
authorgdd <gdd>
Mon, 7 Feb 2011 18:29:45 +0000 (18:29 +0000)
committergdd <gdd>
Mon, 7 Feb 2011 18:29:45 +0000 (18:29 +0000)
src/SUIT/SUIT_FileDlg.cxx
src/SUIT/SUIT_FileDlg.h

index ccfdd61f16ba27d5299fb1708d6e10a2800c3758..958f6165e2efd0dfa3820f0355e0996a28b3905b 100755 (executable)
@@ -92,6 +92,9 @@
 #include <QApplication>
 #include <QListView>
 #include <QLineEdit>
+// GDD
+#include <QUrl>
+#include <QDesktopServices>
 
 /*!
   \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);
+      }
     }
   }
 }
index 6be781d58397c7ccf8cb1cd7afe7f383b98b4118..29f921fa6feb93134a2ee7d6f9e9f73812ae6ed4 100755 (executable)
@@ -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<QUrl>         myUrls;             //!< quick dir Sidebar Urls
   QPushButton*        myQuickButton;      //!< quick dir add button
   bool                myCheckPermissions; //!< check permissions option
   static QString      myLastVisitedPath;  //!< last visited path