Dropping a file onto a main window now opens that file.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1861 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-05-24 17:27:15 +00:00
parent 9100578e9d
commit 515311db04
4 changed files with 66 additions and 0 deletions

View File

@@ -526,6 +526,38 @@ QString QETApp::symbolicPath(const QString &real_path) {
return(chemin);
}
/**
@return the list of file extensions QElectroTech is able to open and
supposed to handle. Note they are provided with no leading point.
*/
QStringList QETApp::handledFileExtensions() {
static QStringList ext;
if (!ext.count()) {
ext << "qet";
ext << "elmt";
ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegExp("^\."));
}
return(ext);
}
/**
@param an URLs list
@return the list of filepaths QElectroTech is able to open.
*/
QStringList QETApp::handledFiles(const QList<QUrl> &urls) {
QList<QString> filepaths;
foreach (QUrl url, urls) {
if (!url.isLocalFile()) continue;
QString local_path = url.toLocalFile();
QFileInfo local_path_info(local_path);
QString local_path_ext = local_path_info.completeSuffix();
if (handledFileExtensions().contains(local_path_ext)) {
filepaths << local_path;
}
}
return(filepaths);
}
/**
@param filepath Un chemin de fichier
Note : si filepath est une chaine vide, cette methode retourne 0.