Skip to content

Commit 34bbae5

Browse files
committed
base functional working
1 parent 8c88bf2 commit 34bbae5

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

elementbutton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ElementButton : public QWidget
1313
public:
1414
explicit ElementButton(QWidget *parent = nullptr);
1515

16-
private:
16+
public:
1717

1818
QPushButton *p_central_widget;
1919
QVBoxLayout *p_central_layout;

mainwindow.cpp

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ void MainWindow::createAuthorWidgetSettings()
232232
p_author_widget->setLayout(p_about_layout);
233233

234234
connect(p_close_button, SIGNAL(clicked(bool)), p_author_widget, SLOT(close()));
235+
connect(p_close_button, SIGNAL(clicked(bool)), SLOT(clearElementInfoWidget()));
235236
}
236237

237238
void MainWindow::createLogoWidgetSettings()
@@ -286,11 +287,6 @@ void MainWindow::processCreateNewElement(QString name, QString password, QString
286287
void MainWindow::processRemoveElement()
287288
{
288289
removeElement((ElementInfoWidget*) sender());
289-
core.removeElement(sender()->objectName());
290-
core.writeFile();
291-
delete sender();
292-
processRefreshScrollArea();
293-
clearElementInfoWidget();
294290
}
295291

296292
void MainWindow::removeElement(ElementInfoWidget *p_widget)
@@ -302,6 +298,12 @@ void MainWindow::removeElement(ElementInfoWidget *p_widget)
302298
delete p_widget->p_pair_button;
303299
break;
304300
}
301+
302+
core.removeElement(sender()->objectName());
303+
core.writeFile();
304+
delete sender();
305+
processRefreshScrollArea();
306+
clearElementInfoWidget();
305307
}
306308

307309
void MainWindow::processWipeData()
@@ -391,6 +393,10 @@ void MainWindow::createEditConnections()
391393
connect(p_name_input, SIGNAL(sendName(QString)), SLOT(destroyEditConnections()), Qt::UniqueConnection);
392394
connect(p_password_input, SIGNAL(sendPassword(QString)), SLOT(destroyEditConnections()), Qt::UniqueConnection);
393395
connect(p_note_input, SIGNAL(sendNote(QString)), SLOT(destroyEditConnections()), Qt::UniqueConnection);
396+
397+
// p_name_input->setText(sender()->objectName() + " name settings");
398+
// p_password_input->setText(sender()->objectName() + " password settings");
399+
// p_note_input->setText(sender()->objectName() + " note settings");
394400
}
395401

396402
void MainWindow::destroyEditConnections()
@@ -405,6 +411,31 @@ void MainWindow::destroyEditConnections()
405411
disconnect(p_name_input, SIGNAL(sendName(QString)), this, SLOT(destroyEditConnections()));
406412
disconnect(p_password_input, SIGNAL(sendPassword(QString)), this, SLOT(destroyEditConnections()));
407413
disconnect(p_note_input, SIGNAL(sendNote(QString)), this, SLOT(destroyEditConnections()));
414+
415+
processElementEdited((ElementInfoWidget*) sender());
416+
417+
// p_name_input->setText("name settings");
418+
// p_password_input->setText("password settings");
419+
// p_note_input->setText("note settings");
420+
}
421+
422+
void MainWindow::processElementEdited(ElementInfoWidget *p_widget)
423+
{
424+
qDebug() << "element edited : " << p_widget->objectName();
425+
426+
QString name, password, note;
427+
428+
name = p_widget->name;
429+
password = p_widget->password;
430+
note = p_widget->note;
431+
432+
removeElement(p_widget);
433+
434+
core.addElement(name, password, note);
435+
core.writeFile();
436+
437+
setElementInfoWidget(createNewInfoLabel(name, password, note));
438+
processRefreshScrollArea();
408439
}
409440

410441
void MainWindow::clearElementInfoWidget()

mainwindow.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ private :
6969

7070
ElementInfoWidget * createNewInfoLabel(QString name, QString password, QString note);
7171

72+
void removeElement(ElementInfoWidget*);
73+
7274
QString name_buffer,
7375
password_buffer,
7476
note_buffer;
@@ -90,6 +92,8 @@ public slots:
9092

9193
void processReadElementsFromFile();
9294

95+
void processElementEdited(ElementInfoWidget*);
96+
9397
void processTakeName();
9498
void processTakePassword();
9599
void processTakeNote();
@@ -100,7 +104,6 @@ public slots:
100104
void clearElementInfoWidget();
101105

102106
void setElementInfoWidget(ElementInfoWidget*);
103-
void removeElement(ElementInfoWidget*);
104107
void showAuthorWidget();
105108

106109
void copyToNameBuffer(QString);

0 commit comments

Comments
 (0)