summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 4fa9253..b4734a4 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -8,208 +8,208 @@
** 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.
**
**
**********************************************************************/
#define QTOPIA_INTERNAL_FD
// #include "addresssettings.h"
#include "addressbook.h"
#include <opie2/odebug.h>
#include <opie2/ofileselector.h>
#include <opie2/ofiledialog.h>
#include <opie2/opimcontact.h>
#include <opie2/ocontactaccessbackend_vcard.h>
#include <opie2/oresource.h>
#include <qpe/ir.h>
#include <qpe/qpemessagebox.h>
#include <qmenubar.h>
#include <qpe/qpeapplication.h>
#include <qaction.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtoolbutton.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include "picker.h"
#include "configdlg.h"
extern QString addressbookPersonalVCardName();
AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
WFlags /*f*/ )
: Opie::OPimMainWindow( "Addressbook", "Contacts", tr( "Contact" ), "AddressBook",
parent, name, WType_TopLevel | WStyle_ContextHelp ),
abEditor(0l),
syncing(false)
{
setCaption( tr( "Contacts" ) );
isLoading = true;
m_config.load();
// Create Views
m_listContainer = new QWidget( this );
QVBoxLayout *vb = new QVBoxLayout( m_listContainer );
m_abView = new AbView( m_listContainer, m_config.orderList() );
vb->addWidget( m_abView );
connect( m_abView, SIGNAL(signalViewSwitched(int)),
this, SLOT(slotViewSwitched(int)) );
QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
// Letter Picker
pLabel = new LetterPicker( m_listContainer );
connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
connect(m_abView, SIGNAL(signalClearLetterPicker()), pLabel, SLOT(clear()) );
vb->addWidget( pLabel );
// Quick search bar
m_searchBar = new OFloatBar( "Search", this, QMainWindow::Top, true );
m_searchBar->setHorizontalStretchable( true );
m_searchBar->hide();
m_searchEdit = new QLineEdit( m_searchBar, "m_searchEdit" );
m_searchBar->setStretchableWidget( m_searchEdit );
connect( m_searchEdit, SIGNAL(returnPressed()), this, SLOT(slotFind()) );
QAction *a = new QAction( tr( "Start Search" ),
Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
a->addTo( m_searchBar );
// Insert Contact menu items
QActionGroup *items = new QActionGroup( this, QString::null, false );
m_actionMail = new QAction( tr( "Write Mail To" ),
- Opie::Core::OResource::loadPixmap( "addressbook/sendmail" ),
+ Opie::Core::OResource::loadPixmap( "addressbook/sendmail", Opie::Core::OResource::SmallIcon ),
QString::null, 0, items, 0 );
connect( m_actionMail, SIGNAL(activated()), this, SLOT(writeMail()) );
a = new QAction( tr("Import vCard"),
- Opie::Core::OResource::loadPixmap( "addressbook/fileimport" ),
+ Opie::Core::OResource::loadPixmap( "addressbook/fileimport", Opie::Core::OResource::SmallIcon ),
QString::null, 0, items, 0 );
connect( a, SIGNAL(activated()), this, SLOT(importvCard()) );
a = new QAction( tr("Export vCard"),
- Opie::Core::OResource::loadPixmap( "addressbook/fileexport" ),
+ Opie::Core::OResource::loadPixmap( "addressbook/fileexport", Opie::Core::OResource::SmallIcon ),
QString::null, 0, items, 0 );
connect( a, SIGNAL(activated()), this, SLOT(exportvCard()) );
m_actionPersonal = new QAction( tr("My Personal Details"),
- Opie::Core::OResource::loadPixmap( "addressbook/identity" ),
+ Opie::Core::OResource::loadPixmap( "addressbook/identity", Opie::Core::OResource::SmallIcon ),
QString::null, 0, items, 0 , true );
connect( m_actionPersonal, SIGNAL(activated()), this, SLOT(slotPersonalView()) );
insertItemMenuItems( items );
// Insert View menu items
items = new QActionGroup( this, QString::null, false );
a = new QAction( tr("Show quick search bar"),QString::null, 0, items, 0, true );
connect( a, SIGNAL(toggled(bool)), this, SLOT(slotShowFind(bool)) );
insertViewMenuItems( items );
// Fontsize
defaultFont = new QFont( m_abView->font() );
slotSetFont(m_config.fontSize());
m_curFontSize = m_config.fontSize();
setCentralWidget(m_listContainer);
// odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl;
connect( qApp, SIGNAL(flush()), this, SLOT(flush()) );
connect( qApp, SIGNAL(reload()), this, SLOT(reload()) );
connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
this, SLOT(appMessage(const QCString&,const QByteArray&)) );
isLoading = false;
// Handle category selection
setViewCategory( m_config.category() );
m_abView->setShowByCategory( m_config.category() );
connect( this, SIGNAL(categorySelected(const QString&)),
this, SLOT(slotSetCategory(const QString&)) );
}
void AddressbookWindow::slotSetFont( int size )
{
odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl;
if (size > 2 || size < 0)
size = 1;
m_config.setFontSize( size );
QFont *currentFont;
switch (size) {
case 0:
m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
currentFont = new QFont (m_abView->font());
// abList->resizeRows(currentFont->pixelSize() + 7); :SX
// abList->resizeRows();
break;
case 1:
m_abView->setFont( *defaultFont );
currentFont = new QFont (m_abView->font());
// // abList->resizeRows(currentFont->pixelSize() + 7);
// abList->resizeRows();
break;
case 2:
m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
currentFont = new QFont (m_abView->font());
// //abList->resizeRows(currentFont->pixelSize() + 7);
// abList->resizeRows();
break;
}
}
void AddressbookWindow::importvCard() {
QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
if(!str.isEmpty() ){
setDocument((const QString&) str );
}
}
void AddressbookWindow::exportvCard()
{
odebug << "void AddressbookWindow::exportvCard()" << oendl;
QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this );
if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){
odebug << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl;
Opie::OPimContact curCont = m_abView->currentEntry();
if ( !curCont.isEmpty() ){
Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
filename );
Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true );
if ( access ){
access->add( curCont );
access->save();
}
delete access;
}else
QMessageBox::critical( 0, "Export VCard",
QString( tr( "You have to select a contact !") ) );