summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-08 21:10:34 (UTC)
committer harlekin <harlekin>2003-03-08 21:10:34 (UTC)
commitd44025daf7b191e1f79fe181b9ad1fcad20f3bdb (patch) (side-by-side diff)
treedfeca99f66ac32be7d7485aaf36b353a8d775dd3
parent9e482f354732a04aebfe8ab9a9eb5cfaad5b3cdb (diff)
downloadopie-d44025daf7b191e1f79fe181b9ad1fcad20f3bdb.zip
opie-d44025daf7b191e1f79fe181b9ad1fcad20f3bdb.tar.gz
opie-d44025daf7b191e1f79fe181b9ad1fcad20f3bdb.tar.bz2
use the opie wide config icon
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp166
-rw-r--r--pics/addressbook/configure.pngbin485 -> 0 bytes
2 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
@@ -86,28 +86,28 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
setCaption( tr("Contacts") );
setIcon( Resource::loadPixmap( "AddressBook" ) );
// 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 );
m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 );
connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) );
@@ -120,36 +120,36 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null,
0, this, 0 );
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()) );
a->addTo( edit );
a->addTo( listTools );
@@ -179,66 +179,66 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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"), 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() ) );
vb->addWidget( pLabel );
@@ -246,22 +246,22 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
// Category Menu
catMenu = new QPopupMenu( this );
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;
}
void AddressbookWindow::slotConfig()
{
@@ -280,23 +280,23 @@ 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());
// abList->resizeRows(currentFont->pixelSize() + 7); :SX
// abList->resizeRows();
@@ -320,39 +320,39 @@ void AddressbookWindow::slotSetFont( int size )
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() );
if ( !allList.count() ) {
@@ -369,36 +369,36 @@ void AddressbookWindow::setDocument( const QString &filename )
switch( QMessageBox::information( this, tr ( "Add Contact?" ),
tr( "Do you really want add contact for \n%1?" )
.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");
doAsk = false;
break;
}
}else
m_abView->addEntry( *it );
}
-
+
delete access;
}
void AddressbookWindow::resizeEvent( QResizeEvent *e )
{
QMainWindow::resizeEvent( e );
-
+
}
AddressbookWindow::~AddressbookWindow()
{
ToolBarDock dock;
@@ -434,22 +434,22 @@ 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() );
}
} else {
QMessageBox::warning( this, tr("Contacts"),
@@ -471,16 +471,16 @@ 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()
{
// :SX showList();
}
@@ -504,20 +504,20 @@ void AddressbookWindow::slotViewEdit()
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");
QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
e << name << email;
@@ -545,25 +545,25 @@ void AddressbookWindow::slotBeam()
QString beamFilename;
OContact c;
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
c = *it;
delete access;
} 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();
delete access;
@@ -586,13 +586,13 @@ 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 );
comma++;
while ( comma < int(name.length()) && name[comma] == ' ' )
@@ -607,13 +607,13 @@ static void parseName( const QString& name, QString *first, QString *middle,
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()") {
@@ -622,26 +622,26 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
editPersonal();
close();
} 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() );
cnt.setFirstName( fn );
cnt.setMiddleName( mn );
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();
if ( !QFile::exists( beamFilename ) )
return; // can't beam a non-existent file
@@ -665,25 +665,25 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
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::editEntry( EntryMode entryMode )
{
OContact entry;
if ( !abEditor ) {
@@ -692,13 +692,13 @@ void AddressbookWindow::editEntry( EntryMode entryMode )
if ( entryMode == EditEntry )
abEditor->setEntry( m_abView -> currentEntry() );
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...
abEditor->setNameFocus();
if ( abEditor->exec() ) {
@@ -755,27 +755,27 @@ void AddressbookWindow::slotPersonalView()
actionTrash->setEnabled(TRUE);
actionFind->setEnabled(TRUE);
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 )
{
if ( !empty ) {
@@ -853,44 +853,44 @@ void AddressbookWindow::slotSave()
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
book = QString::null;
view = AbView::TableView;
@@ -907,24 +907,24 @@ void AddressbookWindow::slotSetCategory( int c )
qWarning ("Unfiled selected!!!");
}else{
cat = m_abView->categories()[i - 4];
}
}
}
-
+
// Switch to the selected View
slotViewSwitched( view );
// Tell the view about the selected category
m_abView -> setShowByCategory( cat );
if ( book.isEmpty() )
book = "List";
if ( cat.isEmpty() )
cat = "All";
-
+
setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) );
}
void AddressbookWindow::slotViewSwitched( int view )
{
qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view );
@@ -962,43 +962,43 @@ void AddressbookWindow::slotListView()
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();
it != categories.end(); ++it ) {
catMenu->insertItem( *it, id );
if ( *it == m_abView -> showCategory() )
rememberId = id;
++id;
}
-
+
if ( m_abView -> showCategory().isEmpty() ) {
slotSetCategory( 3 );
}
else {
slotSetCategory( rememberId );
}
diff --git a/pics/addressbook/configure.png b/pics/addressbook/configure.png
deleted file mode 100644
index dd68320..0000000
--- a/pics/addressbook/configure.png
+++ b/dev/null
Binary files differ