author | harlekin <harlekin> | 2003-03-08 21:10:34 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-08 21:10:34 (UTC) |
commit | d44025daf7b191e1f79fe181b9ad1fcad20f3bdb (patch) (side-by-side diff) | |
tree | dfeca99f66ac32be7d7485aaf36b353a8d775dd3 /core/pim/addressbook | |
parent | 9e482f354732a04aebfe8ab9a9eb5cfaad5b3cdb (diff) | |
download | opie-d44025daf7b191e1f79fe181b9ad1fcad20f3bdb.zip opie-d44025daf7b191e1f79fe181b9ad1fcad20f3bdb.tar.gz opie-d44025daf7b191e1f79fe181b9ad1fcad20f3bdb.tar.bz2 |
use the opie wide config icon
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 8937227..14e5b3f 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -88,24 +88,24 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, // Settings for Main Menu setToolBarsMovable( true ); setRightJustification( true ); - + // Create Toolbar listTools = new QPEToolBar( this, "list operations" ); listTools->setHorizontalStretchable( true ); addToolBar( listTools ); moveToolBar( listTools, m_config.getToolBarPos() ); - + QPEMenuBar *mbList = new QPEMenuBar( this ); mbList->setMargin( 0 ); - + QPopupMenu *edit = new QPopupMenu( mbList ); mbList->insertItem( tr( "Contact" ), edit ); - - + + // View Icons - m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), + m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), QString::null, 0, this, 0 ); connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); m_tableViewButton->setToggleAction( true ); m_tableViewButton->addTo( listTools ); @@ -122,32 +122,32 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, actionNew = a; connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); a->addTo( edit ); a->addTo( listTools ); - + a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); actionEdit = a; connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); a->addTo( edit ); a->addTo( listTools ); - + a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); actionTrash = a; connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); a->addTo( edit ); a->addTo( listTools ); - - + + // make it possible to go directly to businesscard via qcop call //#if defined(Q_WS_QWS) // Why this ? (se) -#if !defined(QT_NO_COP) +#if !defined(QT_NO_COP) QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); #endif - // #endif + // #endif a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); actionFind = a; connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); @@ -181,62 +181,62 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 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"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, + + a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, 0, this, 0); actionPersonal = a; connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); a->addTo( edit ); - + edit->insertSeparator(); - - a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), + + a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), QString::null, 0, this, 0 , TRUE ); actionPersonal = a; connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); a->addTo( edit ); - + #ifdef __DEBUG_RELEASE // Remove this function for public Release ! This is only // for debug purposes .. a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); a->addTo( edit ); #endif - a = new QAction( tr( "Config" ), Resource::loadPixmap( "addressbook/configure" ), QString::null, + a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); a->addTo( edit ); // Create Views listContainer = new QWidget( this ); QVBoxLayout *vb = new QVBoxLayout( listContainer ); - + m_abView = new AbView( listContainer, m_config.orderList() ); vb->addWidget( m_abView ); // abList->setHScrollBarMode( QScrollView::AlwaysOff ); - connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), + connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), this, SLOT( slotViewSwitched( int ) ) ); - + QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); - + m_abView->load(); - + // Letter Picker pLabel = new LetterPicker( listContainer ); connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); @@ -248,18 +248,18 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, catMenu->setCheckable( TRUE ); connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); populateCategories(); mbList->insertItem( tr("View"), catMenu ); - + defaultFont = new QFont( m_abView->font() ); slotSetFont(m_config.fontSize()); m_curFontSize = m_config.fontSize(); - + setCentralWidget(listContainer); - + // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); - + isLoading = false; } @@ -282,19 +282,19 @@ void AddressbookWindow::slotConfig() delete dlg; } -void AddressbookWindow::slotSetFont( int size ) +void AddressbookWindow::slotSetFont( int size ) { qWarning("void AddressbookWindow::slotSetFont( %d )", size); - + 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()); @@ -322,35 +322,35 @@ void AddressbookWindow::importvCard() { QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); if(!str.isEmpty() ){ setDocument((const QString&) str ); } - + } void AddressbookWindow::setDocument( const QString &filename ) { qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); - if ( filename.find(".vcf") != int(filename.length()) - 4 ){ + if ( filename.find(".vcf") != int(filename.length()) - 4 ){ switch( QMessageBox::information( this, tr ( "Right file type ?" ), tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), tr( "&Yes" ), tr( "&No" ), QString::null, 0, // Enter == button 0 2 ) ) { // Escape == button 2 - case 0: + case 0: qWarning("YES clicked"); break; - case 1: + case 1: qWarning("NO clicked"); return; break; } } - OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, + OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, filename ); OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); OContactAccess::List allList = access->allRecords(); qWarning( "Found number of contacts in File: %d", allList.count() ); @@ -371,13 +371,13 @@ void AddressbookWindow::setDocument( const QString &filename ) .arg( (*it).fullName().latin1() ), tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), 0, // Enter == button 0 2 ) ) { // Escape == button 2 - case 0: + case 0: qWarning("YES clicked"); m_abView->addEntry( *it ); break; - case 1: + case 1: qWarning("NO clicked"); break; case 2: qWarning("YesAll clicked"); @@ -387,16 +387,16 @@ void AddressbookWindow::setDocument( const QString &filename ) }else m_abView->addEntry( *it ); } - + delete access; } void AddressbookWindow::resizeEvent( QResizeEvent *e ) { QMainWindow::resizeEvent( e ); - + } AddressbookWindow::~AddressbookWindow() @@ -436,18 +436,18 @@ void AddressbookWindow::slotListNew() void AddressbookWindow::slotListDelete() { if(!syncing) { OContact tmpEntry = m_abView ->currentEntry(); - + // get a name, do the best we can... QString strName = tmpEntry.fullName(); if ( strName.isEmpty() ) { strName = tmpEntry.company(); if ( strName.isEmpty() ) strName = "No Name"; } - - + + if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), strName ) ) { m_abView->removeEntry( tmpEntry.uid() ); } @@ -473,12 +473,12 @@ void AddressbookWindow::slotFindClose() void AddressbookWindow::slotFind() { m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); - + searchEdit->clearFocus(); // m_abView->setFocus(); - + } void AddressbookWindow::slotViewBack() { @@ -506,16 +506,16 @@ void AddressbookWindow::writeMail() OContact c = m_abView -> currentEntry(); QString name = c.fileAs(); QString email = c.defaultEmail(); - // I prefer the OPIE-Environment variable before the + // I prefer the OPIE-Environment variable before the // QPE-one.. QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); if ( basepath.isEmpty() ) basepath = QString::fromLatin1( getenv("QPEDIR") ); - // Try to access the preferred. If not possible, try to - // switch to the other one.. + // Try to access the preferred. If not possible, try to + // switch to the other one.. if ( m_config.useQtMail() ){ qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); if ( QFile::exists( basepath + "/bin/qtmail" ) ){ qWarning ("QCop"); @@ -547,9 +547,9 @@ void AddressbookWindow::slotBeam() if ( actionPersonal->isOn() ) { beamFilename = addressbookPersonalVCardName(); if ( !QFile::exists( beamFilename ) ) return; // can't beam a non-existent file - OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, + OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, beamFilename ); OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); OContactAccess::List allList = access->allRecords(); OContactAccess::List::Iterator it = allList.begin(); // Just take first @@ -559,9 +559,9 @@ void AddressbookWindow::slotBeam() } else { unlink( beamfile ); // delete if exists mkdir("/tmp/obex/", 0755); c = m_abView -> currentEntry(); - OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, + OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, beamfile ); OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); access->add( c ); access->save(); @@ -588,9 +588,9 @@ void AddressbookWindow::beamDone( Ir *ir ) static void parseName( const QString& name, QString *first, QString *middle, QString * last ) { - + int comma = name.find ( "," ); QString rest; if ( comma > 0 ) { *last = name.left( comma ); @@ -609,9 +609,9 @@ static void parseName( const QString& name, QString *first, QString *middle, } else { *first = rest.left( space ); *middle = rest.mid( space+1 ); } - + } void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) @@ -624,9 +624,9 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) } else if ( msg == "addContact(QString,QString)" ) { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; - + OContact cnt; QString fn, mn, ln; parseName( name, &fn, &mn, &ln ); // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); @@ -635,11 +635,11 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) cnt.setLastName( ln ); cnt.insertEmails( email ); cnt.setDefaultEmail( email ); cnt.setFileAs(); - + m_abView -> addEntry( cnt ); - + // :SXm_abView()->init( cnt ); editEntry( EditEntry ); } else if ( msg == "beamBusinessCard()" ) { QString beamFilename = addressbookPersonalVCardName(); @@ -667,11 +667,11 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 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) { @@ -679,9 +679,9 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) e << sel; } } #endif - + } void AddressbookWindow::editEntry( EntryMode entryMode ) { @@ -694,9 +694,9 @@ void AddressbookWindow::editEntry( EntryMode entryMode ) else if ( entryMode == NewEntry ) abEditor->setEntry( entry ); // other things may change the caption. abEditor->setCaption( tr("Edit Address") ); - + #if defined(Q_WS_QWS) || defined(_WS_QWS_) abEditor->showMaximized(); #endif // fix the foxus... @@ -757,23 +757,23 @@ void AddressbookWindow::slotPersonalView() actionMail->setEnabled(TRUE); // slotUpdateToolbar(); m_abView->showPersonal( false ); - + return; } - + qWarning("slotPersonalView()-> ON"); // XXX need to disable some QActions. actionNew->setEnabled(FALSE); actionTrash->setEnabled(FALSE); actionFind->setEnabled(FALSE); actionMail->setEnabled(FALSE); - + setCaption( tr("Contacts - My Personal Details") ); m_abView->showPersonal( true ); - + } void AddressbookWindow::listIsEmpty( bool empty ) @@ -855,40 +855,40 @@ void AddressbookWindow::slotNotFound() qWarning("Got notfound signal!"); QMessageBox::information( this, tr( "Not Found" ), tr( "Unable to find a contact for this \n search pattern!" ) ); - + } void AddressbookWindow::slotWrapAround() { qWarning("Got wrap signal!"); // if ( doNotifyWrapAround ) // QMessageBox::information( this, tr( "End of list" ), // tr( "End of list. Wrap around now...!" ) + "\n" ); - + } void AddressbookWindow::slotSetCategory( int c ) { qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); - + QString cat, book; AbView::Views view = AbView::TableView; - + if ( c <= 0 ) return; - - // Switch view + + // Switch view if ( c < 3 ) for ( unsigned int i = 1; i < 3; i++ ){ if ( catMenu ) catMenu->setItemChecked( i, c == (int)i ); } else - // Checkmark Category Menu Item Selected + // Checkmark Category Menu Item Selected for ( unsigned int i = 3; i < catMenu->count(); i++ ) catMenu->setItemChecked( i, c == (int)i ); - + // Now switch to the selected category for ( unsigned int i = 1; i < catMenu->count(); i++ ) { if (catMenu->isItemChecked( i )) { if ( i == 1 ){ // default List view @@ -909,9 +909,9 @@ void AddressbookWindow::slotSetCategory( int c ) cat = m_abView->categories()[i - 4]; } } } - + // Switch to the selected View slotViewSwitched( view ); // Tell the view about the selected category @@ -920,9 +920,9 @@ void AddressbookWindow::slotSetCategory( int c ) if ( book.isEmpty() ) book = "List"; if ( cat.isEmpty() ) cat = "All"; - + setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); } void AddressbookWindow::slotViewSwitched( int view ) @@ -964,27 +964,27 @@ void AddressbookWindow::slotCardView() slotViewSwitched( AbView::CardView ); } void AddressbookWindow::slotSetLetter( char c ) { - + m_abView->setShowByLetter( c ); - + } void AddressbookWindow::populateCategories() { catMenu->clear(); - + int id, rememberId; id = 1; rememberId = 0; - + catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); // catMenu->insertItem( tr( "Personal" ), id++ ); catMenu->insertSeparator(); - + catMenu->insertItem( tr( "All" ), id++ ); QStringList categories = m_abView->categories(); categories.append( tr( "Unfiled" ) ); for ( QStringList::Iterator it = categories.begin(); @@ -994,9 +994,9 @@ void AddressbookWindow::populateCategories() rememberId = id; ++id; } - + if ( m_abView -> showCategory().isEmpty() ) { slotSetCategory( 3 ); } else { |