summaryrefslogtreecommitdiff
authortux_mike <tux_mike>2002-04-17 20:46:18 (UTC)
committer tux_mike <tux_mike>2002-04-17 20:46:18 (UTC)
commit7b19e1d98d5acf01102ac057ec077fc036c034c6 (patch) (unidiff)
treea5ec8752ba8cbf9c5c037f1ec3552be544cc8b3f
parent106073977316103f057930daf45f3a083114d48d (diff)
downloadopie-7b19e1d98d5acf01102ac057ec077fc036c034c6.zip
opie-7b19e1d98d5acf01102ac057ec077fc036c034c6.tar.gz
opie-7b19e1d98d5acf01102ac057ec077fc036c034c6.tar.bz2
Added a Letter Picker
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp86
-rw-r--r--core/pim/addressbook/addressbook.cpp27
-rw-r--r--core/pim/addressbook/addressbook.h1
-rw-r--r--core/pim/addressbook/picker.cpp7
4 files changed, 98 insertions, 23 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 759cb48..124ff6c 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -1013,7 +1013,6 @@ void AbTable::setShowCategory( const QString &c )
1013void AbTable::setShowByLetter( char c ) 1013void AbTable::setShowByLetter( char c )
1014{ 1014{
1015 showChar = tolower(c); 1015 showChar = tolower(c);
1016 qDebug( "AbTable::setShowByLetter %c", showChar);
1017 updateVisible(); 1016 updateVisible();
1018} 1017}
1019 1018
@@ -1077,12 +1076,89 @@ void AbTable::updateVisible()
1077 if ( showChar != '\0' ) { 1076 if ( showChar != '\0' ) {
1078 tmpStr = fileAsName.left(1); 1077 tmpStr = fileAsName.left(1);
1079 tmpStr = tmpStr.lower(); 1078 tmpStr = tmpStr.lower();
1080 qDebug( "updateVisible "); 1079 if ( tmpStr != QString(QChar(showChar)) && showChar != '#' ) {
1081 qDebug( tmpStr );
1082 qDebug( "updateVisible2 %c", showChar );
1083 if ( tmpStr != QString(QChar(showChar)) ) {
1084 hide = true; 1080 hide = true;
1085 } 1081 }
1082 if ( showChar == '#' ) {
1083 if (tmpStr == "a")
1084 hide = true;
1085
1086 if (tmpStr == "b")
1087 hide = true;
1088
1089 if (tmpStr == "c")
1090 hide = true;
1091
1092 if (tmpStr == "d")
1093 hide = true;
1094
1095 if (tmpStr == "e")
1096 hide = true;
1097
1098 if (tmpStr == "f")
1099 hide = true;
1100
1101 if (tmpStr == "g")
1102 hide = true;
1103
1104 if (tmpStr == "h")
1105 hide = true;
1106
1107 if (tmpStr == "i")
1108 hide = true;
1109
1110 if (tmpStr == "j")
1111 hide = true;
1112
1113 if (tmpStr == "k")
1114 hide = true;
1115
1116 if (tmpStr == "l")
1117 hide = true;
1118
1119 if (tmpStr == "m")
1120 hide = true;
1121
1122 if (tmpStr == "n")
1123 hide = true;
1124
1125 if (tmpStr == "o")
1126 hide = true;
1127
1128 if (tmpStr == "p")
1129 hide = true;
1130
1131 if (tmpStr == "q")
1132 hide = true;
1133
1134 if (tmpStr == "r")
1135 hide = true;
1136
1137 if (tmpStr == "s")
1138 hide = true;
1139
1140 if (tmpStr == "t")
1141 hide = true;
1142
1143 if (tmpStr == "u")
1144 hide = true;
1145
1146 if (tmpStr == "v")
1147 hide = true;
1148
1149 if (tmpStr == "w")
1150 hide = true;
1151
1152 if (tmpStr == "x")
1153 hide = true;
1154
1155 if (tmpStr == "y")
1156 hide = true;
1157
1158 if (tmpStr == "z")
1159 hide = true;
1160 }
1161
1086 } 1162 }
1087 if ( hide ) { 1163 if ( hide ) {
1088 if ( currentRow() == row ) 1164 if ( currentRow() == row )
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index e502cf6..beb953a 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -99,7 +99,6 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
99 99
100 setToolBarsMovable( FALSE ); 100 setToolBarsMovable( FALSE );
101 101
102 QBoxLayout *vb = new QVBoxLayout( this, 0, 0 );
103 // Create Toolbars 102 // Create Toolbars
104 103
105 QPEToolBar *bar = new QPEToolBar( this ); 104 QPEToolBar *bar = new QPEToolBar( this );
@@ -190,8 +189,12 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
190 ); 189 );
191 } 190 }
192 191
193 abList = new AbTable( &orderedFields, this, "table" ); 192 listContainer = new QWidget( this );
194 vb->insertWidget(0,abList); 193
194 QVBoxLayout *vb = new QVBoxLayout( listContainer );
195
196 abList = new AbTable( &orderedFields, listContainer, "table" );
197 vb->addWidget(abList);
195 abList->setHScrollBarMode( QScrollView::AlwaysOff ); 198 abList->setHScrollBarMode( QScrollView::AlwaysOff );
196 connect( abList, SIGNAL( empty( bool ) ), 199 connect( abList, SIGNAL( empty( bool ) ),
197 this, SLOT( listIsEmpty( bool ) ) ); 200 this, SLOT( listIsEmpty( bool ) ) );
@@ -208,16 +211,16 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
208 QFile::remove(addressbookOldXMLFilename()); 211 QFile::remove(addressbookOldXMLFilename());
209 } 212 }
210 213
211 pLabel = new LetterPicker( abList ); 214 pLabel = new LetterPicker( listContainer );
212 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 215 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
213 vb->insertWidget(1,pLabel); 216 vb->addWidget(pLabel);
214 catMenu = new QPopupMenu( this ); 217 catMenu = new QPopupMenu( this );
215 catMenu->setCheckable( TRUE ); 218 catMenu->setCheckable( TRUE );
216 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); 219 connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
217 populateCategories(); 220 populateCategories();
218 221
219 mbList->insertItem( tr("View"), catMenu ); 222 mbList->insertItem( tr("View"), catMenu );
220 setCentralWidget( abList ); 223 setCentralWidget( listContainer );
221 224
222 fontMenu = new QPopupMenu(this); 225 fontMenu = new QPopupMenu(this);
223 fontMenu->setCheckable( true ); 226 fontMenu->setCheckable( true );
@@ -232,7 +235,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
232 slotSetFont(startFontSize); 235 slotSetFont(startFontSize);
233 236
234 mbList->insertItem( tr("Font"), fontMenu); 237 mbList->insertItem( tr("Font"), fontMenu);
235 setCentralWidget(abList); 238 setCentralWidget(listContainer);
236 239
237 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 240 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
238} 241}
@@ -294,7 +297,7 @@ void AddressbookWindow::resizeEvent( QResizeEvent *e )
294{ 297{
295 QMainWindow::resizeEvent( e ); 298 QMainWindow::resizeEvent( e );
296 299
297 if ( centralWidget() == abList ) 300 if ( centralWidget() == listContainer )
298 showList(); 301 showList();
299 else if ( centralWidget() == mView ) 302 else if ( centralWidget() == mView )
300 showView(); 303 showView();
@@ -316,8 +319,8 @@ void AddressbookWindow::slotUpdateToolbar()
316void AddressbookWindow::showList() 319void AddressbookWindow::showList()
317{ 320{
318 if ( mView ) mView->hide(); 321 if ( mView ) mView->hide();
319 setCentralWidget( abList ); 322 setCentralWidget( listContainer );
320 abList->show(); 323 listContainer->show();
321 // update our focues... (or use a stack widget!); 324 // update our focues... (or use a stack widget!);
322 abList->setFocus(); 325 abList->setFocus();
323} 326}
@@ -325,7 +328,7 @@ void AddressbookWindow::showList()
325void AddressbookWindow::showView() 328void AddressbookWindow::showView()
326{ 329{
327 if ( abList->numRows() > 0 ) { 330 if ( abList->numRows() > 0 ) {
328 abList->hide(); 331 listContainer->hide();
329 setCentralWidget( abView() ); 332 setCentralWidget( abView() );
330 mView->show(); 333 mView->show();
331 mView->setFocus(); 334 mView->setFocus();
@@ -601,7 +604,7 @@ void AddressbookWindow::slotPersonalView()
601 604
602 abView()->init( me ); 605 abView()->init( me );
603 abView()->sync(); 606 abView()->sync();
604 abList->hide(); 607 listContainer->hide();
605 setCentralWidget( abView() ); 608 setCentralWidget( abView() );
606 mView->show(); 609 mView->show();
607 mView->setFocus(); 610 mView->setFocus();
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index 31c4660..8e8c883 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -89,6 +89,7 @@ private:
89 AbLabel *mView; 89 AbLabel *mView;
90 LetterPicker *pLabel; 90 LetterPicker *pLabel;
91 AbTable *abList; 91 AbTable *abList;
92 QWidget *listContainer;
92 93
93 QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, 94 QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam,
94 *actionPersonal, *actionMail; 95 *actionPersonal, *actionMail;
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp
index 06dcc7d..a165451 100644
--- a/core/pim/addressbook/picker.cpp
+++ b/core/pim/addressbook/picker.cpp
@@ -79,10 +79,9 @@ void PickerLabel::mouseReleaseEvent( QMouseEvent *e )
79{ 79{
80 QString tmpStr; 80 QString tmpStr;
81 81
82 if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3) 82 if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0')
83 QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); 83 QTimer::singleShot( 0, this, SLOT(emitClearSignal()) );
84 84
85 qDebug( "a" );
86 switch (currentLetter) { 85 switch (currentLetter) {
87 case 0: 86 case 0:
88 tmpStr = "<qt><font color=\"#7F0000\">"; 87 tmpStr = "<qt><font color=\"#7F0000\">";
@@ -97,7 +96,6 @@ void PickerLabel::mouseReleaseEvent( QMouseEvent *e )
97 currentLetter++; 96 currentLetter++;
98 lastLetter = letter1; 97 lastLetter = letter1;
99 emit selectedLetter( letter1 ); 98 emit selectedLetter( letter1 );
100 qDebug( "PickerLabel::mouseReleaseEvent %c", letter1 );
101 break; 99 break;
102 100
103 case 1: 101 case 1:
@@ -114,7 +112,6 @@ void PickerLabel::mouseReleaseEvent( QMouseEvent *e )
114 currentLetter++; 112 currentLetter++;
115 lastLetter = letter2; 113 lastLetter = letter2;
116 emit selectedLetter( letter2 ); 114 emit selectedLetter( letter2 );
117 qDebug( "PickerLabel::mouseReleaseEvent %c", letter2 );
118 break; 115 break;
119 116
120 case 2: 117 case 2:
@@ -130,7 +127,6 @@ void PickerLabel::mouseReleaseEvent( QMouseEvent *e )
130 currentLetter++; 127 currentLetter++;
131 lastLetter = letter3; 128 lastLetter = letter3;
132 emit selectedLetter( letter3 ); 129 emit selectedLetter( letter3 );
133 qDebug( "PickerLabel::mouseReleaseEvent %c", letter3 );
134 break; 130 break;
135 131
136 default: 132 default:
@@ -228,7 +224,6 @@ void LetterPicker::clear()
228 224
229void LetterPicker::newLetter( char letter ) 225void LetterPicker::newLetter( char letter )
230{ 226{
231 qDebug( "LetterPicker::newLetter %c", letter );
232 emit letterClicked( letter ); 227 emit letterClicked( letter );
233 228
234} 229}