X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fdialogs%2Fdbobjectdialog.cpp;h=a87c9a5746c7d0232eec3d5f200e9a23c664ef25;hb=fd3842a08ed15d56745aaa28e77344d5834bd7fb;hp=418cdcae741d2c0dcba9720ce8f8a5c2f9c04008;hpb=f5e644115ec872ad8a8e064eb299f48c650baf9d;p=emufront diff --git a/src/dialogs/dbobjectdialog.cpp b/src/dialogs/dbobjectdialog.cpp index 418cdca..a87c9a5 100644 --- a/src/dialogs/dbobjectdialog.cpp +++ b/src/dialogs/dbobjectdialog.cpp @@ -62,6 +62,10 @@ void DbObjectDialog::connectSignals() connect(editButton, SIGNAL(clicked()), this, SLOT(editButtonClicked())); connect(addButton, SIGNAL(clicked()), this, SLOT(addButtonClicked())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteButtonClicked())); +} + +void DbObjectDialog::connectNameDialogSignals() +{ connect(nameDialog, SIGNAL(dataObjectUpdated()), this, SLOT(updateData())); connect(nameDialog, SIGNAL(updateRejected()), this, SLOT(updateReject())); connect(nameDialog, SIGNAL(test()), this, SLOT(testSlot())); @@ -79,10 +83,19 @@ void DbObjectDialog::insertDb(const EmuFrontObject *ob) const errorMessage->showMessage(tr("Inserting data object %1 failed.").arg(ob->getName())); } +void DbObjectDialog::createEditDialog() +{ + initEditDialog(); + // call this from implementing classes: + //connectNameDialogSignals(); +} + void DbObjectDialog::addObject() { setUIEnabled(false); - if (!nameDialog) initEditDialog(); + if (!nameDialog) { + createEditDialog(); + } deleteCurrentObject(); dbObject = createObject(); nameDialog->setDataObject(dbObject); @@ -94,7 +107,9 @@ void DbObjectDialog::editObject() QModelIndex index = objectList->currentIndex(); if (!index.isValid()) return; - if (!nameDialog) initEditDialog(); + if (!nameDialog) { + createEditDialog(); + } deleteCurrentObject(); dbObject = dbManager->getDataObjectFromModel(&index); activateNameDialog(); @@ -296,3 +311,11 @@ void DbObjectDialog::hideColumns() foreach(int c, hiddenColumns) objectList->hideColumn(c); } + +void DbObjectDialog::closeEvent(QCloseEvent *ev) +{ + qDebug() << "DbObjectDialog closing!"; + setUIEnabled(true); + cleanUp(); +} +