1 /* Copyright (C) 2003-2006 Jesper K. Pedersen <blackie@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public
5 License as published by the Free Software Foundation; either
6 version 2 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
18 #include "DirtyIndicator.h"
19 #include <kiconloader.h>
23 static MainWindow::DirtyIndicator
* _instance
= 0;
24 bool MainWindow::DirtyIndicator::_autoSaveDirty
= false;
25 bool MainWindow::DirtyIndicator::_saveDirty
= false;
27 MainWindow::DirtyIndicator::DirtyIndicator( QWidget
* parent
)
30 _dirtyPix
= QPixmap( SmallIcon( QString::fromLatin1( "media-floppy" ) ) );
31 setFixedWidth( _dirtyPix
.width() );
34 // Might have been marked dirty even before the indicator had been created, by the database searching during loading.
39 void MainWindow::DirtyIndicator::markDirty()
42 _instance
->markDirtySlot();
45 _autoSaveDirty
= true;
49 void MainWindow::DirtyIndicator::markDirtySlot() {
51 _autoSaveDirty
= true;
52 setPixmap( _dirtyPix
);
56 void MainWindow::DirtyIndicator::autoSaved()
58 _autoSaveDirty
= false;
61 void MainWindow::DirtyIndicator::saved()
63 _autoSaveDirty
= false;
65 setPixmap( QPixmap() );
68 bool MainWindow::DirtyIndicator::isSaveDirty() const
73 bool MainWindow::DirtyIndicator::isAutoSaveDirty() const
75 return _autoSaveDirty
;
79 #include "DirtyIndicator.moc"