#include <QApplication>
#include <QListView>
#include <QLineEdit>
-// GDD
#include <QUrl>
-#include <QDesktopServices>
+#include <QStandardPaths>
/*!
\brief Defines extension behavior.
if ( parent )
setWindowIcon( parent->windowIcon() );
- // GDD
- myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)));
- myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)));
-
- setSidebarUrls(myUrls);
+ // standard side bar URLs
+ myUrls << QStandardPaths::writableLocation( QStandardPaths::ApplicationsLocation );
+ myUrls << QStandardPaths::writableLocation( QStandardPaths::HomeLocation );
+ myUrls << qgetenv( "DATA_DIR" );
// add quick directories widgets
if ( showQuickDir ) {
if ( dirList.isEmpty() )
dirList << QDir::homePath();
- // GDD
for ( int i = 0; i < dirList.count(); i++ ) {
+ // add to combo box
myQuickCombo->addItem( dirList[i] );
- myUrls.append(QUrl::fromLocalFile(dirList[i]));
+ // add to side bar
+ myUrls << dirList[i];
}
-
- // GDD
- setSidebarUrls(myUrls);
-
}
else {
delete myQuickLab; myQuickLab = 0;
}
}
+ // update side bar
+ updateSideBar();
+
setAcceptMode( open ? AcceptOpen: AcceptSave );
setWindowTitle( open ? tr( "INF_DESK_DOC_OPEN" ) : tr( "INF_DESK_DOC_SAVE" ) );
}
if ( !found ) {
- dirList.append( dp );
+ dirList << dp;
resMgr->setValue( "FileDlg", "QuickDirList", dirList.join( ";" ) );
- // GDD
+
if ( !emptyAndHome ) {
+ // add to combo box
myQuickCombo->addItem( dp );
- myUrls.append(QUrl::fromLocalFile( dp ));
- setSidebarUrls(myUrls);
+ // add to side bar
+ myUrls << dp;
}
+
+ // update side bar
+ updateSideBar();
}
}
}
}
}
+/*!
+ \brief Update side bar URLs list
+*/
+void SUIT_FileDlg::updateSideBar()
+{
+ QList<QUrl> urls;
+
+ foreach ( QString url, myUrls ) {
+ if ( !url.isEmpty() && QFileInfo( url ).exists() )
+ urls << QUrl::fromLocalFile( url );
+ }
+
+ setSidebarUrls( urls );
+}
+
/*!
\brief Show dialog box for the file opening/saving.
private:
void polish();
+ void updateSideBar();
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
+ QLabel* myQuickLab; //!< quick dir panel: label
+ QComboBox* myQuickCombo; //!< quick dir panel: combo box
+ QPushButton* myQuickButton; //!< quick dir panel: button
+ QStringList myUrls; //!< sidebar urls
bool myCheckPermissions; //!< check permissions option
static QString myLastVisitedPath; //!< last visited path
};
<parameter name="visibility_column_id_3" value="false" />
<parameter name="visibility_column_id_4" value="false" />
</section>
- <section name="FileDlg">
- <!-- "Open/Save File" dialog box preferences-->
- <parameter name="QuickDirList" value="${DATA_DIR}" />
- </section>
<section name="Study">
<!-- General study settings -->
<parameter name="autoload_light_modules" value="true" />