Skip to content

Commit

Permalink
Merge pull request #1073 from deXol/develop
Browse files Browse the repository at this point in the history
Notes: Rename discard to Discard Changes and Exit, fix #1071
  • Loading branch information
limpkin authored Sep 28, 2022
2 parents 7f3f851 + 7e30b7a commit 98301b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/NotesManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include <QListWidget>

const QString NotesManagement::EXIT_TEXT = tr("Exit");
const QString NotesManagement::DISCARD_TEXT = tr("Discard Changes and Exit");

NotesManagement::NotesManagement(QWidget *parent) :
QWidget(parent),
ui(new Ui::NotesManagement)
Expand All @@ -16,6 +19,8 @@ NotesManagement::NotesManagement(QWidget *parent) :
ui->pushButtonSave->setStyleSheet(CSS_BLUE_BUTTON);
ui->pushButtonDiscard->setStyleSheet(CSS_BLUE_BUTTON);

ui->pushButtonDiscard->setText(EXIT_TEXT);

ui->stackedWidget->setCurrentWidget(ui->pageListNotes);
ui->scrollArea->setStyleSheet("QScrollArea { background-color:transparent; }");
ui->scrollAreaWidgetContents->setStyleSheet("#scrollAreaWidgetContents { background-color:transparent; }");
Expand Down Expand Up @@ -190,6 +195,7 @@ void NotesManagement::on_pushButtonDiscard_clicked()
m_isNewFile = false;
m_isNoteEditing = false;
emit updateTabs();
ui->pushButtonDiscard->setText(EXIT_TEXT);
}

void NotesManagement::on_pushButtonSave_clicked()
Expand All @@ -200,6 +206,7 @@ void NotesManagement::on_pushButtonSave_clicked()
ui->stackedWidget->setCurrentWidget(ui->pageListNotes);
ui->labelError->hide();
m_isNoteEditing = false;
ui->pushButtonDiscard->setText(EXIT_TEXT);
}

void NotesManagement::on_toolButtonEditNote_clicked()
Expand Down Expand Up @@ -269,10 +276,12 @@ void NotesManagement::on_textEditNote_textChanged()
if (note == m_noteContentClone || note.isEmpty() || (m_isNewFile && !m_validNoteName))
{
ui->pushButtonSave->hide();
ui->pushButtonDiscard->setText(EXIT_TEXT);
}
else
{
ui->pushButtonSave->show();
ui->pushButtonDiscard->setText(DISCARD_TEXT);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/NotesManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ private slots:
Ui::NotesManagement *ui;

WSClient *wsClient;

static const QString EXIT_TEXT;
static const QString DISCARD_TEXT;
};

#endif // NOTESMANAGEMENT_H
2 changes: 1 addition & 1 deletion src/NotesManagement.ui
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ border-right: none;
</size>
</property>
<property name="text">
<string>Discard</string>
<string>Exit</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 98301b3

Please sign in to comment.