summaryrefslogtreecommitdiff
path: root/core/pim
authortux_mike <tux_mike>2002-04-10 03:29:24 (UTC)
committer tux_mike <tux_mike>2002-04-10 03:29:24 (UTC)
commit4eb2a1b8698fdcca7a2c74a3fe9a88a297607754 (patch) (side-by-side diff)
tree0787600f2d3e0d4bb314124fff55fa3046bfb2f5 /core/pim
parent0d5d67ab1225446f1796a08d97c0cc025922958f (diff)
downloadopie-4eb2a1b8698fdcca7a2c74a3fe9a88a297607754.zip
opie-4eb2a1b8698fdcca7a2c74a3fe9a88a297607754.tar.gz
opie-4eb2a1b8698fdcca7a2c74a3fe9a88a297607754.tar.bz2
Made rows resize with fonts.
Diffstat (limited to 'core/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp11
-rw-r--r--core/pim/addressbook/abtable.h1
-rw-r--r--core/pim/addressbook/addressbook.cpp8
3 files changed, 20 insertions, 0 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 0911edf..17277b4 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -9,24 +9,26 @@
** 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.
**
**********************************************************************/
+#define QTOPIA_INTERNAL_CONTACT_MRE
+
#include <qpe/categoryselect.h>
#include <qpe/config.h>
#include <qpe/stringutil.h>
#include <qpe/qcopenvelope_qws.h>
#include <qasciidict.h>
#include <qdatetime.h>
#include <qfile.h>
#include "abtable.h"
#include <errno.h>
@@ -440,24 +442,33 @@ QString AbTable::findContactContact( const Contact &entry )
}
void AbTable::addEntry( const Contact &newCnt )
{
int row = numRows();
setNumRows( row + 1 );
updateJournal( newCnt, Contact::ACTION_ADD );
insertIntoTable( newCnt, row );
setCurrentCell( row, 0 );
updateVisible();
}
+void AbTable::resizeRows( int size ) {
+
+ if (numRows()) {
+ for (int i = 0; i < numRows(); i++) {
+ setRowHeight( i, size );
+ }
+ }
+}
+
void AbTable::updateJournal( const Contact &cnt,
Contact::journal_action action, int row )
{
QFile f( journalFileName() );
if ( !f.open(IO_WriteOnly|IO_Append) )
return;
QString buf;
QCString str;
buf = "<Contact ";
cnt.save( buf );
buf += " action=\"" + QString::number( (int)action ) + "\" ";
if ( action == Contact::ACTION_REMOVE || action == Contact::ACTION_REPLACE)
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 9b96997..53635ee 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -77,24 +77,25 @@ public:
void refresh();
bool save( const QString &fn );
void load( const QString &fn );
// addresspicker mode
void setChoiceNames( const QStringList& list);
QStringList choiceNames() const;
void setChoiceSelection(int index, const QStringList& list);
QStringList choiceSelection(int index) const;
void setShowCategory( const QString &c );
QString showCategory() const;
QStringList categories();
+ void resizeRows( int size );
void show();
void setPaintingEnabled( bool e );
public slots:
void slotDoFind( const QString &str, bool caseSensitive, bool backwards,
int category );
signals:
void empty( bool );
void details();
void signalNotFound();
void signalWrapAround();
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index b7b35bc..95a8521 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -228,42 +228,50 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
mbList->insertItem( tr("Font"), fontMenu);
setCentralWidget(abList);
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
}
void AddressbookWindow::slotSetFont( int size ) {
if (size > 2 || size < 0)
size = 1;
startFontSize = size;
+ QFont *currentFont;
+
switch (size) {
case 0:
fontMenu->setItemChecked(0, true);
fontMenu->setItemChecked(1, false);
fontMenu->setItemChecked(2, false);
abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
+ currentFont = new QFont (abList->font());
+ abList->resizeRows(currentFont->pixelSize() + 7);
break;
case 1:
fontMenu->setItemChecked(0, false);
fontMenu->setItemChecked(1, true);
fontMenu->setItemChecked(2, false);
abList->setFont( *defaultFont );
+ currentFont = new QFont (abList->font());
+ abList->resizeRows(currentFont->pixelSize() + 7);
break;
case 2:
fontMenu->setItemChecked(0, false);
fontMenu->setItemChecked(1, false);
fontMenu->setItemChecked(2, true);
abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
+ currentFont = new QFont (abList->font());
+ abList->resizeRows(currentFont->pixelSize() + 7);
break;
}
}
void AddressbookWindow::setDocument( const QString &filename )
{
if ( filename.find(".vcf") != int(filename.length()) - 4 ) return;
QValueList<Contact> cl = Contact::readVCard( filename );
for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) {
// QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?")