summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp7
-rw-r--r--kaddressbook/kabcore.cpp1
2 files changed, 6 insertions, 2 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index b1ffe04..5f8b83d 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -57,122 +57,125 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
57// if (KGlobal::getOrientation() == KGlobal::Portrait) 57// if (KGlobal::getOrientation() == KGlobal::Portrait)
58// mSearchText->setMaximumWidth(30); 58// mSearchText->setMaximumWidth(30);
59// #endif //KAB_EMBEDDED 59// #endif //KAB_EMBEDDED
60 //mSearchText->setMaximumWidth(60); 60 //mSearchText->setMaximumWidth(60);
61 61
62 62
63 mFieldCombo = new QComboBox( false, this ); 63 mFieldCombo = new QComboBox( false, this );
64 layout->addWidget( mFieldCombo ); 64 layout->addWidget( mFieldCombo );
65 mFieldCombo->setMaximumHeight( 34 ); 65 mFieldCombo->setMaximumHeight( 34 );
66 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 66 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
67 67
68// #ifndef KAB_EMBEDDED 68// #ifndef KAB_EMBEDDED
69// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 69// resize( QSize(420, 50).expandedTo( sizeHint() ) );
70// #else //KAB_EMBEDDED 70// #else //KAB_EMBEDDED
71// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 71// resize( QSize(30, 10).expandedTo( sizeHint() ) );
72// #endif //KAB_EMBEDDED 72// #endif //KAB_EMBEDDED
73 73
74 74
75 // for performance reasons, we do a search on the pda only after return is pressed 75 // for performance reasons, we do a search on the pda only after return is pressed
76 connect( mSearchText, SIGNAL( textChanged( const QString& ) ), 76 connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
77 SLOT( announceDoSearch2() ) ); 77 SLOT( announceDoSearch2() ) );
78 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 78 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
79 SLOT( announceDoSearch2() ) ); 79 SLOT( announceDoSearch2() ) );
80 80
81 connect( mSearchText, SIGNAL( returnPressed() ), 81 connect( mSearchText, SIGNAL( returnPressed() ),
82 SLOT( announceDoSearch() ) ); 82 SLOT( announceDoSearch() ) );
83 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 83 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
84 SLOT( announceFieldChanged() ) ); 84 SLOT( announceFieldChanged() ) );
85 85
86 86
87 87
88 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); 88 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() ));
89 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); 89 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() ));
90 90
91 91
92 setFocusProxy( mSearchText ); 92 setFocusProxy( mSearchText );
93} 93}
94 94
95IncSearchWidget::~IncSearchWidget() 95IncSearchWidget::~IncSearchWidget()
96{ 96{
97 97
98} 98}
99void IncSearchWidget::announceDoSearch2() 99void IncSearchWidget::announceDoSearch2()
100{ 100{
101 if ( KABPrefs::instance()->mSearchWithReturn ) 101 if ( KABPrefs::instance()->mSearchWithReturn )
102 return; 102 return;
103 emit doSearch( mSearchText->text() ); 103 emit doSearch( mSearchText->text() );
104 //qDebug("emit dosreach "); 104 //qDebug("emit dosreach ");
105} 105}
106 106
107void IncSearchWidget::announceDoSearch() 107void IncSearchWidget::announceDoSearch()
108{ 108{
109 109
110 emit doSearch( mSearchText->text() ); 110 emit doSearch( mSearchText->text() );
111 // qDebug("emit dosreach "); 111 // qDebug("emit dosreach ");
112} 112}
113 113
114void IncSearchWidget::announceFieldChanged() 114void IncSearchWidget::announceFieldChanged()
115{ 115{
116 emit fieldChanged(); 116 emit fieldChanged();
117} 117}
118void IncSearchWidget::setSize() 118void IncSearchWidget::setSize()
119{ 119{
120 if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { 120 if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) {
121 mFieldCombo->setMaximumWidth( 40 ); 121 setCurrentItem( 0 );
122 mSearchText->setMaximumWidth( 30 ); 122 //mFieldCombo->setMaximumWidth( 0 );
123 mFieldCombo->hide();
124 mSearchText->setMaximumWidth( 200 );
123 } else { 125 } else {
126 mFieldCombo->show();
124 QFontMetrics fm ( mFieldCombo->font() ); 127 QFontMetrics fm ( mFieldCombo->font() );
125 int wid = fm.width(i18n( "All Fields" ) ); 128 int wid = fm.width(i18n( "All Fields" ) );
126#ifdef DESKTOP_VERSION 129#ifdef DESKTOP_VERSION
127 mFieldCombo->setMinimumWidth( wid+60 ); 130 mFieldCombo->setMinimumWidth( wid+60 );
128 wid = wid * 2; 131 wid = wid * 2;
129#endif 132#endif
130 mFieldCombo->setMaximumWidth( wid+60 ); 133 mFieldCombo->setMaximumWidth( wid+60 );
131 mSearchText->setMaximumWidth( 1024 ); 134 mSearchText->setMaximumWidth( 1024 );
132 } 135 }
133} 136}
134void IncSearchWidget::setFields( const KABC::Field::List &list ) 137void IncSearchWidget::setFields( const KABC::Field::List &list )
135{ 138{
136 139
137 mFieldCombo->clear(); 140 mFieldCombo->clear();
138 mFieldCombo->insertItem( i18n( "All Fields" ) ); 141 mFieldCombo->insertItem( i18n( "All Fields" ) );
139 142
140 KABC::Field::List::ConstIterator it; 143 KABC::Field::List::ConstIterator it;
141 for ( it = list.begin(); it != list.end(); ++it ) { 144 for ( it = list.begin(); it != list.end(); ++it ) {
142 mFieldCombo->insertItem( (*it)->label() ); 145 mFieldCombo->insertItem( (*it)->label() );
143 } 146 }
144 147
145 mFieldList = list; 148 mFieldList = list;
146 149
147 announceDoSearch(); 150 announceDoSearch();
148 announceFieldChanged(); 151 announceFieldChanged();
149 setSize(); 152 setSize();
150} 153}
151 154
152KABC::Field::List IncSearchWidget::fields() const 155KABC::Field::List IncSearchWidget::fields() const
153{ 156{
154 return mFieldList; 157 return mFieldList;
155} 158}
156 159
157KABC::Field *IncSearchWidget::currentField()const 160KABC::Field *IncSearchWidget::currentField()const
158{ 161{
159 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) 162 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
160 return 0; // for error or 'use all fields' 163 return 0; // for error or 'use all fields'
161 else 164 else
162 return mFieldList[ mFieldCombo->currentItem() - 1 ]; 165 return mFieldList[ mFieldCombo->currentItem() - 1 ];
163} 166}
164 167
165void IncSearchWidget::setCurrentItem( int pos ) 168void IncSearchWidget::setCurrentItem( int pos )
166{ 169{
167 mFieldCombo->setCurrentItem( pos ); 170 mFieldCombo->setCurrentItem( pos );
168 announceFieldChanged(); 171 announceFieldChanged();
169} 172}
170 173
171int IncSearchWidget::currentItem() const 174int IncSearchWidget::currentItem() const
172{ 175{
173 176
174 return mFieldCombo->currentItem(); 177 return mFieldCombo->currentItem();
175} 178}
176#ifndef KAB_EMBEDDED 179#ifndef KAB_EMBEDDED
177#include "incsearchwidget.moc" 180#include "incsearchwidget.moc"
178#endif //KAB_EMBEDDED 181#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 046cb63..b4e0b07 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -767,128 +767,129 @@ void KABCore::mailVCard( const QStringList& uids )
767 767
768 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 768 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
769 769
770 QString fileName = dirName + "/" + name; 770 QString fileName = dirName + "/" + name;
771 771
772 QFile outFile(fileName); 772 QFile outFile(fileName);
773 773
774 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 774 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
775 KABC::VCardConverter converter; 775 KABC::VCardConverter converter;
776 QString vcard; 776 QString vcard;
777 777
778 converter.addresseeToVCard( a, vcard ); 778 converter.addresseeToVCard( a, vcard );
779 779
780 QTextStream t( &outFile ); // use a text stream 780 QTextStream t( &outFile ); // use a text stream
781 t.setEncoding( QTextStream::UnicodeUTF8 ); 781 t.setEncoding( QTextStream::UnicodeUTF8 );
782 t << vcard; 782 t << vcard;
783 783
784 outFile.close(); 784 outFile.close();
785 785
786 urls.append( fileName ); 786 urls.append( fileName );
787 } 787 }
788 } 788 }
789 789
790 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 790 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
791 791
792 792
793/*US 793/*US
794 kapp->invokeMailer( QString::null, QString::null, QString::null, 794 kapp->invokeMailer( QString::null, QString::null, QString::null,
795 QString::null, // subject 795 QString::null, // subject
796 QString::null, // body 796 QString::null, // body
797 QString::null, 797 QString::null,
798 urls ); // attachments 798 urls ); // attachments
799*/ 799*/
800 800
801} 801}
802 802
803/** 803/**
804 Beams the "WhoAmI contact. 804 Beams the "WhoAmI contact.
805*/ 805*/
806void KABCore::beamMySelf() 806void KABCore::beamMySelf()
807{ 807{
808 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 808 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
809 if (!a.isEmpty()) 809 if (!a.isEmpty())
810 { 810 {
811 QStringList uids; 811 QStringList uids;
812 uids << a.uid(); 812 uids << a.uid();
813 813
814 beamVCard(uids); 814 beamVCard(uids);
815 } else { 815 } else {
816 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 816 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
817 817
818 818
819 } 819 }
820} 820}
821void KABCore::updateMainWindow() 821void KABCore::updateMainWindow()
822{ 822{
823 mMainWindow->showMaximized(); 823 mMainWindow->showMaximized();
824 mMainWindow->update(); 824 mMainWindow->update();
825} 825}
826void KABCore::resizeEvent(QResizeEvent* e ) 826void KABCore::resizeEvent(QResizeEvent* e )
827{ 827{
828 if ( !mMiniSplitter ) 828 if ( !mMiniSplitter )
829 return; 829 return;
830 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 830 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
831 if ( e->oldSize().width() != e->size().width() )
831 if ( QApplication::desktop()->width() >= 480 ) { 832 if ( QApplication::desktop()->width() >= 480 ) {
832 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
833 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 834 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
834 mMiniSplitter->setOrientation( Qt::Horizontal); 835 mMiniSplitter->setOrientation( Qt::Horizontal);
835 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
836 } 837 }
837 if ( QApplication::desktop()->width() <= 640 ) { 838 if ( QApplication::desktop()->width() <= 640 ) {
838 mMainWindow->showMinimized(); 839 mMainWindow->showMinimized();
839 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
840 mViewManager->getFilterAction()->setComboWidth( 150 ); 841 mViewManager->getFilterAction()->setComboWidth( 150 );
841 if ( mIncSearchWidget ) 842 if ( mIncSearchWidget )
842 mIncSearchWidget->setSize(); 843 mIncSearchWidget->setSize();
843 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
844 } 845 }
845 846
846 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
847 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
848 mMiniSplitter->setOrientation( Qt::Vertical ); 849 mMiniSplitter->setOrientation( Qt::Vertical );
849 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
850 } 851 }
851 if ( QApplication::desktop()->width() <= 640 ) { 852 if ( QApplication::desktop()->width() <= 640 ) {
852 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
853 mMainWindow->showMinimized(); 854 mMainWindow->showMinimized();
854 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
855 if ( mIncSearchWidget ) { 856 if ( mIncSearchWidget ) {
856 mIncSearchWidget->setSize(); 857 mIncSearchWidget->setSize();
857 } 858 }
858 } else { 859 } else {
859 mViewManager->getFilterAction()->setComboWidth( 0 ); 860 mViewManager->getFilterAction()->setComboWidth( 0 );
860 } 861 }
861 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
862 } 863 }
863 } 864 }
864 } 865 }
865 QWidget::resizeEvent( e ); 866 QWidget::resizeEvent( e );
866 867
867} 868}
868void KABCore::export2phone() 869void KABCore::export2phone()
869{ 870{
870 871
871 QStringList uids; 872 QStringList uids;
872 XXPortSelectDialog dlg( this, false, this ); 873 XXPortSelectDialog dlg( this, false, this );
873 if ( dlg.exec() ) 874 if ( dlg.exec() )
874 uids = dlg.uids(); 875 uids = dlg.uids();
875 else 876 else
876 return; 877 return;
877 if ( uids.isEmpty() ) 878 if ( uids.isEmpty() )
878 return; 879 return;
879 // qDebug("count %d ", uids.count()); 880 // qDebug("count %d ", uids.count());
880 881
881 KAex2phonePrefs ex2phone; 882 KAex2phonePrefs ex2phone;
882 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
883 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
884 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
885 886
886 if ( !ex2phone.exec() ) { 887 if ( !ex2phone.exec() ) {
887 return; 888 return;
888 } 889 }
889 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
890 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
891 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
892 893
893 894
894 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,