mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-06-25 23:21:03 -04:00
Implement the GUI for editing and creating groups.
This commit is contained in:
parent
bce46c5ece
commit
019bcd380e
13 changed files with 307 additions and 14 deletions
|
@ -49,6 +49,7 @@ set(keepassx_SOURCES
|
||||||
gui/DatabaseManager.cpp
|
gui/DatabaseManager.cpp
|
||||||
gui/DatabaseWidget.cpp
|
gui/DatabaseWidget.cpp
|
||||||
gui/EditEntryWidget.cpp
|
gui/EditEntryWidget.cpp
|
||||||
|
gui/EditGroupWidget.cpp
|
||||||
gui/EntryModel.cpp
|
gui/EntryModel.cpp
|
||||||
gui/EntryView.cpp
|
gui/EntryView.cpp
|
||||||
gui/FileDialog.cpp
|
gui/FileDialog.cpp
|
||||||
|
@ -74,6 +75,7 @@ set(keepassx_MOC
|
||||||
gui/DatabaseManager.h
|
gui/DatabaseManager.h
|
||||||
gui/DatabaseWidget.h
|
gui/DatabaseWidget.h
|
||||||
gui/EditEntryWidget.h
|
gui/EditEntryWidget.h
|
||||||
|
gui/EditGroupWidget.h
|
||||||
gui/EntryModel.h
|
gui/EntryModel.h
|
||||||
gui/EntryView.h
|
gui/EntryView.h
|
||||||
gui/GroupModel.h
|
gui/GroupModel.h
|
||||||
|
@ -90,6 +92,7 @@ set(keepassx_FORMS
|
||||||
gui/EditEntryWidget.ui
|
gui/EditEntryWidget.ui
|
||||||
gui/EditEntryWidgetMain.ui
|
gui/EditEntryWidgetMain.ui
|
||||||
gui/EditEntryWidgetNotes.ui
|
gui/EditEntryWidgetNotes.ui
|
||||||
|
gui/EditGroupWidget.ui
|
||||||
gui/KeyOpenDialog.ui
|
gui/KeyOpenDialog.ui
|
||||||
gui/MainWindow.ui
|
gui/MainWindow.ui
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "format/KeePass2XmlReader.h"
|
#include "format/KeePass2XmlReader.h"
|
||||||
#include "gui/DatabaseWidget.h"
|
#include "gui/DatabaseWidget.h"
|
||||||
#include "gui/FileDialog.h"
|
#include "gui/FileDialog.h"
|
||||||
|
#include "gui/GroupView.h"
|
||||||
#include "gui/KeyOpenDialog.h"
|
#include "gui/KeyOpenDialog.h"
|
||||||
|
|
||||||
DatabaseManagerStruct::DatabaseManagerStruct()
|
DatabaseManagerStruct::DatabaseManagerStruct()
|
||||||
|
@ -205,6 +206,20 @@ void DatabaseManager::saveDatabaseAs(int index)
|
||||||
saveDatabaseAs(indexDatabase(index));
|
saveDatabaseAs(indexDatabase(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseManager::createGroup()
|
||||||
|
{
|
||||||
|
Database* db = indexDatabase(m_tabWidget->currentIndex());
|
||||||
|
DatabaseWidget* dbWidget = m_dbList[db].dbWidget;
|
||||||
|
dbWidget->createGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseManager::editGroup()
|
||||||
|
{
|
||||||
|
Database* db = indexDatabase(m_tabWidget->currentIndex());
|
||||||
|
DatabaseWidget* dbWidget = m_dbList[db].dbWidget;
|
||||||
|
dbWidget->switchToGroupEdit();
|
||||||
|
}
|
||||||
|
|
||||||
void DatabaseManager::updateTabName(Database* db)
|
void DatabaseManager::updateTabName(Database* db)
|
||||||
{
|
{
|
||||||
int index = databaseIndex(db);
|
int index = databaseIndex(db);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "format/KeePass2Reader.h"
|
#include "format/KeePass2Reader.h"
|
||||||
#include "format/KeePass2Writer.h"
|
#include "format/KeePass2Writer.h"
|
||||||
|
|
||||||
|
class DatabaseWidget;
|
||||||
class KeyOpenDialog;
|
class KeyOpenDialog;
|
||||||
class QFile;
|
class QFile;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
|
@ -33,7 +34,7 @@ struct DatabaseManagerStruct
|
||||||
DatabaseManagerStruct();
|
DatabaseManagerStruct();
|
||||||
|
|
||||||
QFile* file;
|
QFile* file;
|
||||||
QWidget* dbWidget;
|
DatabaseWidget* dbWidget;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
bool modified;
|
bool modified;
|
||||||
bool readOnly;
|
bool readOnly;
|
||||||
|
@ -56,6 +57,8 @@ public Q_SLOTS:
|
||||||
void saveDatabase(int index = -1);
|
void saveDatabase(int index = -1);
|
||||||
void saveDatabaseAs(int index = -1);
|
void saveDatabaseAs(int index = -1);
|
||||||
void closeDatabase(int index = -1);
|
void closeDatabase(int index = -1);
|
||||||
|
void createGroup();
|
||||||
|
void editGroup();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateTabName(Database* db);
|
void updateTabName(Database* db);
|
||||||
|
|
|
@ -21,11 +21,14 @@
|
||||||
#include <QtGui/QSplitter>
|
#include <QtGui/QSplitter>
|
||||||
|
|
||||||
#include "gui/EditEntryWidget.h"
|
#include "gui/EditEntryWidget.h"
|
||||||
|
#include "gui/EditGroupWidget.h"
|
||||||
#include "gui/EntryView.h"
|
#include "gui/EntryView.h"
|
||||||
#include "gui/GroupView.h"
|
#include "gui/GroupView.h"
|
||||||
|
|
||||||
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
||||||
: QStackedWidget(parent)
|
: QStackedWidget(parent)
|
||||||
|
, m_newGroup(0)
|
||||||
|
, m_newGroupParent(0)
|
||||||
{
|
{
|
||||||
m_mainWidget = new QWidget(this);
|
m_mainWidget = new QWidget(this);
|
||||||
QLayout* layout = new QHBoxLayout(m_mainWidget);
|
QLayout* layout = new QHBoxLayout(m_mainWidget);
|
||||||
|
@ -50,25 +53,74 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
||||||
layout->addWidget(splitter);
|
layout->addWidget(splitter);
|
||||||
m_mainWidget->setLayout(layout);
|
m_mainWidget->setLayout(layout);
|
||||||
|
|
||||||
m_editWidget = new EditEntryWidget();
|
m_editEntryWidget = new EditEntryWidget();
|
||||||
|
m_editGroupWidget = new EditGroupWidget();
|
||||||
|
|
||||||
addWidget(m_mainWidget);
|
addWidget(m_mainWidget);
|
||||||
addWidget(m_editWidget);
|
addWidget(m_editEntryWidget);
|
||||||
|
addWidget(m_editGroupWidget);
|
||||||
|
|
||||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
|
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
|
||||||
connect(m_entryView, SIGNAL(entryActivated(Entry*)), SLOT(switchToEdit(Entry*)));
|
connect(m_entryView, SIGNAL(entryActivated(Entry*)), SLOT(switchToEntryEdit(Entry*)));
|
||||||
connect(m_editWidget, SIGNAL(editFinished()), SLOT(switchToView()));
|
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
|
||||||
|
connect(m_editGroupWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
|
||||||
|
|
||||||
setCurrentIndex(0);
|
setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseWidget::switchToView()
|
GroupView* DatabaseWidget::groupView()
|
||||||
{
|
{
|
||||||
|
return m_groupView;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryView* DatabaseWidget::entryView()
|
||||||
|
{
|
||||||
|
return m_entryView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseWidget::createGroup()
|
||||||
|
{
|
||||||
|
m_newGroup = new Group();
|
||||||
|
m_newGroup->setUuid(Uuid::random());
|
||||||
|
m_newGroupParent = m_groupView->currentGroup();
|
||||||
|
switchToGroupEdit(m_newGroup, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseWidget::switchToView(bool accepted)
|
||||||
|
{
|
||||||
|
if (m_newGroup) {
|
||||||
|
if (accepted) {
|
||||||
|
m_newGroup->setParent(m_newGroupParent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
delete m_newGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_newGroup = 0;
|
||||||
|
m_newGroupParent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentIndex(0);
|
setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseWidget::switchToEdit(Entry* entry)
|
void DatabaseWidget::switchToEntryEdit(Entry* entry)
|
||||||
{
|
{
|
||||||
m_editWidget->loadEntry(entry);
|
m_editEntryWidget->loadEntry(entry);
|
||||||
setCurrentIndex(1);
|
setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseWidget::switchToGroupEdit(Group* group, bool create)
|
||||||
|
{
|
||||||
|
m_editGroupWidget->loadGroup(group, create);
|
||||||
|
setCurrentIndex(2);
|
||||||
|
}
|
||||||
|
void DatabaseWidget::switchToEntryEdit()
|
||||||
|
{
|
||||||
|
// TODO switchToEntryEdit(m_entryView->currentEntry());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseWidget::switchToGroupEdit()
|
||||||
|
{
|
||||||
|
switchToGroupEdit(m_groupView->currentGroup(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class EditEntryWidget;
|
class EditEntryWidget;
|
||||||
|
class EditGroupWidget;
|
||||||
class Entry;
|
class Entry;
|
||||||
class EntryView;
|
class EntryView;
|
||||||
|
class Group;
|
||||||
class GroupView;
|
class GroupView;
|
||||||
|
|
||||||
class DatabaseWidget : public QStackedWidget
|
class DatabaseWidget : public QStackedWidget
|
||||||
|
@ -32,16 +34,27 @@ class DatabaseWidget : public QStackedWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseWidget(Database* db, QWidget* parent = 0);
|
explicit DatabaseWidget(Database* db, QWidget* parent = 0);
|
||||||
|
GroupView* groupView();
|
||||||
|
EntryView* entryView();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void createGroup();
|
||||||
|
void switchToEntryEdit();
|
||||||
|
void switchToGroupEdit();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void switchToView();
|
void switchToView(bool accepted);
|
||||||
void switchToEdit(Entry* entry);
|
void switchToEntryEdit(Entry* entry);
|
||||||
|
void switchToGroupEdit(Group* entry, bool create);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* m_mainWidget;
|
QWidget* m_mainWidget;
|
||||||
EditEntryWidget* m_editWidget;
|
EditEntryWidget* m_editEntryWidget;
|
||||||
|
EditGroupWidget* m_editGroupWidget;
|
||||||
GroupView* m_groupView;
|
GroupView* m_groupView;
|
||||||
EntryView* m_entryView;
|
EntryView* m_entryView;
|
||||||
|
Group* m_newGroup;
|
||||||
|
Group* m_newGroupParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_DATABASEWIDGET_H
|
#endif // KEEPASSX_DATABASEWIDGET_H
|
||||||
|
|
|
@ -85,11 +85,12 @@ void EditEntryWidget::saveEntry()
|
||||||
|
|
||||||
m_entry->setNotes(m_notesUi->notesEdit->toPlainText());
|
m_entry->setNotes(m_notesUi->notesEdit->toPlainText());
|
||||||
|
|
||||||
cancel();
|
m_entry = 0;
|
||||||
|
Q_EMIT editFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEntryWidget::cancel()
|
void EditEntryWidget::cancel()
|
||||||
{
|
{
|
||||||
m_entry = 0;
|
m_entry = 0;
|
||||||
Q_EMIT editFinished();
|
Q_EMIT editFinished(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
void loadEntry(Entry* entry);
|
void loadEntry(Entry* entry);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void editFinished();
|
void editFinished(bool accepted);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void saveEntry();
|
void saveEntry();
|
||||||
|
|
69
src/gui/EditGroupWidget.cpp
Normal file
69
src/gui/EditGroupWidget.cpp
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 or (at your option)
|
||||||
|
* version 3 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "EditGroupWidget.h"
|
||||||
|
#include "ui_EditGroupWidget.h"
|
||||||
|
|
||||||
|
EditGroupWidget::EditGroupWidget(QWidget* parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
, m_ui(new Ui::EditGroupWidget())
|
||||||
|
, m_group(0)
|
||||||
|
{
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
QFont labelHeaderFont = m_ui->labelHeader->font();
|
||||||
|
labelHeaderFont.setBold(true);
|
||||||
|
labelHeaderFont.setPointSize(labelHeaderFont.pointSize() + 2);
|
||||||
|
m_ui->labelHeader->setFont(labelHeaderFont);
|
||||||
|
|
||||||
|
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(save()));
|
||||||
|
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(cancel()));
|
||||||
|
}
|
||||||
|
|
||||||
|
EditGroupWidget::~EditGroupWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditGroupWidget::loadGroup(Group* group, bool create)
|
||||||
|
{
|
||||||
|
m_group = group;
|
||||||
|
|
||||||
|
if (create) {
|
||||||
|
m_ui->labelHeader->setText(tr("Add group"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_ui->labelHeader->setText(tr("Edit group"));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui->editName->setText(m_group->name());
|
||||||
|
m_ui->editNotes->setPlainText(m_group->notes());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditGroupWidget::save()
|
||||||
|
{
|
||||||
|
m_group->setName(m_ui->editName->text());
|
||||||
|
m_group->setNotes(m_ui->editNotes->toPlainText());
|
||||||
|
|
||||||
|
m_group = 0;
|
||||||
|
Q_EMIT editFinished(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditGroupWidget::cancel()
|
||||||
|
{
|
||||||
|
m_group = 0;
|
||||||
|
Q_EMIT editFinished(false);
|
||||||
|
}
|
54
src/gui/EditGroupWidget.h
Normal file
54
src/gui/EditGroupWidget.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 or (at your option)
|
||||||
|
* version 3 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KEEPASSX_GROUPDIALOG_H
|
||||||
|
#define KEEPASSX_GROUPDIALOG_H
|
||||||
|
|
||||||
|
#include <QtCore/QScopedPointer>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
#include "core/Group.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class EditGroupWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EditGroupWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
EditGroupWidget(QWidget* parent = 0);
|
||||||
|
~EditGroupWidget();
|
||||||
|
|
||||||
|
void loadGroup(Group* group, bool create);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void editFinished(bool accepted);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void save();
|
||||||
|
void cancel();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::EditGroupWidget> m_ui;
|
||||||
|
Group* m_group;
|
||||||
|
|
||||||
|
Q_DISABLE_COPY(EditGroupWidget)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // KEEPASSX_GROUPDIALOG_H
|
74
src/gui/EditGroupWidget.ui
Normal file
74
src/gui/EditGroupWidget.ui
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>EditGroupWidget</class>
|
||||||
|
<widget class="QWidget" name="EditGroupWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>544</width>
|
||||||
|
<height>263</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelHeader"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>1</width>
|
||||||
|
<height>3</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelNotes">
|
||||||
|
<property name="text">
|
||||||
|
<string>Notes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="editName"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelName">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPlainTextEdit" name="editNotes"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -41,6 +41,11 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
||||||
Q_ARG(QModelIndex, m_model->index(0, 0)));
|
Q_ARG(QModelIndex, m_model->index(0, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group* GroupView::currentGroup()
|
||||||
|
{
|
||||||
|
return m_model->groupFromIndex(currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
void GroupView::expandedChanged(const QModelIndex& index)
|
void GroupView::expandedChanged(const QModelIndex& index)
|
||||||
{
|
{
|
||||||
Group* group = m_model->groupFromIndex(index);
|
Group* group = m_model->groupFromIndex(index);
|
||||||
|
|
|
@ -31,6 +31,7 @@ class GroupView : public QTreeView
|
||||||
public:
|
public:
|
||||||
explicit GroupView(Database* db, QWidget* parent = 0);
|
explicit GroupView(Database* db, QWidget* parent = 0);
|
||||||
void setModel(QAbstractItemModel* model);
|
void setModel(QAbstractItemModel* model);
|
||||||
|
Group* currentGroup();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void groupChanged(Group* group);
|
void groupChanged(Group* group);
|
||||||
|
|
|
@ -37,6 +37,8 @@ MainWindow::MainWindow()
|
||||||
connect(m_ui->actionDatabaseSave, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabase()));
|
connect(m_ui->actionDatabaseSave, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabase()));
|
||||||
connect(m_ui->actionDatabaseSaveAs, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabaseAs()));
|
connect(m_ui->actionDatabaseSaveAs, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabaseAs()));
|
||||||
connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_dbManager, SLOT(closeDatabase()));
|
connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_dbManager, SLOT(closeDatabase()));
|
||||||
|
connect(m_ui->actionGroupNew, SIGNAL(triggered()), m_dbManager, SLOT(createGroup()));
|
||||||
|
connect(m_ui->actionGroupEdit, SIGNAL(triggered()), m_dbManager, SLOT(editGroup()));
|
||||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,4 +55,5 @@ void MainWindow::currentTabChanged(int index)
|
||||||
m_ui->actionDatabaseClose->setEnabled(hasTab);
|
m_ui->actionDatabaseClose->setEnabled(hasTab);
|
||||||
m_ui->actionEntryNew->setEnabled(hasTab);
|
m_ui->actionEntryNew->setEnabled(hasTab);
|
||||||
m_ui->actionGroupNew->setEnabled(hasTab);
|
m_ui->actionGroupNew->setEnabled(hasTab);
|
||||||
|
m_ui->actionGroupEdit->setEnabled(hasTab);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue