Add a Warning icon on the changed tabs, for edition of dives.

Adds a Warning icon on the changed tabs, this is important as
usability, for you could change something on the 'notes' tab,
change the tab and did't realized that something was changed
( by forgotting or something ), then clicking on the cancel
button. so now there's a friendly reminder that you actually
changed something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-09-18 22:38:38 -03:00
parent bcefa4baff
commit 506b133875
4 changed files with 7 additions and 2 deletions

BIN
icons/warning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -132,10 +132,12 @@ void MainTab::enableEdition()
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
if (isEnabled() && event->type() == QEvent::FocusIn && (object == ui->rating || object == ui->visibility)){
tabBar()->setTabIcon(currentIndex(), QIcon(":warning"));
enableEdition();
}
if (isEnabled() && event->type() == QEvent::MouseButtonPress ) {
tabBar()->setTabIcon(currentIndex(), QIcon(":warning"));
enableEdition();
}
return false; // don't "eat" the event.
@ -340,7 +342,8 @@ void MainTab::reload()
void MainTab::acceptChanges()
{
mainWindow()->dive_list()->setEnabled(true);
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment
ui->diveNotesMessage->animatedHide();
ui->notesButtonBox->hide();
/* now figure out if things have changed */
@ -388,6 +391,8 @@ void MainTab::acceptChanges()
void MainTab::rejectChanges()
{
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment
mainWindow()->dive_list()->setEnabled(true);
if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1){
ui->notes->setText(notesBackup[NULL].notes );

View file

@ -14,7 +14,6 @@ struct DiveList;
class QSortFilterProxyModel;
class DiveTripModel;
namespace Ui
{
class MainWindow;

View file

@ -10,6 +10,7 @@
<file alias="minimum">icons/minimum.svg</file>
<file alias="maximum">icons/maximum.svg</file>
<file alias="average">icons/average.svg</file>
<file alias="warning">icons/warning.png</file>
<file alias="table-css">qt-ui/css/tableviews.css</file>
</qresource>
</RCC>