summaryrefslogtreecommitdiff
authorleseb <leseb>2002-06-19 06:08:54 (UTC)
committer leseb <leseb>2002-06-19 06:08:54 (UTC)
commitb83e9d1f794fdd6089beda10697243bb087e3d0a (patch) (side-by-side diff)
treebdd278f80903fcc9463c3623645967fef8e787fa
parent3e7ae42a203c31d44e0c24a29a9a63772ef56046 (diff)
downloadopie-b83e9d1f794fdd6089beda10697243bb087e3d0a.zip
opie-b83e9d1f794fdd6089beda10697243bb087e3d0a.tar.gz
opie-b83e9d1f794fdd6089beda10697243bb087e3d0a.tar.bz2
99 undo actions
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 4547b41..ae1b554 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -9,48 +9,50 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "drawpadcanvas.h"
#include "drawpad.h"
#include "page.h"
#include "tool.h"
#include <qpe/applnk.h>
#include <qpe/filemanager.h>
#include <qpe/mimetype.h>
#include <qbuffer.h>
#include <qimage.h>
#include <qpainter.h>
#include <qtextcodec.h>
#include <qtextstream.h>
#include <qxml.h>
#include <zlib.h>
+const int PAGE_BACKUPS = 99;
+
class DrawPadCanvasXmlHandler: public QXmlDefaultHandler
{
public:
DrawPadCanvasXmlHandler();
~DrawPadCanvasXmlHandler();
QList<Page> pages();
bool startElement(const QString& namespaceURI, const QString& localName,
const QString& qName, const QXmlAttributes& atts);
bool endElement(const QString& namespaceURI, const QString& localName,
const QString& qName);
bool characters(const QString& ch);
private:
enum State {
Unknown,
InTitle,
InDate,
InData
};
State m_state;
QString m_title;
@@ -351,49 +353,49 @@ uint DrawPadCanvas::pageCount()
}
void DrawPadCanvas::selectPage(Page* page)
{
m_pages.findRef(page);
m_pageBackups.clear();
m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
viewport()->update();
emit pagesChanged();
emit pageBackupsChanged();
}
void DrawPadCanvas::backupPage()
{
m_pages.current()->setLastModified(QDateTime::currentDateTime());
Page* currentBackup = m_pageBackups.current();
while (m_pageBackups.last() != currentBackup) {
m_pageBackups.removeLast();
}
- while (m_pageBackups.count() >= (5 + 1)) {
+ while (m_pageBackups.count() >= (PAGE_BACKUPS + 1)) {
m_pageBackups.removeFirst();
}
m_pageBackups.append(new Page(*(m_pages.current())));
emit pageBackupsChanged();
}
void DrawPadCanvas::deleteAll()
{
m_pages.clear();
m_pages.append(new Page("", contentsRect().size()));
m_pages.current()->fill(Qt::white);
m_pageBackups.clear();
m_pageBackups.append(new Page(*(m_pages.current())));
resizeContents(m_pages.current()->width(), m_pages.current()->height());
viewport()->update();
emit pagesChanged();
emit pageBackupsChanged();
}