summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abeditor.cpp2
-rw-r--r--core/pim/addressbook/addressbook.cpp8
-rw-r--r--core/pim/addressbook/addressbook.h4
-rw-r--r--core/pim/addressbook/addressbook.pro4
4 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/addressbook/abeditor.cpp b/core/pim/addressbook/abeditor.cpp
index 94baa71..6354db9 100644
--- a/core/pim/addressbook/abeditor.cpp
+++ b/core/pim/addressbook/abeditor.cpp
@@ -8,97 +8,97 @@
** 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 "abeditor.h"
#include "addresspicker.h"
#include <qpe/categoryselect.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qscrollview.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qmainwindow.h>
static inline bool containsAlphaNum( const QString &str );
static inline bool constainsWhiteSpace( const QString &str );
// helper functions, convert our comma delimited list to proper
// file format...
void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
QString &strAll );
// helper convert from file format to comma delimited...
void parseEmailTo( const QString &strDefaultEmail,
const QString &strOtherEmail, QString &strBack );
AbEditor::AbEditor( const Contact &entry, const QValueList<int> *newOrdered,
QStringList *slNewOrdered,
- QWidget *parent, const char *name, WFlags fl )
+ QWidget *parent = 0, const char *name = 0, WFlags fl = 0 )
: QDialog( parent, name, TRUE, fl ),
orderedValues( newOrdered ),
slOrdered( slNewOrdered )
{
init();
initMap();
setEntry( entry );
}
AbEditor::~AbEditor()
{
}
void AbEditor::init()
{
middleEdit = 0;
QVBoxLayout *vb = new QVBoxLayout( this );
svPage = new QScrollView( this );
svPage->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( svPage );
svPage->setResizePolicy( QScrollView::AutoOneFit );
svPage->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( svPage->viewport() );
svPage->addChild( container );
QGridLayout *gl = new QGridLayout( container, 20, 2, 4, 2 );
QLabel *l = new QLabel( tr("First Name"), container );
gl->addWidget( l, 0, 0 );
firstEdit = new QLineEdit( container );
gl->addWidget( firstEdit, 0, 1 );
l = new QLabel( tr("Last Name"), container );
gl->addWidget( l, 1, 0 );
lastEdit = new QLineEdit( container );
gl->addWidget( lastEdit, 1, 1 );
l = new QLabel( tr("Categories"), container );
gl->addWidget( l, 2, 0 );
cmbCat = new CategorySelect( container );
gl->addWidget( cmbCat, 2, 1 );
int i;
bool foundGender,
foundNotes;
foundGender = foundNotes = false;
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index a2b8276..e8fa37c 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,71 +1,71 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop 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.
**
**********************************************************************/
#define QTOPIA_INTERNAL_FD
-#include "abeditor.h"
+#include "contacteditor.h"
#include "ablabel.h"
#include "abtable.h"
#include "addresssettings.h"
#include "addressbook.h"
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/contact.h>
#include <qpe/finddialog.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qpe/ir.h>
#include <qpe/qpemessagebox.h>
#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
#include <qdialog.h>
#include <qdir.h>
#include <qfile.h>
#include <qimage.h>
#include <qlayout.h>
#include <qpe/qpemenubar.h>
#include <qmessagebox.h>
#include <qpixmap.h>
#include <qpopupmenu.h>
#include <qpe/qpetoolbar.h>
#include <qstringlist.h>
#include <qtoolbutton.h>
#include <qwhatsthis.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <qdatetime.h>
static QString addressbookOldXMLFilename()
{
QString filename = QPEApplication::documentDir() + "addressbook.xml";
return filename;
}
static QString addressbookXMLFilename()
{
QString filename = Global::applicationFileName("addressbook",
"addressbook.xml");
@@ -384,208 +384,208 @@ static void parseName( const QString& name, QString *first, QString *middle,
int comma = name.find ( "," );
QString rest;
if ( comma > 0 ) {
*last = name.left( comma );
comma++;
while ( comma < int(name.length()) && name[comma] == ' ' )
comma++;
rest = name.mid( comma );
} else {
int space = name.findRev( ' ' );
*last = name.mid( space+1 );
rest = name.left( space );
}
int space = rest.find( ' ' );
if ( space <= 0 ) {
*first = rest;
} else {
*first = rest.left( space );
*middle = rest.mid( space+1 );
}
}
void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
{
if (msg == "editPersonal()") {
editPersonal();
} else if (msg == "editPersonalAndClose()") {
editPersonal();
close();
} else if ( msg == "addContact(QString,QString)" ) {
QDataStream stream(data,IO_ReadOnly);
QString name, email;
stream >> name >> email;
Contact cnt;
QString fn, mn, ln;
parseName( name, &fn, &mn, &ln );
// qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
cnt.setFirstName( fn );
cnt.setMiddleName( mn );
cnt.setLastName( ln );
cnt.setEmails( email );
cnt.setDefaultEmail( email );
cnt.setFileAs();
if ( bAbEditFirstTime ) {
- abEditor = new AbEditor( cnt, &orderedFields, &slOrderedFields,
+ abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields,
this, "editor" );
bAbEditFirstTime = FALSE;
} else {
abEditor->setEntry( cnt );
}
abView()->init( cnt );
editEntry( NewEntry );
}
#if 0
else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
QDataStream stream(data,IO_ReadOnly);
QCString ch,m;
QStringList types;
stream >> ch >> m >> types;
AddressPicker picker(abList,this,0,TRUE);
picker.showMaximized();
picker.setChoiceNames(types);
int i=0;
for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
QStringList sel;
stream >> sel;
picker.setSelection(i++,sel);
}
picker.showMaximized();
picker.exec();
// ###### note: contacts may have been added - save here!
setCentralWidget(abList);
QCopEnvelope e(ch,m);
i=0;
for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
QStringList sel = picker.selection(i++);
e << sel;
}
}
#endif
}
void AddressbookWindow::editPersonal()
{
QString filename = addressbookPersonalVCardName();
Contact me;
if (QFile::exists(filename))
me = Contact::readVCard( filename )[0];
if (bAbEditFirstTime) {
- abEditor = new AbEditor( me, &orderedFields, &slOrderedFields,
+ abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields,
this, "editor" );
// don't create a new editor every time
bAbEditFirstTime = FALSE;
} else
abEditor->setEntry( me );
abEditor->setCaption(tr("Edit My Personal Details"));
abEditor->showMaximized();
// fix the foxus...
abEditor->setNameFocus();
if ( abEditor->exec() ) {
setFocus();
Contact new_personal = abEditor->entry();
QString fname = addressbookPersonalVCardName();
Contact::writeVCard( fname, new_personal );
abView()->init(new_personal);
abView()->sync();
}
abEditor->setCaption( tr("Edit Address") );
}
void AddressbookWindow::slotPersonalView()
{
if (!actionPersonal->isOn()) {
// we just turned it off
setCaption( tr("Contacts") );
actionNew->setEnabled(TRUE);
actionTrash->setEnabled(TRUE);
actionFind->setEnabled(TRUE);
slotUpdateToolbar(); // maybe some of the above could be moved there
showList();
return;
}
// XXX need to disable some QActions.
actionNew->setEnabled(FALSE);
actionTrash->setEnabled(FALSE);
actionFind->setEnabled(FALSE);
actionMail->setEnabled(FALSE);
setCaption( tr("Contacts - My Personal Details") );
QString filename = addressbookPersonalVCardName();
Contact me;
if (QFile::exists(filename))
me = Contact::readVCard( filename )[0];
abView()->init( me );
abView()->sync();
abList->hide();
setCentralWidget( abView() );
mView->show();
mView->setFocus();
}
void AddressbookWindow::editEntry( EntryMode entryMode )
{
Contact entry;
if ( bAbEditFirstTime ) {
- abEditor = new AbEditor( entry, &orderedFields, &slOrderedFields,
+ abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields,
this, "editor" );
bAbEditFirstTime = FALSE;
if ( entryMode == EditEntry )
abEditor->setEntry( abList->currentEntry() );
}
// other things may chane the caption.
abEditor->setCaption( tr("Edit Address") );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
abEditor->showMaximized();
#endif
// fix the foxus...
abEditor->setNameFocus();
if ( abEditor->exec() ) {
setFocus();
if ( entryMode == NewEntry ) {
Contact insertEntry = abEditor->entry();
insertEntry.assignUid();
abList->addEntry( insertEntry );
} else {
Contact replaceEntry = abEditor->entry();
if ( !replaceEntry.isValidUid() )
replaceEntry.assignUid();
abList->replaceCurrentEntry( replaceEntry );
}
}
populateCategories();
showList();
}
void AddressbookWindow::listIsEmpty( bool empty )
{
if ( !empty ) {
deleteButton->setEnabled( TRUE );
}
}
void AddressbookWindow::reload()
{
syncing = FALSE;
abList->clear();
abList->load( addressbookXMLFilename() );
}
void AddressbookWindow::flush()
{
syncing = TRUE;
abList->save( addressbookXMLFilename() );
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index 9694465..342077f 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -1,99 +1,99 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop 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 Addressbook_H
#define Addressbook_H
#include <qmainwindow.h>
-class AbEditor;
+class ContactEditor;
class AbLabel;
class AbTable;
class QPEToolBar;
class QPopupMenu;
class QToolButton;
class QDialog;
class Ir;
class QAction;
class AddressbookWindow: public QMainWindow
{
Q_OBJECT
public:
AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~AddressbookWindow();
protected:
void resizeEvent( QResizeEvent * e );
void showList();
void showView();
enum EntryMode { NewEntry=0, EditEntry };
void editPersonal();
void editEntry( EntryMode );
void closeEvent( QCloseEvent *e );
bool save();
public slots:
void flush();
void reload();
void appMessage(const QCString &, const QByteArray &);
void setDocument( const QString & );
private slots:
void slotListNew();
void slotListView();
void slotListDelete();
void slotViewBack();
void slotViewEdit();
void slotPersonalView();
void listIsEmpty( bool );
void slotSettings();
void writeMail();
void slotBeam();
void beamDone( Ir * );
void slotFind();
void slotSetCategory( int );
void slotUpdateToolbar();
private:
void initFields(); // inititialize our fields...
AbLabel *abView();
void populateCategories();
QPopupMenu *catMenu;
QPEToolBar *listTools;
QToolButton *deleteButton;
QValueList<int> allFields,
orderedFields;
QStringList slOrderedFields;
enum Panes { paneList=0, paneView, paneEdit };
- AbEditor *abEditor;
+ ContactEditor *abEditor;
AbLabel *mView;
AbTable *abList;
QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam,
*actionPersonal, *actionMail;
bool bAbEditFirstTime;
int viewMargin;
bool syncing;
};
#endif
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro
index 31de2a3..180b401 100644
--- a/core/pim/addressbook/addressbook.pro
+++ b/core/pim/addressbook/addressbook.pro
@@ -1,23 +1,23 @@
TEMPLATE = app
CONFIG = qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = addressbook.h \
- abeditor.h \
+ contacteditor.h \
ablabel.h \
abtable.h \
addresssettings.h
SOURCES = main.cpp \
addressbook.cpp \
- abeditor.cpp \
+ contacteditor.cpp \
ablabel.cpp \
abtable.cpp \
addresssettings.cpp
INTERFACES = addresssettingsbase.ui
TARGET = addressbook
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
TRANSLATIONS = ../i18n/de/addressbook.ts
TRANSLATIONS += ../i18n/pt_BR/addressbook.ts