Remove old homedir if it's empty

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@286 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent d6f675a18b
commit 5c9fb7db4a
  1. 5
      src/lib/AutoTypeTreeWidget.h
  2. 5
      src/main.cpp

@ -19,10 +19,13 @@
class AutoTypeTreeWidget : public QTreeWidget { class AutoTypeTreeWidget : public QTreeWidget {
Q_OBJECT Q_OBJECT
public: public:
AutoTypeTreeWidget(QWidget* parent):QTreeWidget(parent){} AutoTypeTreeWidget(QWidget* parent):QTreeWidget(parent){};
signals: signals:
void returnPressed(QTreeWidgetItem*); void returnPressed(QTreeWidgetItem*);
private: private:
void mouseMoveEvent(QMouseEvent*); void mouseMoveEvent(QMouseEvent*);
void keyPressEvent(QKeyEvent*); void keyPressEvent(QKeyEvent*);

@ -118,8 +118,11 @@ int main(int argc, char **argv)
#ifdef Q_WS_X11 #ifdef Q_WS_X11
{ {
QString OldHomeDir = QDir::homePath()+"/.keepassx"; QString OldHomeDir = QDir::homePath()+"/.keepassx";
if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini"); QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini");
if (QDir(OldHomeDir).entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System).count()==0)
QDir().rmdir(OldHomeDir);
}
} }
#else #else
if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini")) if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini"))