author | llornkcor <llornkcor> | 2002-06-05 18:33:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-05 18:33:09 (UTC) |
commit | 91398d550495cb82445457b59e472a58ad0a296a (patch) (side-by-side diff) | |
tree | 946605431ce9f600ae496c807126c281848a83b4 | |
parent | 9bd38805d22b6687ec8918ab1f581b2a28ba637a (diff) | |
download | opie-91398d550495cb82445457b59e472a58ad0a296a.zip opie-91398d550495cb82445457b59e472a58ad0a296a.tar.gz opie-91398d550495cb82445457b59e472a58ad0a296a.tar.bz2 |
added import vcard menu entry
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 19 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 1 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.pro | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 8229212..86d1760 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -5,48 +5,51 @@ ** ** 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 "contacteditor.h" #include "ablabel.h" #include "abtable.h" #include "addresssettings.h" #include "addressbook.h" + +#include <opie/ofileselector.h> +#include <opie/ofiledialog.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/contact.h> #ifndef MAKE_FOR_SHARP_ROM #include <qpe/finddialog.h> #endif #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> @@ -144,48 +147,56 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, #endif a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), QString::null, 0, this, 0 ); //a->setEnabled( FALSE ); we got support for it now :) zecke actionMail = a; connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); a->addTo( edit ); a->addTo( listTools ); if ( Ir::supported() ) { a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); actionBeam = a; connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); a->addTo( edit ); a->addTo( listTools ); } edit->insertSeparator(); + a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); + actionPersonal = a; + connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); + a->addTo( edit ); + + + edit->insertSeparator(); + a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); actionPersonal = a; connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); a->addTo( edit ); a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); a->addTo( edit ); // Create Views // This is safe to call without checking to see if it exists... // not to mention it also does the necessary stuff for the // journaling... QString str = addressbookXMLFilename(); if ( str.isNull() ) { QMessageBox::warning( this, tr("Out of Space"), tr("There is not enough space to create\n" "neccessary startup files.\n" "\nFree up some space before\nentering data!") ); } @@ -256,48 +267,56 @@ void AddressbookWindow::slotSetFont( int size ) { 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::importvCard() { + QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); + if(!str.isEmpty() ) + setDocument((const QString&) str ); + +} + 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?") // .arg( (*it).fullName() ); // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == // QMessageBox::Ok ) { abList->addEntry( *it ); // } } } void AddressbookWindow::resizeEvent( QResizeEvent *e ) { QMainWindow::resizeEvent( e ); if ( centralWidget() == listContainer ) showList(); else if ( centralWidget() == mView ) showView(); diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 476c971..da43731 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h @@ -38,48 +38,49 @@ class LetterPicker; 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 importvCard(); 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 slotSetLetter( char ); void slotUpdateToolbar(); void slotSetFont(int); private: void initFields(); // inititialize our fields... AbLabel *abView(); void populateCategories(); QPopupMenu *catMenu, *fontMenu; QPEToolBar *listTools; QToolButton *deleteButton; diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro index 0d65c74..428af2b 100644 --- a/core/pim/addressbook/addressbook.pro +++ b/core/pim/addressbook/addressbook.pro @@ -1,35 +1,35 @@ TEMPLATE = app CONFIG = qt warn_on release DESTDIR = $(OPIEDIR)/bin HEADERS = addressbook.h \ contacteditor.h \ ablabel.h \ abtable.h \ addresssettings.h \ picker.h SOURCES = main.cpp \ addressbook.cpp \ contacteditor.cpp \ ablabel.cpp \ abtable.cpp \ addresssettings.cpp \ picker.cpp INTERFACES = addresssettingsbase.ui TARGET = addressbook INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopie TRANSLATIONS = ../../i18n/pt_BR/addressbook.ts TRANSLATIONS += ../../i18n/de/addressbook.ts TRANSLATIONS += ../../i18n/en/addressbook.ts TRANSLATIONS += ../../i18n/hu/addressbook.ts TRANSLATIONS += ../../i18n/sl/addressbook.ts TRANSLATIONS += ../../i18n/ja/addressbook.ts TRANSLATIONS += ../../i18n/ko/addressbook.ts TRANSLATIONS += ../../i18n/pl/addressbook.ts TRANSLATIONS += ../../i18n/no/addressbook.ts TRANSLATIONS += ../../i18n/zh_CN/addressbook.ts TRANSLATIONS += ../../i18n/zh_TW/addressbook.ts TRANSLATIONS += ../../i18n/fr/addressbook.ts |