diff --git a/pglab/ConnectionListModel.cpp b/pglab/ConnectionListModel.cpp index 29914c0..b14b652 100644 --- a/pglab/ConnectionListModel.cpp +++ b/pglab/ConnectionListModel.cpp @@ -210,26 +210,21 @@ bool ConnectionListModel::removeRows(int row, int count, const QModelIndex &pare QSettings settings(file_name, QSettings::IniFormat); for (int idx = 0; idx < count; ++idx) { auto&& cc = m_connections[idx+row]; - { - settings.beginGroup(cc.uuid().toString()); - SCOPE_EXIT { settings.endGroup(); }; - for (auto&& k : settings.childKeys()) { - settings.remove(k); - } - } + settings.remove(cc.uuid().toString()); } + settings.sync(); m_connections.remove(row, count); result = true; } return result; } -void ConnectionListModel::newItem() -{ -// int i = m_connections->createNew(); -// auto idx = createIndex(i, 0); -// emit dataChanged(idx, idx); -} +//void ConnectionListModel::newItem() +//{ +//// int i = m_connections->createNew(); +//// auto idx = createIndex(i, 0); +//// emit dataChanged(idx, idx); +//} Expected ConnectionListModel::get(int row) { diff --git a/pglab/ConnectionListModel.h b/pglab/ConnectionListModel.h index 611bb04..3496464 100644 --- a/pglab/ConnectionListModel.h +++ b/pglab/ConnectionListModel.h @@ -34,7 +34,6 @@ public: ConnectionListModel(const ConnectionListModel&) = delete; ~ConnectionListModel() override; - // BEGIN Model/View related functions virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; virtual int columnCount(const QModelIndex &/*parent*/) const override; @@ -45,7 +44,6 @@ public: virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; // END Model/View related functions - void newItem(); Expected get(int row); void load(); @@ -53,8 +51,6 @@ public: void save(); // Writes the specified entry to storage void save(int index); -// // Save changes to the config -// void save(size_t index, const ConnectionConfig &cc); /** Matches cc to the list by looking at its uuid. * * If it is not in the list it is added. If the uuid is in the list that entry is updated.