summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
authoreilers <eilers>2004-10-12 09:07:04 (UTC)
committer eilers <eilers>2004-10-12 09:07:04 (UTC)
commitc6cd1497c5e08f68085c27c04277cdb5f720527f (patch) (side-by-side diff)
tree6aeb5079e5d5046240be7eabca2e859f269ef073 /core/pim/addressbook/addressbook.cpp
parentc1be01cafaa3b9f22586c73d14c5eaf0e7c6848d (diff)
downloadopie-c6cd1497c5e08f68085c27c04277cdb5f720527f.zip
opie-c6cd1497c5e08f68085c27c04277cdb5f720527f.tar.gz
opie-c6cd1497c5e08f68085c27c04277cdb5f720527f.tar.bz2
No functional changes.
Just replaced owarn to odebug where debug output was ment by the developer. These warnings confusing users if the have any problems..
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 35d0f41..835038a 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -246,184 +246,184 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
// Fontsize
defaultFont = new QFont( m_abView->font() );
slotSetFont(m_config.fontSize());
m_curFontSize = m_config.fontSize();
setCentralWidget(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;
}
void AddressbookWindow::slotConfig()
{
ConfigDlg* dlg = new ConfigDlg( this, "Config" );
dlg -> setConfig( m_config );
if ( QPEApplication::execDialog( dlg ) ) {
- owarn << "Config Dialog accepted!" << oendl;
+ odebug << "Config Dialog accepted!" << oendl;
m_config = dlg -> getConfig();
if ( m_curFontSize != m_config.fontSize() ){
- owarn << "Font was changed!" << oendl;
+ odebug << "Font was changed!" << oendl;
m_curFontSize = m_config.fontSize();
emit slotSetFont( m_curFontSize );
}
m_abView -> setListOrder( m_config.orderList() );
}
delete dlg;
}
void AddressbookWindow::slotSetFont( int size )
{
- owarn << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl;
+ 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()
{
- owarn << "void AddressbookWindow::exportvCard()" << oendl;
+ odebug << "void AddressbookWindow::exportvCard()" << oendl;
QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this );
if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){
- owarn << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl;
+ 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 !") ) );
}else
QMessageBox::critical( 0, "Export VCard",
QString( tr( "You have to set a filename !") ) );
}
void AddressbookWindow::setDocument( const QString &filename )
{
- owarn << "void AddressbookWindow::setDocument( " << filename << " )" << oendl;
+ odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl;
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:
- owarn << "YES clicked" << oendl;
+ odebug << "YES clicked" << oendl;
break;
case 1:
- owarn << "NO clicked" << oendl;
+ odebug << "NO clicked" << oendl;
return;
break;
}
}
Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
filename );
Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
Opie::OPimContactAccess::List allList = access->allRecords();
- owarn << "Found number of contacts in File: " << allList.count() << oendl;
+ odebug << "Found number of contacts in File: " << allList.count() << oendl;
if ( !allList.count() ) {
QMessageBox::information( this, "Import VCard",
"It was impossible to import\nthe VCard.\n"
"The VCard may be corrupted!" );
}
bool doAsk = true;
Opie::OPimContactAccess::List::Iterator it;
for ( it = allList.begin(); it != allList.end(); ++it ){
- owarn << "Adding Contact from: " << (*it).fullName() << oendl;
+ odebug << "Adding Contact from: " << (*it).fullName() << oendl;
if ( doAsk ){
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:
- owarn << "YES clicked" << oendl;
+ odebug << "YES clicked" << oendl;
m_abView->addEntry( *it );
break;
case 1:
- owarn << "NO clicked" << oendl;
+ odebug << "NO clicked" << oendl;
break;
case 2:
- owarn << "YesAll clicked" << oendl;
+ odebug << "YesAll clicked" << oendl;
doAsk = false;
break;
}
}else
m_abView->addEntry( *it );
}
delete access;
}
void AddressbookWindow::resizeEvent( QResizeEvent *e )
{
QMainWindow::resizeEvent( e );
}
AddressbookWindow::~AddressbookWindow()
{
ToolBarDock dock;
int dummy;
bool bDummy;
getLocation ( listTools, dock, dummy, bDummy, dummy );
@@ -517,193 +517,193 @@ void AddressbookWindow::slotViewEdit()
}
} else {
QMessageBox::warning( this, tr("Contacts"),
tr("Can not edit data, currently syncing") );
}
}
void AddressbookWindow::writeMail()
{
Opie::OPimContact c = m_abView -> currentEntry();
QString name = c.fileAs();
QString email = c.defaultEmail();
// 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..
if ( m_config.useQtMail() ){
- owarn << "Accessing: " << (basepath + "/bin/qtmail") << oendl;
+ odebug << "Accessing: " << (basepath + "/bin/qtmail") << oendl;
if ( QFile::exists( basepath + "/bin/qtmail" ) ){
- owarn << "QCop" << oendl;
+ odebug << "QCop" << oendl;
QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)");
e << name << email;
return;
} else
m_config.setUseOpieMail( true );
}
if ( m_config.useOpieMail() ){
- owarn << "Accessing: " << (basepath + "/bin/opiemail") << oendl;
+ odebug << "Accessing: " << (basepath + "/bin/opiemail") << oendl;
if ( QFile::exists( basepath + "/bin/opiemail" ) ){
- owarn << "QCop" << oendl;
+ odebug << "QCop" << oendl;
QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)");
e << name << email;
return;
} else
m_config.setUseQtMail( true );
}
}
static const char * beamfile = "/tmp/obex/contact.vcf";
void AddressbookWindow::slotBeam()
{
QString beamFilename;
Opie::OPimContact c;
if ( actionPersonal->isOn() ) {
beamFilename = addressbookPersonalVCardName();
if ( !QFile::exists( beamFilename ) )
return; // can't beam a non-existent file
Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
beamFilename );
Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
Opie::OPimContactAccess::List allList = access->allRecords();
Opie::OPimContactAccess::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();
Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
beamfile );
Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
access->add( c );
access->save();
delete access;
beamFilename = beamfile;
}
- owarn << "Beaming: " << beamFilename << oendl;
+ odebug << "Beaming: " << beamFilename << oendl;
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
QString description = c.fullName();
ir->send( beamFilename, description, "text/x-vCard" );
}
void AddressbookWindow::beamDone( Ir *ir )
{
delete ir;
unlink( beamfile );
}
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] == ' ' )
comma++;
rest = name.mid( comma );
} else {
int space = name.findRev( ' ' );
*last = name.mid( space+1 );
rest = name.left( space );
}
int space = rest.find( ' ' );
if ( space <= 0 ) {
*first = rest;
} else {
*first = rest.left( space );
*middle = rest.mid( space+1 );
}
}
void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
{
bool needShow = FALSE;
- owarn << "Receiving QCop-Call with message " << msg << oendl;
+ odebug << "Receiving QCop-Call with message " << msg << oendl;
if (msg == "editPersonal()") {
editPersonal();
} else if (msg == "editPersonalAndClose()") {
editPersonal();
close();
} else if ( msg == "addContact(QString,QString)" ) {
QDataStream stream(data,IO_ReadOnly);
QString name, email;
stream >> name >> email;
Opie::OPimContact cnt;
QString fn, mn, ln;
parseName( name, &fn, &mn, &ln );
// odebug << " " << fn << " - " << mn " - " << ln << oendl;
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
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
QString description = "mycard.vcf";
ir->send( beamFilename, description, "text/x-vCard" );
} else if ( msg == "show(int)" ) {
raise();
QDataStream stream(data,IO_ReadOnly);
int uid;
stream >> uid;
- owarn << "Showing uid: " << uid << oendl;
+ odebug << "Showing uid: " << uid << oendl;
// Deactivate Personal View..
if ( actionPersonal->isOn() ){
actionPersonal->setOn( false );
slotPersonalView();
}
// Reset category and show as card..
m_abView -> setShowByCategory( QString::null );
m_abView -> setCurrentUid( uid );
slotViewSwitched ( AbView::CardView );
needShow = true;
} else if ( msg == "edit(int)" ) {
QDataStream stream(data,IO_ReadOnly);
int uid;
stream >> uid;
// Deactivate Personal View..
if ( actionPersonal->isOn() ){
actionPersonal->setOn( false );
slotPersonalView();
@@ -741,84 +741,84 @@ void AddressbookWindow::editEntry( EntryMode entryMode )
Opie::OPimContact insertEntry = abEditor->entry();
insertEntry.assignUid();
m_abView -> addEntry( insertEntry );
m_abView -> setCurrentUid( insertEntry.uid() );
} else {
Opie::OPimContact replEntry = abEditor->entry();
if ( !replEntry.isValidUid() )
replEntry.assignUid();
m_abView -> replaceEntry( replEntry );
}
}
// populateCategories();
}
void AddressbookWindow::editPersonal()
{
Opie::OPimContact entry;
// Switch to personal view if not selected
// but take care of the menu, too
if ( ! actionPersonal->isOn() ){
- owarn << "*** ++++" << oendl;
+ odebug << "*** ++++" << oendl;
actionPersonal->setOn( true );
slotPersonalView();
}
if ( !abEditor ) {
abEditor = new ContactEditor( entry, this, "editor" );
}
abEditor->setCaption(tr("Edit My Personal Details"));
abEditor->setPersonalView( true );
editEntry( EditEntry );
abEditor->setPersonalView( false );
}
void AddressbookWindow::slotPersonalView()
{
- owarn << "slotPersonalView()" << oendl;
+ odebug << "slotPersonalView()" << oendl;
if (!actionPersonal->isOn()) {
// we just turned it off
- owarn << "slotPersonalView()-> OFF" << oendl;
+ odebug << "slotPersonalView()-> OFF" << oendl;
setCaption( tr("Contacts") );
actionNew->setEnabled(TRUE);
actionTrash->setEnabled(TRUE);
actionFind->setEnabled(TRUE);
actionMail->setEnabled(TRUE);
// slotUpdateToolbar();
m_abView->showPersonal( false );
return;
}
- owarn << "slotPersonalView()-> ON" << oendl;
+ odebug << "slotPersonalView()-> ON" << oendl;
// 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 ) {
deleteButton->setEnabled( TRUE );
}
}
void AddressbookWindow::reload()
{
syncing = FALSE;
m_abView->clear();
@@ -866,125 +866,125 @@ bool AddressbookWindow::save()
tr("Unable to save information.\n"
"Free up some space\n"
"and try again.\n"
"\nQuit anyway?"),
QMessageBox::Yes|QMessageBox::Escape,
QMessageBox::No|QMessageBox::Default )
!= QMessageBox::No )
return TRUE;
else
return FALSE;
}
return TRUE;
}
#ifdef __DEBUG_RELEASE
void AddressbookWindow::slotSave()
{
save();
}
#endif
void AddressbookWindow::slotNotFound()
{
- owarn << "Got not found signal!" << oendl;
+ odebug << "Got not found signal!" << oendl;
QMessageBox::information( this, tr( "Not Found" ),
"<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" );
}
void AddressbookWindow::slotWrapAround()
{
- owarn << "Got wrap signal!" << oendl;
+ odebug << "Got wrap signal!" << oendl;
// if ( doNotifyWrapAround )
// QMessageBox::information( this, tr( "End of list" ),
// tr( "End of list. Wrap around now...!" ) + "\n" );
}
void AddressbookWindow::slotSetCategory( int c )
{
- owarn << "void AddressbookWindow::slotSetCategory( " << c << " ) from "
+ odebug << "void AddressbookWindow::slotSetCategory( " << c << " ) from "
<< catMenu->count() << oendl;
QString cat, book;
AbView::Views view = AbView::TableView;
if ( c <= 0 )
return;
// 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
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;
}else if ( i == 2 ){
book = tr( "Cards" );
view = AbView::CardView;
// }else if ( i == 3 ){
// book = tr( "Personal" );
// view = AbView:: PersonalView;
}else if ( i == 3 ){ // default All Categories
cat = QString::null;
}else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled
cat = "Unfiled";
- owarn << "Unfiled selected!" << oendl;
+ odebug << "Unfiled selected!" << oendl;
}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 )
{
- owarn << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl;
+ odebug << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl;
int menu = 0;
// Switch to selected view
switch ( view ){
case AbView::TableView:
menu = 1;
m_tableViewButton->setOn(true);
m_cardViewButton->setOn(false);
break;
case AbView::CardView:
menu = 2;
m_tableViewButton->setOn(false);
m_cardViewButton->setOn(true);
break;
}
for ( unsigned int i = 1; i < 3; i++ ){
if ( catMenu )
catMenu->setItemChecked( i, menu == (int)i );
}
// Tell the view about the selected view
m_abView -> setShowToView ( (AbView::Views) view );
active_view = view;
}