improved recent file handling for macos.
This commit is contained in:
parent
7556a2e243
commit
a895903a58
@ -775,13 +775,13 @@ PAdmin::PAdmin() : QObject()
|
|||||||
|
|
||||||
// XML Parser part
|
// XML Parser part
|
||||||
// 1st: check local directory
|
// 1st: check local directory
|
||||||
QString path = QString("./");
|
QString path = QDir::currentPath();
|
||||||
QString fln = QString("musredit_startup.xml");
|
QString fln = QString("musredit_startup.xml");
|
||||||
QString pathFln = path + fln;
|
QString pathFln = path + fln;
|
||||||
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
|
||||||
if (!QFile::exists(pathFln)) {
|
if (!QFile::exists(pathFln)) {
|
||||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||||
path = procEnv.value("HOME", "");
|
path = QDir::homePath();
|
||||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||||
if (!QFile::exists(pathFln)) {
|
if (!QFile::exists(pathFln)) {
|
||||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||||
@ -833,15 +833,6 @@ PAdmin::PAdmin() : QObject()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* <p>Destructor
|
|
||||||
*/
|
|
||||||
PAdmin::~PAdmin()
|
|
||||||
{
|
|
||||||
saveRecentFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>returns the help url corresponding the the tag.
|
* <p>returns the help url corresponding the the tag.
|
||||||
@ -1096,7 +1087,7 @@ void PAdmin::saveRecentFiles()
|
|||||||
QString fln = QString("./musredit_startup.xml");
|
QString fln = QString("./musredit_startup.xml");
|
||||||
if (!QFile::exists(fln))
|
if (!QFile::exists(fln))
|
||||||
fln = fPrefPathName;
|
fln = fPrefPathName;
|
||||||
|
|
||||||
if (QFile::exists(fln)) { // administration file present
|
if (QFile::exists(fln)) { // administration file present
|
||||||
QVector<QString> data;
|
QVector<QString> data;
|
||||||
QFile file(fln);
|
QFile file(fln);
|
||||||
|
@ -65,7 +65,6 @@ class PAdminXMLParser
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PAdminXMLParser(const QString &fln, PAdmin*);
|
PAdminXMLParser(const QString &fln, PAdmin*);
|
||||||
virtual ~PAdminXMLParser() {}
|
|
||||||
|
|
||||||
virtual bool isValid() { return fValid; }
|
virtual bool isValid() { return fValid; }
|
||||||
|
|
||||||
@ -113,7 +112,6 @@ class PAdmin : public QObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PAdmin();
|
PAdmin();
|
||||||
virtual ~PAdmin();
|
|
||||||
|
|
||||||
int getTimeout() { return fTimeout; }
|
int getTimeout() { return fTimeout; }
|
||||||
QString getFontName() { return fFontName; }
|
QString getFontName() { return fFontName; }
|
||||||
@ -173,6 +171,7 @@ class PAdmin : public QObject
|
|||||||
|
|
||||||
int loadPrefs(QString fln);
|
int loadPrefs(QString fln);
|
||||||
int savePrefs(QString pref_fln);
|
int savePrefs(QString pref_fln);
|
||||||
|
void saveRecentFiles(); ///< save recent file list
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setExecPath(const QString str) { fExecPath = str; }
|
void setExecPath(const QString str) { fExecPath = str; }
|
||||||
@ -228,7 +227,6 @@ class PAdmin : public QObject
|
|||||||
|
|
||||||
QVector<PTheory> fTheory; ///< stores all known theories. Needed when generating theory blocks from within musredit.
|
QVector<PTheory> fTheory; ///< stores all known theories. Needed when generating theory blocks from within musredit.
|
||||||
|
|
||||||
void saveRecentFiles(); ///< save recent file list
|
|
||||||
void createMusreditStartupFile(); ///< create default musredit_startup.xml
|
void createMusreditStartupFile(); ///< create default musredit_startup.xml
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1673,6 +1673,8 @@ void PTextEdit::fileExit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fAdmin->saveRecentFiles();
|
||||||
|
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user