summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 360aa7e..e502cf6 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -54,24 +54,25 @@
#include <qstringlist.h>
#include <qtoolbutton.h>
#include <qwhatsthis.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <qdatetime.h>
+#include "picker.h"
static QString addressbookOldXMLFilename()
{
QString filename = QPEApplication::documentDir() + "addressbook.xml";
return filename;
}
static QString addressbookXMLFilename()
{
QString filename = Global::applicationFileName("addressbook",
"addressbook.xml");
return filename;
}
@@ -89,24 +90,25 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
: QMainWindow( parent, name, f ),
abEditor(0),
bAbEditFirstTime(TRUE),
syncing(FALSE)
{
initFields();
setCaption( tr("Contacts") );
setIcon( Resource::loadPixmap( "AddressBook" ) );
setToolBarsMovable( FALSE );
+ QBoxLayout *vb = new QVBoxLayout( this, 0, 0 );
// Create Toolbars
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
QPEMenuBar *mbList = new QPEMenuBar( bar );
mbList->setMargin( 0 );
QPopupMenu *edit = new QPopupMenu( this );
mbList->insertItem( tr( "Contact" ), edit );
listTools = new QPEToolBar( this, "list operations" );
@@ -180,40 +182,44 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
// not to mention it also does the necessary stuff for the
// journaling...
QString str = addressbookXMLFilename();
if ( str.isNull() ) {
QMessageBox::warning( this, tr("Out of Space"),
tr("There is not enough space to create\n"
"neccessary startup files.\n"
"\nFree up some space before\nentering data!")
);
}
abList = new AbTable( &orderedFields, this, "table" );
+ vb->insertWidget(0,abList);
abList->setHScrollBarMode( QScrollView::AlwaysOff );
connect( abList, SIGNAL( empty( bool ) ),
this, SLOT( listIsEmpty( bool ) ) );
connect( abList, SIGNAL( details() ),
this, SLOT( slotListView() ) );
connect( abList, SIGNAL(currentChanged(int,int)),
this, SLOT(slotUpdateToolbar()) );
mView = 0;
abList->load( addressbookXMLFilename() );
if ( QFile::exists(addressbookOldXMLFilename()) ) {
abList->load( addressbookOldXMLFilename() );
QFile::remove(addressbookOldXMLFilename());
}
+ pLabel = new LetterPicker( abList );
+ connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
+ vb->insertWidget(1,pLabel);
catMenu = new QPopupMenu( this );
catMenu->setCheckable( TRUE );
connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
populateCategories();
mbList->insertItem( tr("View"), catMenu );
setCentralWidget( abList );
fontMenu = new QPopupMenu(this);
fontMenu->setCheckable( true );
connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
@@ -875,24 +881,30 @@ void AddressbookWindow::slotSetCategory( int c )
abList->setShowCategory( QString::null );
setCaption( tr("Contacts") + " - " + tr ( "All" ) );
} else if ( c == (int)catMenu->count() ) {
abList->setShowCategory( tr( "Unfiled" ) );
setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) );
} else {
QString cat = abList->categories()[c - 2];
abList->setShowCategory( cat );
setCaption( tr("Contacts") + " - " + cat );
}
}
+void AddressbookWindow::slotSetLetter( char c ) {
+
+ abList->setShowByLetter( c );
+
+}
+
void AddressbookWindow::populateCategories()
{
catMenu->clear();
int id,
rememberId;
id = 1;
catMenu->insertItem( tr( "All" ), id++ );
QStringList categories = abList->categories();
categories.append( tr( "Unfiled" ) );
for ( QStringList::Iterator it = categories.begin();
it != categories.end(); ++it ) {