summaryrefslogtreecommitdiff
path: root/core
authorharlekin <harlekin>2002-06-11 16:21:52 (UTC)
committer harlekin <harlekin>2002-06-11 16:21:52 (UTC)
commitd709dd35dc07d4a204380354f00a89ceb4d1f845 (patch) (side-by-side diff)
tree13c3c77584516dd0a1492583c9537ed03846a3ee /core
parent38e25eff8c87c8f44ad6bc83b64bf3411c31c47f (diff)
downloadopie-d709dd35dc07d4a204380354f00a89ceb4d1f845.zip
opie-d709dd35dc07d4a204380354f00a89ceb4d1f845.tar.gz
opie-d709dd35dc07d4a204380354f00a89ceb4d1f845.tar.bz2
activated the qcop channel
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp18
-rw-r--r--core/pim/addressbook/addressbook.h4
2 files changed, 19 insertions, 3 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 86d1760..e11cf4c 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -116,48 +116,62 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
listTools = new QPEToolBar( this, "list operations" );
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)
+#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
+
+
+
+
+
#ifndef MAKE_FOR_SHARP_ROM
a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
QString::null, 0, this, 0 );
actionFind = a;
connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
a->addTo( edit );
a->addTo( listTools );
#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;
@@ -229,92 +243,94 @@ 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 );
setCentralWidget( listContainer );
fontMenu = new QPopupMenu(this);
fontMenu->setCheckable( true );
connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
fontMenu->insertItem(tr( "Small" ), 0);
fontMenu->insertItem(tr( "Normal" ), 1);
fontMenu->insertItem(tr( "Large" ), 2);
defaultFont = new QFont( abList->font() );
slotSetFont(startFontSize);
mbList->insertItem( tr("Font"), fontMenu);
setCentralWidget(listContainer);
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
}
+
+
void AddressbookWindow::slotSetFont( int size ) {
if (size > 2 || size < 0)
size = 1;
startFontSize = size;
QFont *currentFont;
switch (size) {
case 0:
fontMenu->setItemChecked(0, true);
fontMenu->setItemChecked(1, false);
fontMenu->setItemChecked(2, false);
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();
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index da43731..34ca85d 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -38,71 +38,71 @@ 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 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;
QValueList<int> allFields,
orderedFields;
QStringList slOrderedFields;
enum Panes { paneList=0, paneView, paneEdit };
ContactEditor *abEditor;
AbLabel *mView;
LetterPicker *pLabel;
AbTable *abList;
QWidget *listContainer;
- QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam,
+ QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam,
*actionPersonal, *actionMail;
bool bAbEditFirstTime;
int viewMargin;
bool syncing;
QFont *defaultFont;
int startFontSize;
};
#endif