Hello all,
The attached patch makes qt-gui's edit groups dialog keep focus on the
selected group after moving it, renaming it etc. Nothing more than a few
setCurrentItem().
Best regards
// Erik
--
For Linux to catch up to Microsoft, Linux development would have
to stop all together and regress.
-- Donald Ade
Erik Johansson
http://ejohansson.se
Index: src/editgrp.cpp
===================================================================
--- src/editgrp.cpp (revision 4386)
+++ src/editgrp.cpp (working copy)
@@ -145,6 +145,7 @@
if(QueryUser(this, warning, tr("Ok"), tr("Cancel"))) {
gUserManager.RemoveGroup(n);
RefreshList();
+ lstGroups->setCurrentItem(n - 1);
}
}
@@ -155,6 +156,7 @@
if (n <= 0) return;
gUserManager.SwapGroups(n + 1, n);
RefreshList();
+ lstGroups->setCurrentItem(n);
}
@@ -164,6 +166,12 @@
if (n < 0 /* || n == max */) return;
gUserManager.SwapGroups(n + 1, n + 2);
RefreshList();
+ if (n + 2 >= lstGroups->count()) {
+ lstGroups->setCurrentItem(lstGroups->count() - 1);
+ }
+ else {
+ lstGroups->setCurrentItem(n + 2);
+ }
}
@@ -173,6 +181,7 @@
if (n == -1) return;
gUserManager.SetDefaultGroup(n);
RefreshList();
+ lstGroups->setCurrentItem(n);
}
void EditGrpDlg::slot_newuser()
@@ -181,6 +190,7 @@
if (n == -1 ) return;
gUserManager.SetNewUserGroup(n);
RefreshList();
+ lstGroups->setCurrentItem(n);
}
void EditGrpDlg::slot_edit()
@@ -204,6 +214,7 @@
void EditGrpDlg::slot_editok()
{
+ int n = lstGroups->currentItem();
gUserManager.RenameGroup(m_nEditGrp, edtName->text().local8Bit());
RefreshList();
@@ -215,6 +226,7 @@
btnDone->setEnabled(true);
disconnect(btnEdit, SIGNAL(clicked()), this, SLOT(slot_editok()));
connect(btnEdit, SIGNAL(clicked()), this, SLOT(slot_edit()));
+ lstGroups->setCurrentItem(n);
}