mirror of
https://github.com/altlinux/admc.git
synced 2025-02-01 13:47:06 +03:00
remove disabling actions before login
disable widgets instead
This commit is contained in:
parent
0f9468acdb
commit
ca83eab5db
@ -130,30 +130,32 @@ MainWindow::MainWindow(const bool auto_login)
|
||||
connect_entry_widget(*contents_widget);
|
||||
connect_entry_widget(*members_widget);
|
||||
|
||||
// Disable actions until login complete
|
||||
set_enabled_for_ad_actions(false);
|
||||
// Disable widgets until logged in
|
||||
set_enabled_for_widgets(false);
|
||||
|
||||
if (auto_login) {
|
||||
on_action_login();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::set_enabled_for_ad_actions(bool enabled) {
|
||||
// TODO: redo this for new action locations
|
||||
QList<QAction *> ad_actions = {
|
||||
|
||||
};
|
||||
for (auto a : ad_actions) {
|
||||
a->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_login() {
|
||||
AD()->ad_interface_login(SEARCH_BASE, HEAD_DN);
|
||||
}
|
||||
|
||||
void MainWindow::set_enabled_for_widgets(bool enabled) {
|
||||
QList<QWidget *> widgets = {
|
||||
containers_widget,
|
||||
contents_widget,
|
||||
details_widget
|
||||
};
|
||||
|
||||
for (auto e : widgets) {
|
||||
e->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_ad_interface_login_complete(const QString &base, const QString &head) {
|
||||
set_enabled_for_ad_actions(true);
|
||||
set_enabled_for_widgets(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_action_exit() {
|
||||
@ -232,6 +234,8 @@ void MainWindow::on_request_delete(const QString &dn) {
|
||||
if (confirmed) {
|
||||
AD()->delete_entry(dn);
|
||||
}
|
||||
|
||||
contents_widget->setEnabled(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_request_new_entry_generic(const QString &dn, NewEntryType type) {
|
||||
|
@ -56,7 +56,7 @@ private slots:
|
||||
private:
|
||||
QString get_selected_dn() const;
|
||||
void on_request_new_entry_generic(const QString &dn, NewEntryType type);
|
||||
void set_enabled_for_ad_actions(bool enabled);
|
||||
void set_enabled_for_widgets(bool enabled);
|
||||
bool confirmation_dialog(const QString &text);
|
||||
void connect_entry_widget(const EntryWidget &widget);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user