summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/holiday/national/nationalcfg.cpp2
-rw-r--r--core/pim/datebook/holiday/national/nationalcfg.h2
-rw-r--r--inputmethods/handwriting/qimpenwidget.cpp2
-rw-r--r--inputmethods/handwriting/qimpenwidget.h2
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp2
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.h2
-rw-r--r--library/lightstyle.cpp8
-rw-r--r--library/lightstyle.h8
8 files changed, 14 insertions, 14 deletions
diff --git a/core/pim/datebook/holiday/national/nationalcfg.cpp b/core/pim/datebook/holiday/national/nationalcfg.cpp
index f71c833..33e9db3 100644
--- a/core/pim/datebook/holiday/national/nationalcfg.cpp
+++ b/core/pim/datebook/holiday/national/nationalcfg.cpp
@@ -183,189 +183,189 @@ bool NHcfg::parsevalue(const QString&name,const QXmlAttributes&attr)
if (e.count()!=2){err=QString("Datestring %1 is invalid (entry %2)").arg(dstring).arg(counter);return false;}
QDate d(0,e[0].toInt(),e[1].toInt());
m_currentEntry.setDate(d);
return true;
}
bool NHcfg::parseCalc(const QString&name,const QXmlAttributes&attr)
{
++level;
int vindex = attr.index(_content_value);
if (vindex == -1) {
err = QString("Value for element %1 on entry %2 is missing").arg(name).arg(counter);
return false;
}
int what_c =0;
QString what = name.lower();
QString value;
if (what == _content_date) {
what_c = 1;
} else if (what == _content_weekd) {
what_c = 2;
} else if (what == _content_offset) {
what_c = 3;
} else if (what == _content_dayofmonth) {
what_c = 4;
} else if (what == _content_datedep) {
what_c = 5;
} else if (what == _content_month) {
what_c = 6;
}
if (what_c == 0) {
err = QString("Unknown element %1 on entry %2").arg(name).arg(counter);
return false;
}
value = attr.value(vindex).lower();
QStringList e;
QDate d;
bool dotformat = false;
switch (what_c) {
case 1:
if (value != "easter") {
e = QStringList::split("-",value);
if (e.count()!=2) {
e = QStringList::split(".",value);
dotformat = true;
}
if (e.count()!=2){err=QString("Datestring %1 is invalid (entry %2)").arg(value).arg(counter);return false;}
if (!dotformat) {
d=QDate(0,e[0].toInt(),e[1].toInt());
} else {
d=QDate(0,e[1].toInt(),e[0].toInt());
}
} else {
d=QDate(9999,1,1);
}
m_currentEntry.setDate(d);
break;
case 2:
m_currentEntry.setWeekday(value);
break;
case 3:
m_currentEntry.setOffet(value.toInt());
break;
case 4:
m_currentEntry.setDayofmonth(value);
break;
case 5:
m_currentEntry.setDaydep(value);
break;
case 6:
m_currentEntry.setMonth(value);
break;
}
return true;
}
bool NHcfg::endElement(const QString&, const QString&,const QString& name)
{
// odebug << "End element: " << name << oendl;
if (name==_key_entry) {
if (m_currentEntry.type()==NHentry::fix) {
currentFixList.append(m_currentEntry);
} else {
currentFloatList.append(m_currentEntry);
// odebug << "Floatlist count " << currentFloatList.count() << oendl;
}
} else if (name==_key_calc) {
}
if (stage>=3) {
--level;
}
// odebug << "Level == " << level << oendl;
return true;
}
-const QString&NHcfg::errorString()const
+QString NHcfg::errorString() const
{
return err;
}
NHentry::NHentry()
:m_Type(fix)
{
m_Offset=0;
}
NHentry::~NHentry()
{}
void NHentry::setName(const QString&aName)
{
m_Name = aName;
}
const QString&NHentry::name()const
{
return m_Name;
}
void NHentry::setType(NHentry::entry_type aType)
{
m_Type = aType;
}
NHentry::entry_type NHentry::type()const
{
return m_Type;
}
void NHentry::setDate(const QDate&aDate)
{
m_Date = aDate;
}
const QDate&NHentry::date()const
{
return m_Date;
}
void NHentry::setWeekday(const QString&aDay)
{
m_Weekday = aDay;
}
const QString&NHentry::weekday()const
{
return m_Weekday;
}
void NHentry::setDayofmonth(const QString&aDay)
{
m_Dayofmonth = aDay;
}
const QString&NHentry::dayofmonth()const
{
return m_Dayofmonth;
}
void NHentry::setDaydep(const QString&dep)
{
m_Depth = dep;
}
const QString&NHentry::daydep()const
{
return m_Depth;
}
void NHentry::setMonth(const QString&month)
{
m_Month = month;
}
const QString&NHentry::month()const
{
return m_Month;
}
void NHentry::setOffet(int aOffset)
{
m_Offset = aOffset;
}
const int NHentry::offset()const
{
return m_Offset;
}
diff --git a/core/pim/datebook/holiday/national/nationalcfg.h b/core/pim/datebook/holiday/national/nationalcfg.h
index 872df65..2aedd95 100644
--- a/core/pim/datebook/holiday/national/nationalcfg.h
+++ b/core/pim/datebook/holiday/national/nationalcfg.h
@@ -1,75 +1,75 @@
#ifndef _NATIONAL_CFG_H
#define _NATIONAL_CFG_H
#include <qxml.h>
#include <qstringlist.h>
#include <qvaluelist.h>
#include <qmap.h>
#include <qdatetime.h>
typedef QMap<QDate,QStringList> tholidaylist;
class NHentry
{
public:
enum entry_type{fix,floating};
NHentry();
virtual ~NHentry();
void setName(const QString&);
const QString&name()const;
void setType(entry_type);
entry_type type()const;
void setDate(const QDate&);
const QDate&date()const;
void setWeekday(const QString&);
const QString&weekday()const;
void setDayofmonth(const QString&);
const QString&dayofmonth()const;
void setDaydep(const QString&);
const QString&daydep()const;
void setMonth(const QString&);
const QString&month()const;
void setOffet(int);
const int offset()const;
protected:
entry_type m_Type;
QString m_Name,m_Weekday,m_Dayofmonth,m_Depth,m_Month;
QDate m_Date;
int m_Offset;
};
typedef QValueList<NHentry> tentrylist;
class NHcfg:public QXmlDefaultHandler
{
public:
NHcfg();
virtual ~NHcfg();
bool load(const QString&);
const tentrylist&fixDates()const;
const tentrylist&floatingDates()const;
virtual bool warning(const QXmlParseException& e);
virtual bool error(const QXmlParseException& e);
virtual bool fatalError(const QXmlParseException& e);
virtual bool startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr);
virtual bool endElement(const QString&, const QString&,const QString& name);
- virtual const QString&errorString()const;
+ virtual QString errorString()const;
protected:
QString err,_contentname;
QString _path;
NHentry m_currentEntry;
bool setName(const QXmlAttributes&);
bool parsevalue(const QString&,const QXmlAttributes&);
bool parseCalc(const QString&,const QXmlAttributes&);
int stage,counter,level;
tentrylist currentFloatList,currentFixList;
};
#endif
diff --git a/inputmethods/handwriting/qimpenwidget.cpp b/inputmethods/handwriting/qimpenwidget.cpp
index 8f8f582..7223e1a 100644
--- a/inputmethods/handwriting/qimpenwidget.cpp
+++ b/inputmethods/handwriting/qimpenwidget.cpp
@@ -189,193 +189,193 @@ void QIMPenWidget::showCharacter( QIMPenChar *ch, int speed )
if ( !ch || ch->isEmpty() ) {
mode = Waiting;
return;
}
outputChar = ch;
outputStroke = outputChar->penStrokes().getFirst();
if ( speed < 0 ) speed = 0;
if ( speed > 20 ) speed = 20;
speed = 50 - speed;
pointIndex = 0;
strokeIndex = 0;
lastPoint = outputStroke->startingPoint();
QRect br( outputChar->boundingRect() );
lastPoint.setX( (width() - br.width()) / 2 + (lastPoint.x () - br.left()) );
QPoint offset = lastPoint - outputStroke->startingPoint();
br.moveBy( offset.x(), offset.y() );
dirtyRect |= br;
timer->start( speed );
}
/*!
Handle drawing/clearing of characters.
*/
void QIMPenWidget::timeout()
{
if ( mode == Output ) {
const QArray<QIMPenGlyphLink> &chain = outputStroke->chain();
if ( pointIndex < chain.count() ) {
QPainter paint( this );
paint.setBrush( Qt::black );
for ( unsigned i = 0; i < 3 && pointIndex < chain.count(); i++ ) {
lastPoint.rx() += chain[pointIndex].dx;
lastPoint.ry() += chain[pointIndex].dy;
pointIndex++;
paint.drawRect( lastPoint.x()-1, lastPoint.y()-1, 2, 2 );
}
}
if ( pointIndex >= chain.count() ) {
QIMPenStrokeList strokes = outputChar->penStrokes();
if ( strokeIndex < (int)strokes.count() - 1 ) {
pointIndex = 0;
strokeIndex++;
outputStroke = strokes.at( strokeIndex );
lastPoint = outputChar->startingPoint();
QRect br( outputChar->boundingRect() );
lastPoint.setX( (width() - br.width()) / 2
+ (lastPoint.x () - br.left()) );
QPoint off = lastPoint - outputChar->startingPoint();
lastPoint = outputStroke->startingPoint() + off;
} else {
timer->stop();
mode = Waiting;
}
}
} else if ( mode == Waiting ) {
QRect r( dirtyRect );
if ( !r.isNull() ) {
r.moveBy( -2, -2 );
r.setSize( r.size() + QSize( 4, 4 ) );
repaint( r );
}
}
}
/*!
If the point \a p is over one of the character set titles, switch
to the set and return TRUE.
*/
bool QIMPenWidget::selectSet( QPoint p )
{
if ( charSets.count() ) {
CharSetEntryIterator it( charSets );
int spos = 0;
int idx = 0;
for ( ; it.current(); ++it, idx++ ) {
int setWidth = width() * it.current()->stretch / totalStretch;
spos += setWidth;
if ( p.x() < spos ) {
if ( idx != currCharSet ) {
currCharSet = idx;
update( 0, 0, width(), 12 );
emit changeCharSet( currCharSet );
emit changeCharSet( charSets.at(currCharSet)->cs );
}
break;
}
}
}
return FALSE;
}
/*!
Hopefully returns a sensible size.
*/
-QSize QIMPenWidget::sizeHint()
+QSize QIMPenWidget::sizeHint() const
{
return QSize( TITLE_WIDTH * charSets.count(), 75 );
}
void QIMPenWidget::mousePressEvent( QMouseEvent *e )
{
if ( !readOnly && e->button() == LeftButton && mode == Waiting ) {
// if selectSet returns false the click was not over the
// char set selectors.
if ( !selectSet( e->pos() ) ) {
// start of character input
timer->stop();
if ( outputChar ) {
outputChar = 0;
outputStroke = 0;
repaint();
}
mode = Input;
lastPoint = e->pos();
emit beginStroke();
inputStroke = new QIMPenStroke;
strokes.append( inputStroke );
inputStroke->beginInput( e->pos() );
QPainter paint( this );
paint.setBrush( Qt::black );
paint.drawRect( lastPoint.x()-1, lastPoint.y()-1, 2, 2 );
}
}
}
void QIMPenWidget::mouseReleaseEvent( QMouseEvent *e )
{
if ( !readOnly && e->button() == LeftButton && mode == Input ) {
mode = Waiting;
inputStroke->endInput();
if ( charSets.count() )
emit stroke( inputStroke );
inputStroke = 0;
}
}
void QIMPenWidget::mouseMoveEvent( QMouseEvent *e )
{
if ( !readOnly && mode == Input ) {
int dx = QABS( e->pos().x() - lastPoint.x() );
int dy = QABS( e->pos().y() - lastPoint.y() );
if ( dx + dy > 1 ) {
if ( inputStroke->addPoint( e->pos() ) ) {
QPainter paint( this );
paint.setPen( Qt::black );
paint.setBrush( Qt::black );
const QArray<QIMPenGlyphLink> &chain = inputStroke->chain();
QPoint p( e->pos() );
for ( int i = (int)chain.count()-1; i >= 0; i-- ) {
paint.drawRect( p.x()-1, p.y()-1, 2, 2 );
p.rx() -= chain[i].dx;
p.ry() -= chain[i].dy;
if ( p == lastPoint )
break;
}
/* ### use this when thick lines work properly on all devices
paint.setPen( QPen( Qt::black, 2 ) );
paint.drawLine( lastPoint, e->pos() );
*/
}
lastPoint = e->pos();
}
}
}
void QIMPenWidget::paintEvent( QPaintEvent * )
{
QPainter paint( this );
// draw guidelines
paint.setPen( Qt::gray );
paint.drawLine( 0, 0, width(), 0 );
int y = height() / 3;
paint.drawLine( 0, y, width(), y );
y *= 2;
paint.setPen( blue );
paint.drawLine( 0, y, width(), y );
paint.setPen( Qt::gray );
if ( !charSets.count() )
return;
// draw the character set titles
QFont selFont( "helvetica", 8, QFont::Bold );
QFont font( "helvetica", 8 );
CharSetEntryIterator it( charSets );
int spos = 0;
for ( ; it.current(); ++it ) {
int setWidth = width() * it.current()->stretch / totalStretch;
spos += setWidth;
diff --git a/inputmethods/handwriting/qimpenwidget.h b/inputmethods/handwriting/qimpenwidget.h
index 98d7f5c..d156554 100644
--- a/inputmethods/handwriting/qimpenwidget.h
+++ b/inputmethods/handwriting/qimpenwidget.h
@@ -1,88 +1,88 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qwidget.h>
#include <qlist.h>
#include "qimpenchar.h"
class QIMPenWidget : public QWidget
{
Q_OBJECT
public:
QIMPenWidget( QWidget *parent );
void clear();
void greyStroke();
void setReadOnly( bool r ) { readOnly = r; }
void insertCharSet( QIMPenCharSet *cs, int stretch=1, int pos=-1 );
void removeCharSet( int );
void changeCharSet( QIMPenCharSet *cs, int pos );
void clearCharSets();
void showCharacter( QIMPenChar *, int speed = 10 );
- virtual QSize sizeHint();
+ virtual QSize sizeHint() const;
public slots:
void removeStroke();
signals:
void changeCharSet( QIMPenCharSet *cs );
void changeCharSet( int );
void beginStroke();
void stroke( QIMPenStroke *ch );
protected slots:
void timeout();
protected:
enum Mode { Waiting, Input, Output };
bool selectSet( QPoint );
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseReleaseEvent( QMouseEvent *e );
virtual void mouseMoveEvent( QMouseEvent *e );
virtual void paintEvent( QPaintEvent *e );
virtual void resizeEvent( QResizeEvent *e );
struct CharSetEntry {
QIMPenCharSet *cs;
int stretch;
};
typedef QList<CharSetEntry> CharSetEntryList;
typedef QListIterator<CharSetEntry> CharSetEntryIterator;
protected:
Mode mode;
bool autoHide;
bool readOnly;
QPoint lastPoint;
unsigned pointIndex;
int strokeIndex;
int currCharSet;
QTimer *timer;
QColor strokeColor;
QRect dirtyRect;
QIMPenChar *outputChar;
QIMPenStroke *outputStroke;
QIMPenStroke *inputStroke;
QIMPenStrokeList strokes;
CharSetEntryList charSets;
int totalStretch;
};
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
index 55e47e2..2ebccd2 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
@@ -198,193 +198,193 @@ namespace {
int total_written;
for ( it = list.begin(); it != list.end(); ++it ) {
buf = "<event";
save( it.data(), buf );
buf += " />\n";
str = buf.utf8();
total_written = file.writeBlock(str.data(), str.length() );
if ( total_written != int(str.length() ) )
return false;
}
return true;
}
}
namespace Opie {
ODateBookAccessBackend_XML::ODateBookAccessBackend_XML( const QString& ,
const QString& fileName )
: ODateBookAccessBackend() {
m_name = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.xml" ) : fileName;
m_changed = false;
}
ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() {
}
bool ODateBookAccessBackend_XML::load() {
return loadFile();
}
bool ODateBookAccessBackend_XML::reload() {
clear();
return load();
}
bool ODateBookAccessBackend_XML::save() {
if (!m_changed) return true;
int total_written;
QString strFileNew = m_name + ".new";
QFile f( strFileNew );
if (!f.open( IO_WriteOnly | IO_Raw ) ) return false;
QString buf( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
buf += "<!DOCTYPE DATEBOOK><DATEBOOK>\n";
buf += "<events>\n";
QCString str = buf.utf8();
total_written = f.writeBlock( str.data(), str.length() );
if ( total_written != int(str.length() ) ) {
f.close();
QFile::remove( strFileNew );
return false;
}
if (!saveEachEvent( m_raw, f ) ) {
f.close();
QFile::remove( strFileNew );
return false;
}
if (!saveEachEvent( m_rep, f ) ) {
f.close();
QFile::remove( strFileNew );
return false;
}
buf = "</events>\n</DATEBOOK>\n";
str = buf.utf8();
total_written = f.writeBlock( str.data(), str.length() );
if ( total_written != int(str.length() ) ) {
f.close();
QFile::remove( strFileNew );
return false;
}
f.close();
if ( ::rename( strFileNew, m_name ) < 0 ) {
QFile::remove( strFileNew );
return false;
}
m_changed = false;
return true;
}
QArray<int> ODateBookAccessBackend_XML::allRecords()const {
QArray<int> ints( m_raw.count()+ m_rep.count() );
uint i = 0;
QMap<int, OPimEvent>::ConstIterator it;
for ( it = m_raw.begin(); it != m_raw.end(); ++it ) {
ints[i] = it.key();
i++;
}
for ( it = m_rep.begin(); it != m_rep.end(); ++it ) {
ints[i] = it.key();
i++;
}
return ints;
}
-QArray<int> ODateBookAccessBackend_XML::queryByExample(const OPimEvent&, int, const QDateTime& ) {
+QArray<int> ODateBookAccessBackend_XML::queryByExample(const OPimEvent&, int, const QDateTime& ) const {
return QArray<int>();
}
void ODateBookAccessBackend_XML::clear() {
m_changed = true;
m_raw.clear();
m_rep.clear();
}
OPimEvent ODateBookAccessBackend_XML::find( int uid ) const{
if ( m_raw.contains( uid ) )
return m_raw[uid];
else
return m_rep[uid];
}
bool ODateBookAccessBackend_XML::add( const OPimEvent& ev ) {
m_changed = true;
if (ev.hasRecurrence() )
m_rep.insert( ev.uid(), ev );
else
m_raw.insert( ev.uid(), ev );
return true;
}
bool ODateBookAccessBackend_XML::remove( int uid ) {
m_changed = true;
m_raw.remove( uid );
m_rep.remove( uid );
return true;
}
bool ODateBookAccessBackend_XML::replace( const OPimEvent& ev ) {
replace( ev.uid() ); // ??? Shouldn't this be "remove( ev.uid() ) ??? (eilers)
return add( ev );
}
QArray<int> ODateBookAccessBackend_XML::rawRepeats()const {
QArray<int> ints( m_rep.count() );
uint i = 0;
QMap<int, OPimEvent>::ConstIterator it;
for ( it = m_rep.begin(); it != m_rep.end(); ++it ) {
ints[i] = it.key();
i++;
}
return ints;
}
QArray<int> ODateBookAccessBackend_XML::nonRepeats()const {
QArray<int> ints( m_raw.count() );
uint i = 0;
QMap<int, OPimEvent>::ConstIterator it;
for ( it = m_raw.begin(); it != m_raw.end(); ++it ) {
ints[i] = it.key();
i++;
}
return ints;
}
OPimEvent::ValueList ODateBookAccessBackend_XML::directNonRepeats()const {
OPimEvent::ValueList list;
QMap<int, OPimEvent>::ConstIterator it;
for (it = m_raw.begin(); it != m_raw.end(); ++it )
list.append( it.data() );
return list;
}
OPimEvent::ValueList ODateBookAccessBackend_XML::directRawRepeats()const {
OPimEvent::ValueList list;
QMap<int, OPimEvent>::ConstIterator it;
for (it = m_rep.begin(); it != m_rep.end(); ++it )
list.append( it.data() );
return list;
}
// FIXME: Use OPimEvent::fromMap() (eilers)
bool ODateBookAccessBackend_XML::loadFile() {
m_changed = false;
int fd = ::open( QFile::encodeName(m_name).data(), O_RDONLY );
if ( fd < 0 ) return false;
struct stat attribute;
if ( ::fstat(fd, &attribute ) == -1 ) {
::close( fd );
return false;
}
void* map_addr = ::mmap(NULL, attribute.st_size, PROT_READ, MAP_SHARED, fd, 0 );
if ( map_addr == ( (caddr_t)-1) ) {
::close( fd );
return false;
}
::madvise( map_addr, attribute.st_size, MADV_SEQUENTIAL );
::close( fd );
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
index cb19f76..7369c07 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.h
@@ -1,88 +1,88 @@
/*
This file is part of the Opie Project
Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H
#define OPIE_DATE_BOOK_ACCESS_BACKEND_XML__H
#include <qmap.h>
#include <opie2/odatebookaccessbackend.h>
namespace Opie {
/**
* This is the default XML implementation for DateBoook XML storage
* It fully implements the interface
* @see ODateBookAccessBackend
* @see OPimAccessBackend
*/
class ODateBookAccessBackend_XML : public ODateBookAccessBackend {
public:
ODateBookAccessBackend_XML( const QString& appName,
const QString& fileName = QString::null);
~ODateBookAccessBackend_XML();
bool load();
bool reload();
bool save();
QArray<int> allRecords()const;
QArray<int> matchRegexp(const QRegExp &r) const;
- QArray<int> queryByExample( const OPimEvent&, int, const QDateTime& d = QDateTime() );
+ QArray<int> queryByExample( const OPimEvent&, int, const QDateTime& d = QDateTime() )const;
OPimEvent find( int uid )const;
void clear();
bool add( const OPimEvent& ev );
bool remove( int uid );
bool replace( const OPimEvent& ev );
QArray<UID> rawEvents()const;
QArray<UID> rawRepeats()const;
QArray<UID> nonRepeats()const;
OPimEvent::ValueList directNonRepeats()const;
OPimEvent::ValueList directRawRepeats()const;
private:
bool m_changed :1 ;
bool m_noTimeZone : 1;
bool loadFile();
inline void finalizeRecord( OPimEvent& ev );
inline void setField( OPimEvent&, int field, const QString& val );
QString m_name;
QMap<int, OPimEvent> m_raw;
QMap<int, OPimEvent> m_rep;
struct Data;
Data* data;
class Private;
Private *d;
};
}
#endif
diff --git a/library/lightstyle.cpp b/library/lightstyle.cpp
index c5073ca..3d5adfb 100644
--- a/library/lightstyle.cpp
+++ b/library/lightstyle.cpp
@@ -297,243 +297,243 @@ void LightStyle::drawPushButton(QPushButton *button, QPainter *p)
{
int x1, y1, x2, y2;
button->rect().coords(&x1, &y1, &x2, &y2);
if (button->isDefault()) {
p->save();
p->setPen(button->palette().active().color(QColorGroup::Highlight));
p->setBrush(button->palette().active().brush(QColorGroup::Highlight));
p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15);
p->restore();
}
if (button->isDefault() || button->autoDefault()) {
x1 += buttonDefaultIndicatorWidth();
y1 += buttonDefaultIndicatorWidth();
x2 -= buttonDefaultIndicatorWidth();
y2 -= buttonDefaultIndicatorWidth();
if (button->isDefault()) {
QPointArray pa(8);
pa.setPoint(0, x1 + 2, y1 );
pa.setPoint(1, x2 - 1, y1 );
pa.setPoint(2, x2 + 1, y1 + 2);
pa.setPoint(3, x2 + 1, y2 - 2);
pa.setPoint(4, x2 - 2, y2 + 1);
pa.setPoint(5, x1 + 2, y2 + 1);
pa.setPoint(6, x1, y2 - 1);
pa.setPoint(7, x1, y1 + 2);
QRegion r(pa);
p->setClipRegion(r);
}
}
QBrush fill;
if (button->isDown() || button->isOn())
fill = button->colorGroup().brush(QColorGroup::Mid);
else
fill = button->colorGroup().brush(QColorGroup::Button);
if ( !button->isFlat() || button->isOn() || button->isDown() )
drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1,
button->colorGroup(), button->isOn() || button->isDown(), &fill);
}
void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g,
bool sunken, const QBrush *fill)
{
p->save();
if ( fill )
p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
else
p->fillRect(x + 2, y + 2, w - 4, h - 4,
QBrush(sunken ? g.mid() : g.button()));
// frame
p->setPen(g.dark());
p->drawLine(x, y + 2, x, y + h - 3); // left
p->drawLine(x + 2, y, x + w - 3, y); // top
p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right
p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom
p->drawPoint(x + 1, y + 1);
p->drawPoint(x + 1, y + h - 2);
p->drawPoint(x + w - 2, y + 1);
p->drawPoint(x + w - 2, y + h - 2);
// bevel
if (sunken)
p->setPen(g.mid());
else
p->setPen(g.light());
p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left
p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top
if (sunken)
p->setPen(g.light());
else
p->setPen(g.mid());
p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1
p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1
p->restore();
}
void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g,
bool sunken, const QBrush *fill)
{
drawButton(p, x, y, w, h, g, sunken, fill);
}
-void LightStyle::getButtonShift(int &x, int &y) const
+void LightStyle::getButtonShift(int &x, int &y)
{
x = y = 0;
}
void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool,
bool editable, bool,
const QBrush *fill)
{
drawButton(p, x, y, w, h, g, FALSE, fill);
if (editable) {
QRect r = comboButtonRect(x, y, w, h);
qDrawShadePanel(p, r.x() - 1, r.y() - 1,
r.width() + defaultFrameWidth(),
r.height() + defaultFrameWidth(),
g, TRUE);
}
int indent = ((y + h) / 2) - 3;
int xpos = x;
#if QT_VERSION >= 0x030000
if( QApplication::reverseLayout() )
xpos += indent;
else
#endif
xpos += w - indent - 5;
drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill);
}
-QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const
+QRect LightStyle::comboButtonRect( int x, int y, int w, int h )
{
QRect r(x + 3, y + 3, w - 6, h - 6);
int indent = ((y + h) / 2) - 3;
r.setRight(r.right() - indent - 10);
#if QT_VERSION >= 0x030000
if( QApplication::reverseLayout() )
r.moveBy( indent + 10, 0 );
#endif
return r;
}
-QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const
+QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h )
{
return comboButtonRect(x, y, w, h);
}
void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken,
int lw, const QBrush *fill)
{
if (lw >= 2) {
if ( fill )
p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
QPen oldpen = p->pen();
// frame
p->setPen(g.dark());
p->drawLine(x, y + 2, x, y + h - 3); // left
p->drawLine(x + 2, y, x + w - 3, y); // top
p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right
p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom
p->drawPoint(x + 1, y + 1);
p->drawPoint(x + 1, y + h - 2);
p->drawPoint(x + w - 2, y + 1);
p->drawPoint(x + w - 2, y + h - 2);
// bevel
if (sunken)
p->setPen(g.mid());
else
p->setPen(g.light());
p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left
p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top
if (sunken)
p->setPen(g.light());
else
p->setPen(g.mid());
p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1
p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1
// corners
p->setPen(g.background());
p->drawLine(x, y, x + 1, y);
p->drawLine(x, y + h - 1, x + 1, y + h - 1);
p->drawLine(x + w - 2, y, x + w - 1, y);
p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1);
p->drawPoint(x, y + 1);
p->drawPoint(x, y + h - 2);
p->drawPoint(x + w - 1, y + 1);
p->drawPoint(x + w - 1, y + h - 2);
p->setPen(oldpen);
} else
qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill);
}
void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h,
const QColorGroup &g, int state,
bool down, bool)
{
drawButton(p, x, y, w, h, g, TRUE,
&g.brush(down ? QColorGroup::Mid : QColorGroup::Base));
p->save();
p->setPen(g.foreground());
if (state == QButton::NoChange) {
p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2);
p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2);
p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2);
} else if (state == QButton::On) {
p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5);
p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4);
p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4);
p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3);
p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3);
p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4);
}
p->restore();
}
void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool on,
bool down, bool)
{
p->save();
p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
p->setPen(g.dark());
@@ -708,193 +708,193 @@ void LightStyle::drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab,
} else
p->drawLine(fr.left(), fr.bottom(), fr.right() + 2, fr.bottom());
if (fr.left() == 2) {
p->drawPoint(fr.left() - 1, fr.bottom() + 1);
p->drawPoint(fr.left() - 2, fr.bottom() + 2);
}
if (selected) {
p->setPen(g.mid());
p->drawLine(fr.right() - 1, fr.top() + 1, fr.right() - 1, fr.bottom() - 2);
}
p->setPen(g.light()); p->setPen(red);
p->drawLine(fr.left() + 1, fr.top() + 6, fr.left() + 1,
fr.bottom() - (selected ? 0 : 1));
p->drawLine(fr.left() + 1, fr.top() + 5, fr.left() + 5, fr.top() + 1);
p->drawLine(fr.left() + 6, fr.top() + 1, fr.right() - 3, fr.top() + 1);
if (selected) {
p->drawLine(fr.right() + 1, fr.bottom() + 1,
fr.right() + 2, fr.bottom() + 1);
p->drawLine(fr.left(), fr.bottom() + 1, fr.left() + 1, fr.bottom() + 1);
} else
p->drawLine(fr.left(), fr.bottom() + 1,
fr.right() + 2, fr.bottom() + 1);
} else if (tabbar->shape() == QTabBar::RoundedBelow) {
// "rounded" tabs on bottom
fr.setTop(fr.top() + 1);
p->setPen(g.dark());
p->drawLine(fr.left(), fr.top(), fr.left(), fr.bottom() - 1);
p->drawLine(fr.left() + 1, fr.bottom(), fr.right() - 1, fr.bottom());
p->drawLine(fr.right(), fr.top(), fr.right(), fr.bottom() - 1);
if (! selected)
p->drawLine(fr.left(), fr.top(), fr.right() + 3, fr.top());
else
p->drawLine(fr.right(), fr.top(), fr.right() + 3, fr.top());
p->setPen(g.mid());
if (selected)
p->drawLine(fr.right() - 1, fr.top() + 1, fr.right() - 1, fr.bottom() - 1);
else
p->drawLine(fr.left(), fr.top() - 1, fr.right() + 3, fr.top() - 1);
p->setPen(g.light());
p->drawLine(fr.left() + 1, fr.top() + (selected ? -1 : 2),
fr.left() + 1, fr.bottom() - 1);
} else {
// triangular drawing code
QCommonStyle::drawTab(p, tabbar, tab, selected);
}
p->restore();
}
#endif
void LightStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, Qt::Orientation orientation,
bool above, bool below)
{
drawButton(p, x, y, w, h, g, FALSE, &g.brush(QColorGroup::Button));
if (orientation == Horizontal) {
if (above && below) {
drawArrow(p, Qt::UpArrow, FALSE, x + 1, y + 1, w, h / 2, g, TRUE);
drawArrow(p, Qt::DownArrow, FALSE, x + 1, y + (h / 2) - 1,
w, h / 2, g, TRUE);
} else
drawArrow(p, (above) ? Qt::UpArrow : Qt::DownArrow,
FALSE, x + 1, y, w, h, g, TRUE);
} else {
if (above && below) {
drawArrow(p, Qt::LeftArrow, FALSE, x + 1, y, w / 2, h, g, TRUE);
drawArrow(p, Qt::RightArrow, FALSE, x + (w / 2) - 2, y, w / 2, h, g, TRUE);
} else
drawArrow(p, (above) ? Qt::LeftArrow : Qt::RightArrow,
FALSE, x, y, w, h, g, TRUE);
}
}
void LightStyle::drawSliderGroove(QPainter *p, int x, int y, int w, int h,
const QColorGroup& g, QCOORD c,
Qt::Orientation orientation)
{
if (orientation == Horizontal)
drawButton(p, x, y+c - 3, w, 6, g, TRUE, &g.brush(QColorGroup::Mid));
else
drawButton(p, x+c - 3, y, 6, h, g, TRUE, &g.brush(QColorGroup::Mid));
}
void LightStyle::scrollBarMetrics(const QScrollBar *scrollbar,
int &sliderMin, int &sliderMax,
- int &sliderLength, int &buttonDim) const
+ int &sliderLength, int &buttonDim)
{
int maxLength;
int length = ((scrollbar->orientation() == Horizontal) ?
scrollbar->width() : scrollbar->height());
int extent = ((scrollbar->orientation() == Horizontal) ?
scrollbar->height() : scrollbar->width());
extent--;
if (length > (extent + defaultFrameWidth() - 1) * 2 + defaultFrameWidth())
buttonDim = extent - defaultFrameWidth();
else
buttonDim = (length - defaultFrameWidth()) / 2 - 1;
sliderMin = buttonDim;
maxLength = length - buttonDim * 3;
if (scrollbar->maxValue() != scrollbar->minValue()) {
uint range = scrollbar->maxValue() - scrollbar->minValue();
sliderLength = (scrollbar->pageStep() * maxLength) /
(range + scrollbar->pageStep());
if (sliderLength < buttonDim || range > INT_MAX / 2)
sliderLength = buttonDim;
if (sliderLength > maxLength)
sliderLength = maxLength;
} else
sliderLength = maxLength;
sliderMax = sliderMin + maxLength - sliderLength;
}
QStyle::ScrollControl LightStyle::scrollBarPointOver(const QScrollBar *scrollbar,
int sliderStart, const QPoint &p)
{
if (! scrollbar->rect().contains(p))
return NoScroll;
int sliderMin, sliderMax, sliderLength, buttonDim, pos;
scrollBarMetrics( scrollbar, sliderMin, sliderMax, sliderLength, buttonDim );
if (scrollbar->orientation() == Horizontal)
pos = p.x();
else
pos = p.y();
if (pos < buttonDim)
return SubLine;
if (pos < sliderStart)
return SubPage;
if (pos < sliderStart + sliderLength)
return Slider;
if (pos < sliderMax + sliderLength)
return AddPage;
if (pos < sliderMax + sliderLength + buttonDim)
return SubLine;
return AddLine;
}
void LightStyle::drawScrollBarControls( QPainter* p, const QScrollBar* scrollbar,
int sliderStart, uint controls,
uint activeControl )
{
QColorGroup g = scrollbar->colorGroup();
int sliderMin, sliderMax, sliderLength, buttonDim;
scrollBarMetrics( scrollbar, sliderMin, sliderMax, sliderLength, buttonDim );
if (sliderStart > sliderMax) { // sanity check
sliderStart = sliderMax;
}
QRect addR, subR, subR2, addPageR, subPageR, sliderR;
int length = ((scrollbar->orientation() == Horizontal) ?
scrollbar->width() : scrollbar->height());
int extent = ((scrollbar->orientation() == Horizontal) ?
scrollbar->height() : scrollbar->width());
int fudge = 3; //####disgusting hack
if (scrollbar->orientation() == Horizontal) {
subR.setRect(0, defaultFrameWidth(),
buttonDim + fudge, buttonDim);
subR2.setRect(length - (buttonDim * 2), defaultFrameWidth() ,
buttonDim, buttonDim);
addR.setRect(length - buttonDim, defaultFrameWidth(),
buttonDim, buttonDim);
} else {
subR.setRect(defaultFrameWidth() + 1, 0,
buttonDim, buttonDim + fudge);
subR2.setRect(defaultFrameWidth() + 1, length - (buttonDim * 2),
buttonDim, buttonDim);
addR.setRect(defaultFrameWidth() + 1, length - buttonDim,
diff --git a/library/lightstyle.h b/library/lightstyle.h
index 0392957..52e19b2 100644
--- a/library/lightstyle.h
+++ b/library/lightstyle.h
@@ -1,120 +1,120 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef LIGHTSTYLE_H
#define LIGHTSTYLE_H
#ifndef QT_H
#include <qstyle.h>
#include <qwindowsstyle.h>
#endif // QT_H
#if QT_VERSION < 0x030000
#ifdef QT_PLUGIN_STYLE_LIGHT
# define Q_EXPORT_STYLE_LIGHT
#else
# define Q_EXPORT_STYLE_LIGHT Q_EXPORT
#endif // QT_PLUGIN_STYLE_LIGHT
class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle
{
public:
LightStyle();
virtual ~LightStyle();
void polish(QWidget *widget);
void unPolish(QWidget*widget);
void polish(QApplication *app);
void unPolish(QApplication *app);
void polishPopupMenu(QPopupMenu *menu);
void drawPushButton(QPushButton *button, QPainter *p);
void drawButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken = FALSE,
const QBrush *fill = 0);
void drawBevelButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken = FALSE,
const QBrush *fill = 0);
- void getButtonShift(int &x, int &y) const;
+ void getButtonShift(int &x, int &y);
void drawComboButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken = FALSE,
bool editable = FALSE, bool = TRUE,
const QBrush *fill = 0);
- QRect comboButtonRect(int x, int y, int w, int h) const;
- QRect comboButtonFocusRect(int x, int y, int w, int h) const;
+ QRect comboButtonRect(int x, int y, int w, int h);
+ QRect comboButtonFocusRect(int x, int y, int w, int h);
void drawIndicator(QPainter *p, int x, int y ,int w, int h,
const QColorGroup &g, int state,
bool = FALSE, bool = TRUE);
QSize indicatorSize() const;
void drawExclusiveIndicator(QPainter *p, int x, int y ,int w, int h,
const QColorGroup &g, bool on,
bool = FALSE, bool = TRUE);
QSize exclusiveIndicatorSize() const;
void drawPanel(QPainter * p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken = FALSE,
int = 1, const QBrush * = 0);
void scrollBarMetrics( const QScrollBar *,
- int &, int &, int &, int & ) const;
+ int &, int &, int &, int & );
void drawScrollBarControls(QPainter* p, const QScrollBar* sb,
int sliderStart, uint controls,
uint activeControl);
QStyle::ScrollControl scrollBarPointOver(const QScrollBar *, int, const QPoint& p);
void drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected);
void drawSlider(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, Qt::Orientation orientation,
bool, bool);
void drawSliderGroove(QPainter *p, int x, int y, int w, int h,
const QColorGroup& g, QCOORD,
Qt::Orientation );
void drawToolBarHandle(QPainter *, const QRect &, Qt::Orientation,
bool, const QColorGroup &, bool = FALSE );
QSize scrollBarExtent() const;
int buttonDefaultIndicatorWidth() const;
int buttonMargin() const;
int sliderThickness() const;
int sliderLength() const;
int defaultFrameWidth() const;
int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& );
int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& );
void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
const QPalette& pal,
bool act, bool enabled, int x, int y, int w, int h);
protected:
bool eventFilter(QObject *, QEvent *);
};
#endif
#endif // LIGHTSTYLE_H