Improve connection manager #80
2 changed files with 8 additions and 17 deletions
|
|
@ -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<ConnectionConfig> ConnectionListModel::get(int row)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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<ConnectionConfig> 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue