Commit 3c552e13 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

de-duplicate code a bit

parent 9ac137fb
......@@ -196,18 +196,16 @@ int OpenEditorsModel::findFileName(const QString &filename) const
void OpenEditorsModel::removeEditor(IEditor *editor)
{
d->m_duplicateEditors.removeAll(editor);
int idx = findEditor(editor);
if (idx < 0)
return;
beginRemoveRows(QModelIndex(), idx, idx);
d->m_editors.removeAt(idx);
endRemoveRows();
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
removeEditor(findEditor(editor));
}
void OpenEditorsModel::removeEditor(const QModelIndex &index)
{
int idx = index.row();
removeEditor(index.row());
}
void OpenEditorsModel::removeEditor(int idx)
{
if (idx < 0)
return;
IEditor *editor= d->m_editors.at(idx).editor;
......
......@@ -103,6 +103,7 @@ private:
void addEntry(const Entry &entry);
int findEditor(IEditor *editor) const;
int findFileName(const QString &filename) const;
void removeEditor(int idx);
QScopedPointer<OpenEditorsModelPrivate> d;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment