summaryrefslogtreecommitdiff
authorchicken <chicken>2004-03-01 17:39:51 (UTC)
committer chicken <chicken>2004-03-01 17:39:51 (UTC)
commitbdac663be648746b868757a6fc9e6c443e6f51b1 (patch) (side-by-side diff)
tree880ee397824e6e99317d8788856bb8cc781b6fe0
parent5f6f3f7d9356e24ac5284b7ccc10a75451ea94ee (diff)
downloadopie-bdac663be648746b868757a6fc9e6c443e6f51b1.zip
opie-bdac663be648746b868757a6fc9e6c443e6f51b1.tar.gz
opie-bdac663be648746b868757a6fc9e6c443e6f51b1.tar.bz2
fix includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/ablabel.cpp3
-rw-r--r--core/pim/addressbook/abtable.cpp9
-rw-r--r--core/pim/addressbook/addressbook.cpp16
-rw-r--r--core/pim/addressbook/configdlg.cpp1
-rw-r--r--core/pim/addressbook/contacteditor.cpp11
-rw-r--r--core/pim/addressbook/main.cpp1
-rw-r--r--core/pim/addressbook/picker.cpp2
-rw-r--r--core/pim/datebook/datebook.cpp15
-rw-r--r--core/pim/datebook/datebookdayallday.cpp10
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.cpp4
-rw-r--r--core/pim/datebook/datebooksettings.cpp1
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp4
-rw-r--r--core/pim/datebook/datebookweeklst.cpp1
-rw-r--r--core/pim/datebook/dateentryimpl.cpp11
-rw-r--r--core/pim/datebook/main.cpp1
-rw-r--r--core/pim/datebook/noteentryimpl.cpp2
-rw-r--r--core/pim/datebook/repeatentry.cpp4
-rw-r--r--core/pim/osearch/adresssearch.cpp2
-rw-r--r--core/pim/osearch/applnkitem.cpp1
-rw-r--r--core/pim/osearch/applnksearch.cpp1
-rw-r--r--core/pim/osearch/contactitem.cpp1
-rw-r--r--core/pim/osearch/datebooksearch.cpp2
-rw-r--r--core/pim/osearch/doclnkitem.cpp1
-rw-r--r--core/pim/osearch/doclnksearch.cpp1
-rw-r--r--core/pim/osearch/eventitem.cpp2
-rw-r--r--core/pim/osearch/main.cpp1
-rw-r--r--core/pim/osearch/mainwindow.cpp2
-rw-r--r--core/pim/osearch/olistview.cpp1
-rw-r--r--core/pim/osearch/resultitem.cpp1
-rw-r--r--core/pim/osearch/searchgroup.cpp3
-rw-r--r--core/pim/osearch/todoitem.cpp1
-rw-r--r--core/pim/osearch/todosearch.cpp1
-rw-r--r--core/pim/today/today.cpp1
-rw-r--r--core/pim/todo/mainwindow.cpp6
34 files changed, 1 insertions, 123 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp
index 1914f71..076e2e0 100644
--- a/core/pim/addressbook/ablabel.cpp
+++ b/core/pim/addressbook/ablabel.cpp
@@ -1,122 +1,119 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "ablabel.h"
-#include <qpe/stringutil.h>
-#include <qregexp.h>
-#include <qstylesheet.h>
AbLabel::AbLabel( QWidget *parent, const char *name ):
QTextView( parent, name ),
m_empty( false )
{
}
AbLabel::~AbLabel()
{
}
void AbLabel::setContacts( const OContactAccess::List& viewList )
{
m_viewList = viewList;
if (m_viewList.count() != 0){
m_empty = false;
m_itCurContact = m_viewList.begin();
sync();
}else{
// m_itCurContact.clear();
m_empty = true;
setText( "" );
}
}
int AbLabel::currentEntry_UID()
{
OContact contact = currentEntry();
if ( contact.isEmpty() )
return 0;
else
return ( contact.uid() );
}
OContact AbLabel::currentEntry()
{
if ( ! m_empty )
return ( *m_itCurContact );
else
return OContact();
}
bool AbLabel::selectContact( int UID )
{
for ( int r = 0; r < m_viewList.count(); ++r ) {
if ( m_viewList.uidAt( r ) == UID ){
m_itCurContact.setCurrent( r );
break;
}
}
sync();
return true;
}
void AbLabel::sync()
{
QString text = (*m_itCurContact).toRichText();
setText( text );
}
void AbLabel::keyPressEvent( QKeyEvent *e )
{
// Commonly handled keys
if ( !m_empty ){
switch( e->key() ) {
case Qt::Key_Left:
qWarning( "Left..");
case Qt::Key_Right:
qWarning( "Right..");
case Qt::Key_F33:
qWarning( "OK..");
emit signalOkPressed();
break;
case Qt::Key_Up:
qWarning( "UP..");
if ( ( visibleHeight() < contentsHeight() ) &&
( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) )
scrollBy( 0, -(visibleHeight()-20) );
else {
--m_itCurContact;
if ( *m_itCurContact != OContact() )
sync();
else
m_itCurContact = m_viewList.end();
}
break;
case Qt::Key_Down:
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 70330c7..f7bff58 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -1,132 +1,123 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <qpe/categoryselect.h>
-#include <qpe/config.h>
-#include <qpe/stringutil.h>
-#include <qpe/qcopenvelope_qws.h>
#include <qpe/timestring.h>
#include <qpe/resource.h>
#include <opie/orecordlist.h>
-#include <qasciidict.h>
-#include <qdatetime.h>
-#include <qfile.h>
-#include <qregexp.h>
-#include <qmessagebox.h>
#include "abtable.h"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h> //toupper() for key hack
#if 0
/*!
\class AbTableItem abtable.h
\brief QTableItem based class for showing a field of an entry
*/
AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s,
const QString &secondSortKey)
: QTableItem( t, et, s )
{
// sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower();
sortKey = Qtopia::buildSortKey( s, secondSortKey );
}
int AbTableItem::alignment() const
{
return AlignLeft|AlignVCenter;
}
QString AbTableItem::key() const
{
return sortKey;
}
// A way to reset the item, without out doing a delete or a new...
void AbTableItem::setItem( const QString &txt, const QString &secondKey )
{
setText( txt );
sortKey = Qtopia::buildSortKey( txt, secondKey );
// sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower();
}
/*!
\class AbPickItem abtable.h
\brief QTableItem based class for showing slection of an entry
*/
AbPickItem::AbPickItem( QTable *t ) :
QTableItem(t, WhenCurrent, "?")
{
}
QWidget *AbPickItem::createEditor() const
{
QComboBox* combo = new QComboBox( table()->viewport() );
( (AbPickItem*)this )->cb = combo;
AbTable* t = static_cast<AbTable*>(table());
QStringList c = t->choiceNames();
int cur = 0;
for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) {
if ( *it == text() )
cur = combo->count();
combo->insertItem(*it);
}
combo->setCurrentItem(cur);
return combo;
}
void AbPickItem::setContentFromEditor( QWidget *w )
{
if ( w->inherits("QComboBox") )
setText( ( (QComboBox*)w )->currentText() );
else
QTableItem::setContentFromEditor( w );
}
#endif
/*!
\class AbTable abtable.h
\brief QTable based class for showing a list of entries
*/
AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name )
: QTable( parent, name ),
lastSortCol( -1 ),
asc( TRUE ),
intFields( order ),
enablePainting( true ),
columnVisible( true ),
countNested( 0 )
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 1c7ddd4..9cf55b3 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -1,154 +1,138 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de)
**
** This file is part of the Open Palmtop Environment (see www.opie.info).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
**
**********************************************************************/
#define QTOPIA_INTERNAL_FD
-#include "contacteditor.h"
-#include "ablabel.h"
-#include "abview.h"
-#include "abtable.h"
// #include "addresssettings.h"
#include "addressbook.h"
#include <opie/ofileselector.h>
#include <opie/ofiledialog.h>
#include <opie/ocontact.h>
#include <opie/ocontactaccessbackend_vcard.h>
#include <qpe/resource.h>
#include <qpe/ir.h>
#include <qpe/qpemessagebox.h>
-#include <qpe/qcopenvelope_qws.h>
-#include <qtoolbar.h>
#include <qmenubar.h>
// #include <qtoolbar.h>
// #include <qmenubar.h>
#include <qpe/qpeapplication.h>
-#include <qpe/config.h>
#include <qaction.h>
-#include <qdialog.h>
-#include <qdir.h>
-#include <qfile.h>
-#include <qimage.h>
#include <qlayout.h>
#include <qmessagebox.h>
-#include <qpixmap.h>
-#include <qpopupmenu.h>
-#include <qstringlist.h>
#include <qtoolbutton.h>
-#include <qwhatsthis.h>
-#include <qdatetime.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include "picker.h"
#include "configdlg.h"
extern QString addressbookPersonalVCardName();
AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
WFlags f )
: QMainWindow( parent, name, f ),
catMenu (0l),
abEditor(0l),
syncing(FALSE),
m_tableViewButton(0l),
m_cardViewButton(0l)
{
isLoading = true;
m_config.load();
setCaption( tr("Contacts") );
setIcon( Resource::loadPixmap( "AddressBook" ) );
// Settings for Main Menu
// setToolBarsMovable( false );
setToolBarsMovable( !m_config.fixedBars() );
setRightJustification( true );
QToolBar *bar = new QToolBar( this );
bar->setHorizontalStretchable( TRUE );
QMenuBar *mbList = new QMenuBar( bar );
mbList->setMargin( 0 );
QPopupMenu *edit = new QPopupMenu( mbList );
mbList->insertItem( tr( "Contact" ), edit );
// Category Menu
catMenu = new QPopupMenu( this );
catMenu->setCheckable( TRUE );
connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
mbList->insertItem( tr("View"), catMenu );
// Create Toolbar
listTools = new QToolBar( this, "list operations" );
listTools->setHorizontalStretchable( true );
addToolBar( listTools );
moveToolBar( listTools, m_config.getToolBarPos() );
// View Icons
m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ),
QString::null, 0, this, 0 );
connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) );
m_tableViewButton->setToggleAction( true );
m_tableViewButton->addTo( listTools );
m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 );
connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) );
m_cardViewButton->setToggleAction( true );
m_cardViewButton->addTo( listTools );
listTools->addSeparator();
// Other Buttons
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) // Why this ? (se)
#if !defined(QT_NO_COP)
QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp
index 981f5e0..dee0f11 100644
--- a/core/pim/addressbook/configdlg.cpp
+++ b/core/pim/addressbook/configdlg.cpp
@@ -1,103 +1,102 @@
#include "configdlg.h"
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qlistbox.h>
#include <qpushbutton.h>
-#include <qiconset.h>
#include <qpe/resource.h>
#include <opie/ocontact.h>
#include "opie/ocontactfields.h"
ConfigDlg::ConfigDlg( QWidget *parent, const char *name):
ConfigDlg_Base(parent, name, true )
{
contFields = OContactFields::trfields();
// We add all Fields into the Listbox
for (uint i=0; i < contFields.count(); i++) {
allFieldListBox->insertItem( contFields[i] );
}
// Reset Widget Flags: This was not changeable by designer :(
setWFlags ( WStyle_ContextHelp );
// Set Pics to Buttons and Tabs
m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) );
m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) );
m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) );
m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) );
// Get the translation maps between Field ID and translated strings
m_mapStrToID = OContactFields::trFieldsToId();
m_mapIDToStr = OContactFields::idToTrFields();
connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) );
connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) );
connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) );
connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) );
}
void ConfigDlg::slotItemUp()
{
qWarning( "void ConfigDlg::slotItemUp()" );
int i = fieldListBox->currentItem();
if ( i > 0 ) {
QString item = fieldListBox->currentText();
fieldListBox->removeItem( i );
fieldListBox->insertItem( item, i-1 );
fieldListBox->setCurrentItem( i-1 );
}
}
void ConfigDlg::slotItemDown()
{
qWarning( "void ConfigDlg::slotItemDown()" );
int i = fieldListBox->currentItem();
if ( i < (int)fieldListBox->count() - 1 ) {
QString item = fieldListBox->currentText();
fieldListBox->removeItem( i );
fieldListBox->insertItem( item, i+1 );
fieldListBox->setCurrentItem( i+1 );
}
}
void ConfigDlg::slotItemAdd()
{
qWarning( "void ConfigDlg::slotItemAdd()" );
int i = allFieldListBox->currentItem();
if ( i > 0 ) {
QString item = allFieldListBox->currentText();
qWarning("ADding %s", item.latin1());
fieldListBox->insertItem( item );
}
}
void ConfigDlg::slotItemRemove()
{
qWarning( "void ConfigDlg::slotItemRemove()" );
int i = fieldListBox->currentItem();
if ( i > 0 ) {
fieldListBox->removeItem( i );
}
}
void ConfigDlg::setConfig( const AbConfig& cnf )
{
m_config = cnf;
m_useRegExp->setChecked( m_config.useRegExp() );
m_useWildCard->setChecked( m_config.useWildCards() );
m_useQtMail->setChecked( m_config.useQtMail() );
m_useOpieMail->setChecked( m_config.useOpieMail() );
m_useCaseSensitive->setChecked( m_config.beCaseSensitive() );
switch( m_config.fontSize() ){
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 7932781..b1eb042 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,143 +1,132 @@
/*
* Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
* Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
*
* This file is an add-on for the OPIE Palmtop Environment
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in the pacakaging
* of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* This is a rewrite of the abeditor.h file, modified to provide a more
* intuitive interface to TrollTech's original Address Book editor. This
* is made to operate exactly in interface with the exception of name.
*
*/
#include "contacteditor.h"
-#include "addresspicker.h"
#include <qpe/categoryselect.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
-#include <qpe/timeconversion.h>
#include <opie/ocontact.h>
#include <qpe/resource.h>
-#include <qcombobox.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
-#include <qscrollview.h>
#include <qtoolbutton.h>
-#include <qpushbutton.h>
-#include <qmainwindow.h>
-#include <qvaluelist.h>
-#include <qpopupmenu.h>
#include <qlistbox.h>
-#include <qhbox.h>
-#include <qaction.h>
-#include <qiconset.h>
#include <qmessagebox.h>
#include <qwhatsthis.h>
#include <assert.h>
static inline bool containsAlphaNum( const QString &str );
static inline bool constainsWhiteSpace( const QString &str );
// helper functions, convert our comma delimited list to proper
// file format...
void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
QString &strAll );
// helper convert from file format to comma delimited...
void parseEmailTo( const QString &strDefaultEmail,
const QString &strOtherEmail, QString &strBack );
ContactEditor::ContactEditor( const OContact &entry,
QWidget *parent,
const char *name,
WFlags )
: QDialog( parent, name, TRUE, WStyle_ContextHelp ),
defaultEmailChooserPosition( -1 ),
m_personalView ( false ),
cmbDefaultEmail( 0 ),
initializing ( false )
{
initializing = true;
init();
setEntry( entry );
// cmbDefaultEmail = 0;
// defaultEmailChooserPosition = -1;
initializing = false;
}
ContactEditor::~ContactEditor() {
}
void ContactEditor::init() {
qWarning("init() START");
uint i = 0;
QStringList trlChooserNames;
for (i = 0; i <= 6; i++) {
slHomeAddress.append( "" );
slBusinessAddress.append( "" );
}
trlChooserNames = OContactFields::trphonefields( false );
slChooserNames = OContactFields::untrphonefields( false );
slDynamicEntries = OContactFields::untrdetailsfields( false );
trlDynamicEntries = OContactFields::trdetailsfields( false );
// Ok, we have to remove elements from the list of dynamic entries
// which are now stored in special (not dynamic) widgets..
// Otherwise we will get problems with field assignments! (se)
slDynamicEntries.remove("Anniversary");
slDynamicEntries.remove("Birthday");
slDynamicEntries.remove("Gender");
// The same with translated fields.. But I will
// use the translation map to avoid mismatches..
QMap<int, QString> translMap = OContactFields::idToTrFields();
trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
trlDynamicEntries.remove( translMap[Qtopia::Gender] );
// Last Check to be sure..
assert( slDynamicEntries.count() == trlDynamicEntries.count() );
assert( slChooserNames.count() == trlChooserNames.count() );
for (i = 0; i < slChooserNames.count(); i++)
slChooserValues.append("");
QVBoxLayout *vb = new QVBoxLayout( this );
tabMain = new QTabWidget( this );
vb->addWidget( tabMain );
QWidget *tabViewport = new QWidget ( tabMain );
vb = new QVBoxLayout( tabViewport );
svGeneral = new QScrollView( tabViewport );
vb->addWidget( svGeneral, 0, 0 );
svGeneral->setResizePolicy( QScrollView::AutoOneFit );
// svGeneral->setHScrollBarMode( QScrollView::AlwaysOff );
// svGeneral->setVScrollBarMode( QScrollView::AlwaysOff );
svGeneral->setFrameStyle( QFrame::NoFrame );
diff --git a/core/pim/addressbook/main.cpp b/core/pim/addressbook/main.cpp
index 97bfa6d..47d370a 100644
--- a/core/pim/addressbook/main.cpp
+++ b/core/pim/addressbook/main.cpp
@@ -1,28 +1,27 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "addressbook.h"
-#include <qpe/qpeapplication.h>
#include <opie/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<AddressbookWindow> )
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp
index 9e0c78a..7a20591 100644
--- a/core/pim/addressbook/picker.cpp
+++ b/core/pim/addressbook/picker.cpp
@@ -1,100 +1,98 @@
#include "picker.h"
-#include <qfont.h>
-#include <qstring.h>
#include <qtimer.h>
#include <qlayout.h>
char PickerLabel::lastLetter = '\0';
PickerLabel::PickerLabel( QWidget *parent, const char *name )
: QLabel ( parent, name )
{
currentLetter = 0;
//lastLetter = 0;
letter1 = '\0';
letter2 = '\0';
letter3 = '\0';
// setFont( QFont( "smallsmooth", 9 ) );
setFont( QFont::defaultFont() );
setTextFormat( Qt::RichText );
}
PickerLabel::~PickerLabel()
{
}
void PickerLabel::setLetters( char ch1, char ch2, char ch3 )
{
QString tmpStr;
if (ch1 != '\0')
letter1 = ch1;
else
letter1 = ' ';
if (ch2 != '\0')
letter2 = ch2;
else
letter2 = ' ';
if (ch3 != '\0')
letter3 = ch3;
else
letter3 = ' ';
tmpStr = "<qt>";
tmpStr += letter1;
tmpStr += letter2;
tmpStr += letter3;
tmpStr += "</qt>";
setText(tmpStr);
currentLetter = 0;
}
void PickerLabel::clearLetter()
{
QString tmpStr;
tmpStr = "<qt>";
tmpStr += letter1;
tmpStr += letter2;
tmpStr += letter3;
tmpStr += "</qt>";
setText(tmpStr);
currentLetter = 0;
}
void PickerLabel::mousePressEvent( QMouseEvent* e )
{
// If one pickerlabel is was, and an other is now selected, we
// have to simulate the releaseevent.. Otherwise the new label
// will not get a highlighted letter..
// Maybe there is a more intelligent solution, but this works and I am tired.. (se)
if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e );
}
void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ )
{
QString tmpStr;
if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0')
QTimer::singleShot( 0, this, SLOT(emitClearSignal()) );
switch (currentLetter) {
case 0:
tmpStr = "<qt><u><b><font color=\"#FF00FF\">";
tmpStr += letter1;
tmpStr += "</font></b></u>";
tmpStr += letter2;
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 24affd0..af26302 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -1,160 +1,145 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
** $Id$
**
**********************************************************************/
#define QTOPIA_INTERNAL_FD
#include "datebook.h"
#include "datebookday.h"
#include "datebooksettings.h"
#include "datebookweek.h"
#include "datebookweeklst.h"
#include "dateentryimpl.h"
#include <qpe/datebookmonth.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
-#include <qpe/qpedebug.h>
-#include <qpe/event.h>
#include <qpe/finddialog.h>
#include <qpe/ir.h>
-#include <qmenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
-#include <qpe/timestring.h>
#include <qtoolbar.h>
#include <qpe/tzselect.h>
-#include <qpe/xmlreader.h>
#include <qaction.h>
#include <qcopchannel_qws.h>
-#include <qdatetime.h>
-#include <qdialog.h>
-#include <qfile.h>
-#include <qlabel.h>
#include <qlayout.h>
#include <qmessagebox.h>
-#include <qpopupmenu.h>
-#include <qpushbutton.h>
-#include <qregexp.h>
-#include <qtextcodec.h>
-#include <qtextstream.h>
#include <qtimer.h>
#include <qtl.h>
#include <qwidgetstack.h>
-#include <qwindowsystem_qws.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
DateBook::DateBook( QWidget *parent, const char *, WFlags f )
: QMainWindow( parent, "datebook", f ),
aPreset( FALSE ),
presetTime( -1 ),
startTime( 8 ), // an acceptable default
rowStyle( 0 ),
bJumpToCurTime(FALSE),
syncing(FALSE),
inSearch(FALSE),
alarmCounter(0)
{
bool needEvilHack= false; // if we need an Evil Hack
QTime t;
t.start();
db = new DateBookDBHack;
qDebug("loading db t=%d", t.elapsed() );
loadSettings();
setCaption( tr("Calendar") );
setIcon( Resource::loadPixmap( "datebook_icon" ) );
setToolBarsMovable( FALSE );
views = new QWidgetStack( this );
setCentralWidget( views );
dayView = 0;
weekView = 0;
weekLstView = 0;
monthView = 0;
// QToolBar *bar = new QToolBar( this );
// bar->setHorizontalStretchable( TRUE );
// QMenuBar *mb = new QMenuBar( bar );
// mb->setMargin( 0 );
// QPopupMenu *view = new QPopupMenu( this );
// mb->insertItem( tr( "View" ), view );
QToolBar *sub_bar = new QToolBar(this);
sub_bar->setHorizontalStretchable(TRUE);
QActionGroup *g = new QActionGroup( this );
g->setExclusive( TRUE );
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( sub_bar );
sub_bar->addSeparator();
a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
a->addTo( sub_bar );
// a->addTo( view );
sub_bar->addSeparator();
a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
a->addTo( sub_bar );
// a->addTo( view );
a->setToggleAction( TRUE );
a->setOn( TRUE );
dayAction = a;
a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
a->addTo( sub_bar );
// a->addTo( view );
a->setToggleAction( TRUE );
weekAction = a;
a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
a->addTo( sub_bar );
// a->addTo( view );
a->setToggleAction( TRUE );
weekLstAction = a;
a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
a->addTo( sub_bar );
// a->addTo( view );
a->setToggleAction( TRUE );
monthAction = a;
sub_bar->addSeparator();
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
index 1244fd3..d43d31a 100644
--- a/core/pim/datebook/datebookdayallday.cpp
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -1,120 +1,110 @@
/****************************************************************************
** GPL by Rajko Albrecht
**
**
**
**
**
****************************************************************************/
#include "datebookdayallday.h"
-#include <qpushbutton.h>
#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qobjectlist.h>
-#include <qpe/event.h>
#include <qpe/ir.h>
-#include <qpe/datebookdb.h>
-#include <qpe/resource.h>
#include <qpopupmenu.h>
#include <qtimer.h>
-#include <qregexp.h>
-#include <qdatetime.h>
#include "datebookday.h"
/*
* Constructs a DatebookdayAllday which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags )
: QScrollView( parent, name ),item_count(0),dateBook(db)
{
if ( !name )
setName( "DatebookdayAllday" );
setMinimumSize( QSize( 0, 0 ) );
setMaximumHeight(3* (QFontMetrics(font()).height()+4) );
m_MainFrame = new QFrame(viewport());
m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain);
setFrameStyle(QFrame::NoFrame|QFrame::Plain);
setResizePolicy( QScrollView::Default );
setHScrollBarMode( AlwaysOff );
addChild(m_MainFrame);
datebookdayalldayLayout = new QVBoxLayout( m_MainFrame );
datebookdayalldayLayout->setSpacing( 0 );
datebookdayalldayLayout->setMargin( 0 );
lblDesc = new DatebookEventDesc(parent->parentWidget(),"");
lblDesc->setBackgroundColor(Qt::yellow);
lblDesc->hide();
subWidgets.setAutoDelete(true);
}
/*
* Destroys the object and frees any allocated resources
*/
DatebookdayAllday::~DatebookdayAllday()
{
// no need to delete child widgets, Qt does it all for us
}
DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
{
DatebookAlldayDisp * lb;
lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL);
lb->show();
datebookdayalldayLayout->addWidget(lb);
subWidgets.append(lb);
connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&)));
++item_count;
return lb;
}
void DatebookdayAllday::removeAllEvents()
{
subWidgets.clear();
item_count = 0;
}
DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
QWidget* parent,const char* name,WFlags f)
: QLabel(parent,name,f),m_Ev(ev),dateBook(db)
{
QString strDesc = m_Ev.description();
strDesc = strDesc.replace(QRegExp("<"),"&#60;");
setBackgroundColor(yellow);
setText(strDesc);
setFrameStyle(QFrame::Raised|QFrame::Panel);
int s = QFontMetrics(font()).height()+4;
setMaximumHeight( s );
setMinimumSize( QSize( 0, s ) );
}
DatebookAlldayDisp::~DatebookAlldayDisp()
{
}
void DatebookAlldayDisp::beam_single_event()
{
// create an Event and beam it...
/*
* Start with the easy stuff. If start and end date is the same we can just use
* the values of effective m_Events
* If it is a multi day m_Event we need to find the real start and end date...
*/
if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) {
Event m_Event( m_Ev.event() );
QDateTime dt( m_Ev.date(), m_Ev.start() );
m_Event.setStart( dt );
dt.setTime( m_Ev.end() );
m_Event.setEnd( dt );
emit beamMe( m_Event );
diff --git a/core/pim/datebook/datebookdayheaderimpl.cpp b/core/pim/datebook/datebookdayheaderimpl.cpp
index 3e965f5..213c843 100644
--- a/core/pim/datebook/datebookdayheaderimpl.cpp
+++ b/core/pim/datebook/datebookdayheaderimpl.cpp
@@ -1,125 +1,121 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "datebookdayheaderimpl.h"
#include <qpe/datebookmonth.h>
#include <qpe/resource.h>
-#include <qpe/timestring.h>
#include <qbuttongroup.h>
-#include <qpopupmenu.h>
-#include <qstringlist.h>
-#include <qtimer.h>
#include <qtoolbutton.h>
/*
* Constructs a DateBookDayHeader which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
DateBookDayHeader::DateBookDayHeader( bool useMonday,
QWidget* parent, const char* name )
: DateBookDayHeaderBase( parent, name ),
bUseMonday( useMonday )
{
connect(date,SIGNAL(pressed()),this,SLOT(pickDate()));
setupNames();
forward->setPixmap( Resource::loadPixmap( "forward" ) );
back->setPixmap( Resource::loadPixmap( "back" ) );
forwardweek->setPixmap( Resource::loadPixmap( "fastforward" ) );
backweek->setPixmap( Resource::loadPixmap( "fastback" ) );
setBackgroundMode( PaletteButton );
grpDays->setBackgroundMode( PaletteButton );
}
/*
* Destroys the object and frees any allocated resources
*/
DateBookDayHeader::~DateBookDayHeader()
{
// no need to delete child widgets, Qt does it all for us
}
void DateBookDayHeader::setStartOfWeek( bool onMonday )
{
bUseMonday = onMonday;
setupNames();
setDate( currDate.year(), currDate.month(), currDate.day() );
}
void DateBookDayHeader::setupNames()
{
if ( bUseMonday ) {
cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
cmdDay2->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) );
cmdDay3->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) );
cmdDay4->setText( DateBookDayHeaderBase::tr("Thursday").left(1) );
cmdDay5->setText( DateBookDayHeaderBase::tr("Friday").left(1) );
cmdDay6->setText( DateBookDayHeaderBase::tr("Saturday").left(1) );
cmdDay7->setText( DateBookDayHeaderBase::tr("Sunday").left(1) );
} else {
cmdDay1->setText( DateBookDayHeaderBase::tr("Sunday").left(1) );
cmdDay2->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
cmdDay3->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) );
cmdDay4->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) );
cmdDay5->setText( DateBookDayHeaderBase::tr("Thursday").left(1) );
cmdDay6->setText( DateBookDayHeaderBase::tr("Friday").left(1) );
cmdDay7->setText( DateBookDayHeaderBase::tr("Saturday").left(1) );
}
}
void DateBookDayHeader::pickDate()
{
static QPopupMenu *m1 = 0;
static DateBookMonth *picker = 0;
if ( !m1 ) {
m1 = new QPopupMenu( this );
picker = new DateBookMonth( m1, 0, TRUE );
m1->insertItem( picker );
connect( picker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( setDate( int, int, int ) ) );
connect( m1, SIGNAL( aboutToHide() ),
this, SLOT( gotHide() ) );
}
picker->setDate( currDate.year(), currDate.month(), currDate.day() );
m1->popup(mapToGlobal(date->pos()+QPoint(0,date->height())));
picker->setFocus();
}
void DateBookDayHeader::gotHide()
{
// we have to redo the button...
date->setDown( false );
}
/*
* public slot
*/
void DateBookDayHeader::goBack()
{
currDate = currDate.addDays( -1 );
setDate( currDate.year(), currDate.month(), currDate.day() );
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp
index 675b17f..a6d04ba 100644
--- a/core/pim/datebook/datebooksettings.cpp
+++ b/core/pim/datebook/datebooksettings.cpp
@@ -1,123 +1,122 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "datebooksettings.h"
#include <qpe/qpeapplication.h>
#include <qspinbox.h>
#include <qcheckbox.h>
-#include <qcombobox.h>
DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent,
const char *name, bool modal, WFlags fl )
: DateBookSettingsBase( parent, name, modal, fl ),
ampm( whichClock )
{
init();
QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( slotChangeClock( bool ) ) );
QArray<int> categories;
comboCategory->setCategories( categories, "Calendar", tr("Calendar") );
}
DateBookSettings::~DateBookSettings()
{
}
void DateBookSettings::setStartTime( int newStartViewTime )
{
if ( ampm ) {
if ( newStartViewTime >= 12 ) {
newStartViewTime %= 12;
if ( newStartViewTime == 0 )
newStartViewTime = 12;
spinStart->setSuffix( tr(":00 PM") );
}
else if ( newStartViewTime == 0 ) {
newStartViewTime = 12;
spinStart->setSuffix( tr(":00 AM") );
}
oldtime = newStartViewTime;
}
spinStart->setValue( newStartViewTime );
}
int DateBookSettings::startTime() const
{
int returnMe = spinStart->value();
if ( ampm ) {
if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) )
returnMe += 12;
else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE))
returnMe = 0;
}
return returnMe;
}
void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime )
{
chkAlarmPreset->setChecked( bAlarm );
if ( presetTime >=5 )
spinPreset->setValue( presetTime );
}
bool DateBookSettings::alarmPreset() const
{
return chkAlarmPreset->isChecked();
}
int DateBookSettings::presetTime() const
{
return spinPreset->value();
}
void DateBookSettings::slot12Hour( int i )
{
if ( ampm ) {
if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) {
if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
spinStart->setSuffix( tr(":00 PM") );
} else {
if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
spinStart->setSuffix( tr(":00 AM") );
}
oldtime = i;
}
}
void DateBookSettings::init()
{
if ( ampm ) {
spinStart->setMinValue( 1 );
spinStart->setMaxValue( 12 );
spinStart->setValue( 12 );
spinStart->setSuffix( tr(":00 AM") );
oldtime = 12;
} else {
spinStart->setMinValue( 0 );
spinStart->setMaxValue( 23 );
spinStart->setSuffix( tr(":00") );
}
}
void DateBookSettings::slotChangeClock( bool whichClock )
{
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index 84b4f1b..eaa9730 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -1,121 +1,117 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "datebookweekheaderimpl.h"
-#include "datebookweekheader.h"
#include "datebookweek.h"
-#include <qlabel.h>
-#include <qspinbox.h>
-#include <qdatetime.h>
#include <qpe/resource.h>
#include <qpe/datebookmonth.h>
#include <qtoolbutton.h>
/*
* Constructs a DateBookWeekHeader which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl )
: DateBookWeekHeaderBase( parent, name, fl ),
bStartOnMonday( startOnMonday )
{
setBackgroundMode( PaletteButton );
labelDate->setBackgroundMode( PaletteButton );
backmonth->setPixmap( Resource::loadPixmap("fastback") );
backweek->setPixmap( Resource::loadPixmap("back") );
forwardweek->setPixmap( Resource::loadPixmap("forward") );
forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
}
/*
* Destroys the object and frees any allocated resources
*/
DateBookWeekHeader::~DateBookWeekHeader()
{
// no need to delete child widgets, Qt does it all for us
}
void DateBookWeekHeader::pickDate()
{
static QPopupMenu *m1 = 0;
static DateBookMonth *picker = 0;
if ( !m1 ) {
m1 = new QPopupMenu( this );
picker = new DateBookMonth( m1, 0, TRUE );
m1->insertItem( picker );
connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) );
// connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) );
}
picker->setDate( date.year(), date.month(), date.day() );
m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
picker->setFocus();
}
void DateBookWeekHeader::nextMonth()
{
qWarning("nextMonth() " );
setDate(date.addDays(28));
}
void DateBookWeekHeader::prevMonth()
{
qWarning("prevMonth() " );
setDate(date.addDays(-28));
}
void DateBookWeekHeader::nextWeek()
{
qWarning("nextWeek() " );
setDate(date.addDays(7));
}
void DateBookWeekHeader::prevWeek()
{
qWarning("prevWeek() ");
setDate(date.addDays(-7));
}
void DateBookWeekHeader::setDate( int y, int m, int d )
{
setDate(QDate(y,m,d));
}
void DateBookWeekHeader::setDate(const QDate &d) {
int year,week,dayofweek;
date=d;
dayofweek=d.dayOfWeek();
if(bStartOnMonday)
dayofweek--;
else if( dayofweek == 7 )
// we already have the right day -7 would lead to the current week..
dayofweek = 0;
date=date.addDays(-dayofweek);
calcWeek(date,week,year,bStartOnMonday);
QDate start=date;
QDate stop=start.addDays(6);
labelDate->setText( QString::number(start.day()) + "." +
Calendar::nameOfMonth( start.month()) + "-" +
QString::number(stop.day()) + "." +
Calendar::nameOfMonth( stop.month()) +" ("+
tr("w")+":"+QString::number( week ) +")");
date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
emit dateChanged(date);
}
void DateBookWeekHeader::setStartOfWeek( bool onMonday )
{
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 24fb0ba..42a1753 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,105 +1,104 @@
#include "datebookweeklst.h"
#include "datebook.h"
#include <qpe/datebookmonth.h>
#include <qpe/config.h>
#include <qpe/resource.h>
-#include <qpe/calendar.h>
#include <qlayout.h>
#include <qtoolbutton.h>
#include <qtl.h>
bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false);
DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl)
: DateBookWeekLstHeaderBase(parent, name, fl)
{
setBackgroundMode( PaletteButton );
labelDate->setBackgroundMode( PaletteButton );
forwardweek->setBackgroundMode( PaletteButton );
forwardweek->setPixmap( Resource::loadPixmap("forward") );
forwardmonth->setBackgroundMode( PaletteButton );
forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
backweek->setBackgroundMode( PaletteButton );
backweek->setPixmap( Resource::loadPixmap("back") );
backmonth->setBackgroundMode( PaletteButton );
backmonth->setPixmap( Resource::loadPixmap("fastback") );
DateBookWeekLstHeaderBaseLayout->setSpacing(0);
DateBookWeekLstHeaderBaseLayout->setMargin(0);
//setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
bStartOnMonday=onM;
}
DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
void DateBookWeekLstHeader::setDate(const QDate &d) {
int year,week,dayofweek;
date=d;
dayofweek=d.dayOfWeek();
if(bStartOnMonday)
dayofweek--;
else if( dayofweek == 7 )
/* we already have the right day -7 would lead to the same week */
dayofweek = 0;
date=date.addDays(-dayofweek);
calcWeek(date,week,year,bStartOnMonday);
QDate start=date;
QDate stop=start.addDays(6);
labelDate->setText( QString::number(start.day()) + "." +
Calendar::nameOfMonth( start.month() ) + "-" +
QString::number(stop.day()) + "." +
Calendar::nameOfMonth( stop.month()) +" ("+
tr("w")+":"+QString::number( week ) +")");
date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
emit dateChanged(date);
}
void DateBookWeekLstHeader::pickDate() {
static QPopupMenu *m1 = 0;
static DateBookMonth *picker = 0;
if ( !m1 ) {
m1 = new QPopupMenu( this );
picker = new DateBookMonth( m1, 0, TRUE );
m1->insertItem( picker );
connect( picker, SIGNAL( dateClicked( int, int, int ) ),this, SLOT( setDate( int, int, int ) ) );
//connect( m1, SIGNAL( aboutToHide() ),
//this, SLOT( gotHide() ) );
}
picker->setDate( date.year(), date.month(), date.day() );
m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
picker->setFocus();
}
void DateBookWeekLstHeader::setDate(int y, int m, int d) {
setDate(QDate(y,m,d));
}
void DateBookWeekLstHeader::nextWeek() {
setDate(date.addDays(7));
}
void DateBookWeekLstHeader::prevWeek() {
setDate(date.addDays(-7));
}
void DateBookWeekLstHeader::nextMonth()
{
setDate(date.addDays(28));
}
void DateBookWeekLstHeader::prevMonth()
{
setDate(date.addDays(-28));
}
DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
QWidget* parent,
const char* name,
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 856837c..018bb5a 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -1,137 +1,126 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "dateentryimpl.h"
#include "repeatentry.h"
#include <qpe/qpeapplication.h>
#include <qpe/categoryselect.h>
#include <qpe/datebookmonth.h>
-#include <qpe/global.h>
-#include <qpe/timeconversion.h>
-#include <qpe/timestring.h>
#include <qpe/tzselect.h>
-#include <qevent.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qlayout.h>
#include <qlineedit.h>
-#include <qmultilineedit.h>
-#include <qpopupmenu.h>
-#include <qscrollview.h>
#include <qspinbox.h>
-#include <qtoolbutton.h>
#include <opie/otimepicker.h>
#include "onoteedit.h"
#include <stdlib.h>
#include <stdio.h>
/*
* Constructs a DateEntry which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
const QDateTime &end, bool whichClock, QWidget* parent,
const char* name )
: DateEntryBase( parent, name ),
ampm( whichClock ),
startWeekOnMonday( startOnMonday ),
m_showStart(true)
{
init();
setDates(start,end);
setFocusProxy(comboDescription);
}
bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
{
if( ev->type() == QEvent::FocusIn ){
if( obj == comboStart ){
timePickerStart->setHour(startTime.hour());
timePickerStart->setMinute(startTime.minute());
TimePickerLabel->setText( tr("Start Time" ) );
m_showStart= true;
}else if( obj == comboEnd ){
timePickerStart->setHour(endTime.hour());
timePickerStart->setMinute(endTime.minute());
TimePickerLabel->setText( tr("End Time") );
m_showStart = false;
}
} else if( ev->type() == QEvent::FocusOut ){
// if( obj == comboEnd ){
// QString s;
// s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
// comboEnd->setText(s);
// }
// else if( obj == comboStart ){
// QString s;
// s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute());
// comboStart->setText(s);
// }
}
return false;
}
static void addOrPick( QComboBox* combo, const QString& t )
{
// Pick an item if one excists
for (int i=0; i<combo->count(); i++) {
if ( combo->text(i) == t ) {
combo->setCurrentItem(i);
return;
}
}
// Else add one
combo->insertItem(t);
combo->setCurrentItem(combo->count()-1);
}
DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
QWidget* parent, const char* name )
: DateEntryBase( parent, name ),
ampm( whichClock ),
startWeekOnMonday( startOnMonday ),
m_showStart(true)
{
init();
setDates(event.start(),event.end());
comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
if(!event.description().isEmpty())
addOrPick( comboDescription, event.description() );
if(!event.location().isEmpty())
addOrPick( comboLocation, event.location() );
checkAlarm->setChecked( event.hasAlarm() );
checkAllDay->setChecked( event.type() == Event::AllDay );
if(!event.notes().isEmpty()) noteStr=event.notes();
else noteStr="";
spinAlarm->setValue(event.alarmTime());
if ( event.alarmSound() != Event::Silent )
comboSound->setCurrentItem( 1 );
if ( event.hasRepeat() ) {
diff --git a/core/pim/datebook/main.cpp b/core/pim/datebook/main.cpp
index 8004690..421e457 100644
--- a/core/pim/datebook/main.cpp
+++ b/core/pim/datebook/main.cpp
@@ -1,25 +1,24 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "datebook.h"
-#include <qpe/qpeapplication.h>
#include <opie/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<DateBook> )
diff --git a/core/pim/datebook/noteentryimpl.cpp b/core/pim/datebook/noteentryimpl.cpp
index 0e45985..14fe98e 100644
--- a/core/pim/datebook/noteentryimpl.cpp
+++ b/core/pim/datebook/noteentryimpl.cpp
@@ -1,17 +1,15 @@
#include "noteentryimpl.h"
-#include "qstring.h"
-#include "qmultilinedit.h"
#include "qlabel.h"
#include "onoteedit.h"
NoteEntry::NoteEntry(const QString &title, const QString &noteStr,
QWidget* parent, const char* name, bool modal,
WFlags fl) :
NoteEntryBase(parent, name, modal, fl) {
eventLabel->setText(title);
note->setText(noteStr);
int l=note->length();
note->setCursorPosition(l,l,false);
}
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp
index b1a162d..7cf36da 100644
--- a/core/pim/datebook/repeatentry.cpp
+++ b/core/pim/datebook/repeatentry.cpp
@@ -1,127 +1,123 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "repeatentry.h"
#include <qpe/datebookmonth.h>
#include <qpe/qpeapplication.h>
-#include <qpe/timestring.h>
-#include <qbuttongroup.h>
#include <qlabel.h>
-#include <qpopupmenu.h>
#include <qspinbox.h>
-#include <qtoolbutton.h>
#include <time.h>
// Global Templates for use in setting up the repeat label...
// the problem is these strings get initialized before QPEApplication can install the translator -zecke
namespace {
QString strDayTemplate;
QString strYearTemplate;
QString strMonthDateTemplate;
QString strMonthDayTemplate;
QString strWeekTemplate;
QString dayLabel[7];
}
/*
* static linkage to not polute the symbol table...
* The problem is that const and static linkage are resolved prior to installing a translator
* leading to that the above strings are translted but to the original we delay the init of these strings...
* -zecke
*/
static void fillStrings() {
strDayTemplate = QObject::tr("Every");
strYearTemplate = QObject::tr("%1 %2 every ");
strMonthDateTemplate = QObject::tr("The %1 every ");
strMonthDayTemplate = QObject::tr("The %1 %1 of every");
strWeekTemplate = QObject::tr("Every ");
dayLabel[0] = QObject::tr("Monday");
dayLabel[1] = QObject::tr("Tuesday");
dayLabel[2] = QObject::tr("Wednesday");
dayLabel[3] = QObject::tr("Thursday");
dayLabel[4] = QObject::tr("Friday");
dayLabel[5] = QObject::tr("Saturday");
dayLabel[6] = QObject::tr("Sunday");
}
static QString numberPlacing( int x ); // return the proper word format for
// x (1st, 2nd, etc)
static int week( const QDate &dt ); // what week in the month is dt?
RepeatEntry::RepeatEntry( bool startOnMonday,
const QDate &newStart, QWidget *parent,
const char *name, bool modal, WFlags fl )
: RepeatEntryBase( parent, name, modal, fl ),
start( newStart ),
currInterval( NONE ),
startWeekOnMonday( startOnMonday )
{
if (strDayTemplate.isEmpty() )
fillStrings();
init();
fraType->setButton( currInterval );
chkNoEnd->setChecked( TRUE );
setupNone();
}
RepeatEntry::RepeatEntry( bool startOnMonday, const Event::RepeatPattern &rp,
const QDate &startDate,
QWidget *parent, const char *name, bool modal,
WFlags fl )
: RepeatEntryBase( parent, name, modal, fl ),
start( startDate ),
end( rp.endDate() ),
startWeekOnMonday( startOnMonday )
{
if (strDayTemplate.isEmpty() )
fillStrings();
// do some stuff with the repeat pattern
init();
switch ( rp.type ) {
default:
case Event::NoRepeat:
currInterval = NONE;
setupNone();
break;
case Event::Daily:
currInterval = DAY;
setupDaily();
break;
case Event::Weekly:
currInterval = WEEK;
setupWeekly();
int day, buttons;
for ( day = 0x01, buttons = 0; buttons < 7;
day = day << 1, buttons++ ) {
if ( rp.days & day ) {
if ( startWeekOnMonday )
fraExtra->setButton( buttons );
else {
if ( buttons == 7 )
fraExtra->setButton( 0 );
else
fraExtra->setButton( buttons + 1 );
}
}
}
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index dbd6df6..6891f03 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -1,61 +1,59 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "adresssearch.h"
#include "contactitem.h"
#include <qpe/resource.h>
-#include <qstring.h>
-#include <qiconset.h>
//#include <qwhatsthis.h>
AdressSearch::AdressSearch(QListView* parent, QString name):
SearchGroup(parent, name)
{
_contacts = 0;
QIconSet is = Resource::loadIconSet( "addressbook/AddressBookSmall" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
// QWhatsThis::add( this, QObject::tr("Search the addressbook") );
/* QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" );
QImage img = pix.convertToImage();
img.smoothScale( 14, 14 );
pix.convertFromImage( img );
setPixmap( 0, pix );*/
}
AdressSearch::~AdressSearch()
{
delete _contacts;
}
void AdressSearch::load()
{
_contacts = new OPimContactAccess("osearch");
}
int AdressSearch::search()
{
OPimRecordList<OPimContact> results = _contacts->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++) {
(void)new ContactItem( this, new OPimContact( results[i] ));
}
return results.count();
}
void AdressSearch::insertItem( void* )
{
}
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
index 06c2b1e..19e765e 100644
--- a/core/pim/osearch/applnkitem.cpp
+++ b/core/pim/osearch/applnkitem.cpp
@@ -1,61 +1,60 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "applnkitem.h"
#include <qpe/applnk.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qfileinfo.h>
AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app)
: ResultItem(parent)
{
_app = app;
setText(0, _app->name() );
setPixmap(0, _app->pixmap() );
}
AppLnkItem::~AppLnkItem()
{
}
QString AppLnkItem::toRichText()
{
QString text;
text += "<b><h3>" + _app->name() + "</b></h3><br>";
text += _app->comment() + "<br>";
text += "<br>`" + _app->exec() + "`<br>";
text += "<br>`" + _app->file() + "`<br>";
text += "<br>`" + _app->linkFile() + "`<br>";
return text;
}
void AppLnkItem::action( int act )
{
if (!_app->isValid()) qDebug("INVALID");
if (act == 0) _app->execute();
else if (act == 1){
QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
e << _app->linkFile();
}
}
QIntDict<QString> AppLnkItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("execute") ) );
result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
return result;
}
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index 1c84d66..758baf2 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -1,70 +1,69 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "applnksearch.h"
#include "applnkitem.h"
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
-#include <qiconset.h>
AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
{
_apps = 0;
QIconSet is = Resource::loadIconSet( "osearch/applicationsSmall" );
//QIconSet is = Resource::loadIconSet( "AppsIcon" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
}
AppLnkSearch::~AppLnkSearch()
{
delete _apps;
}
void AppLnkSearch::load()
{
_apps = new AppLnkSet(QPEApplication::qpeDir());
}
int AppLnkSearch::search()
{
QList<AppLnk> appList = _apps->children();
for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
if ( (_search.match( app->name() ) != -1)
|| (_search.match(app->comment()) != -1)
|| (_search.match(app->exec()) != -1) ) {
insertItem( app );
}else
if (searchFile( app ))
insertItem( app );
qApp->processEvents( 100 );
}
return _resultCount;
}
void AppLnkSearch::insertItem( void *rec )
{
(void)new AppLnkItem( this, (AppLnk*)rec );
_resultCount++;
}
void AppLnkSearch::setSearch(QRegExp re)
{
setOpen( false );
SearchGroup::setSearch( re );
}
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
index eedc374..639af46 100644
--- a/core/pim/osearch/contactitem.cpp
+++ b/core/pim/osearch/contactitem.cpp
@@ -1,114 +1,113 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "contactitem.h"
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpixmap.h>
ContactItem::ContactItem(OListViewItem* parent, OPimContact *contact)
: ResultItem(parent)
{
_contact = contact;
setText(0, _contact->toShortText());
setIcon();
}
void ContactItem::setIcon()
{
QPixmap icon;
switch ( _contact->lastHitField() ) {
case -1:
icon = Resource::loadPixmap( "reset" );
break;
case Qtopia::BusinessPhone:
icon = Resource::loadPixmap( "addressbook/phonework" );
break;
case Qtopia::BusinessFax:
icon = Resource::loadPixmap( "addressbook/faxwork" );
break;
case Qtopia::BusinessMobile:
icon = Resource::loadPixmap( "addressbook/mobilework" );
break;
case Qtopia::DefaultEmail:
case Qtopia::Emails:
icon = Resource::loadPixmap( "addressbook/email" );
break;
case Qtopia::HomePhone:
icon = Resource::loadPixmap( "addressbook/phonehome" );
break;
case Qtopia::HomeFax:
icon = Resource::loadPixmap( "addressbook/faxhome" );
break;
case Qtopia::HomeMobile:
icon = Resource::loadPixmap( "addressbook/mobilehome" );
break;
case Qtopia::HomeWebPage:
icon = Resource::loadPixmap( "addressbook/webpagehome" );
break;
case Qtopia::BusinessWebPage:
icon = Resource::loadPixmap( "addressbook/webpagework" );
break;
case Qtopia::Title:
case Qtopia::JobTitle:
case Qtopia::FirstName:
case Qtopia::MiddleName:
case Qtopia::LastName:
case Qtopia::Suffix:
case Qtopia::Nickname:
case Qtopia::FileAs:
icon = Resource::loadPixmap( "addressbook/identity" );
break;
case Qtopia::HomeStreet:
case Qtopia::HomeCity:
case Qtopia::HomeState:
case Qtopia::HomeZip:
case Qtopia::HomeCountry:
icon = Resource::loadPixmap( "osearch/addresshome" );
break;
case Qtopia::Company:
case Qtopia::BusinessCity:
case Qtopia::BusinessStreet:
case Qtopia::BusinessZip:
case Qtopia::BusinessCountry:
case Qtopia::Department:
case Qtopia::Office:
case Qtopia::Manager:
case Qtopia::BusinessPager:
case Qtopia::Profession:
icon = Resource::loadPixmap( "osearch/addresshome" );
break;
case Qtopia::Assistant:
case Qtopia::Spouse:
case Qtopia::Children:
icon = Resource::loadPixmap( "osearch/personal" );
break;
case Qtopia::Birthday:
case Qtopia::Anniversary:
icon = Resource::loadPixmap( "osearch/clock" );
break;
case Qtopia::Notes:
icon = Resource::loadPixmap( "txt" );
break;
default:
icon = Resource::loadPixmap( "DocsIcon" );
break;
}
setPixmap( 0, icon );
}
ContactItem::~ContactItem()
{
delete _contact;
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 2b4660a..eeea54b 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,95 +1,93 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "datebooksearch.h"
#include "eventitem.h"
#include <opie2/opimevent.h>
#include <opie2/opimrecurrence.h>
#include <qpe/resource.h>
#include <qpe/config.h>
-#include <qiconset.h>
#include <qaction.h>
-#include <qdatetime.h>
#include <qpopupmenu.h>
DatebookSearch::DatebookSearch(QListView* parent, QString name)
: SearchGroup(parent, name), _dates(0), _popupMenu(0)
{
QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true );
actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true );
Config cfg( "osearch", Config::User );
cfg.setGroup( "datebook_settings" );
actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
}
DatebookSearch::~DatebookSearch()
{
qDebug("SAVE DATEBOOK SEARCH CONFIG");
Config cfg( "osearch", Config::User );
cfg.setGroup( "datebook_settings" );
cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() );
cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() );
delete _dates;
delete _popupMenu;
delete actionShowPastEvents;
delete actionSearchInDates;
}
void DatebookSearch::load()
{
_dates = new ODateBookAccess();
_dates->load();
}
int DatebookSearch::search()
{
OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++)
insertItem( new OPimEvent( results[i] ) );
return _resultCount;
}
void DatebookSearch::insertItem( void *rec )
{
OPimEvent *ev = (OPimEvent*)rec;
if ( !actionShowPastEvents->isOn() &&
ev->endDateTime() < QDateTime::currentDateTime() &&
!ev->recurrence().doesRecur()
) return;
if ( !actionSearchInDates->isOn() && (
ev->lastHitField() == Qtopia::StartDateTime ||
ev->lastHitField() == Qtopia::EndDateTime )
) return;
new EventItem( this, ev );
_resultCount++;
}
QPopupMenu* DatebookSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionShowPastEvents->addTo( _popupMenu );
actionSearchInDates->addTo( _popupMenu );
}
return _popupMenu;
}
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
index 1516b8e..df8e856 100644
--- a/core/pim/osearch/doclnkitem.cpp
+++ b/core/pim/osearch/doclnkitem.cpp
@@ -1,80 +1,79 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "doclnkitem.h"
#include <qpe/applnk.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qfile.h>
#include <qtextstream.h>
#include <qfileinfo.h>
DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
: ResultItem(parent)
{
_doc = app;
setText(0, _doc->name() );
setPixmap(0, _doc->pixmap() );
}
DocLnkItem::~DocLnkItem()
{
}
QString DocLnkItem::toRichText()
{
QString text;
text += "<b><h3>" + _doc->name() + "</b></h3><br>";
text += _doc->comment() + "<br>";
text += QObject::tr("File: ") + _doc->file() + "<br>";
text += QObject::tr("Link: ") + _doc->linkFile() + "<br>";
text += QObject::tr("Mimetype: ") + _doc->type() + "<br>";
if ( _doc->type().contains( "text" ) ){
text += "<br><br><hr><br>";
QFile f(_doc->file());
if ( f.open(IO_ReadOnly) ) {
QTextStream t( &f );
while ( !t.eof() )
text += t.readLine() + "<br>";
}
f.close();
}
/* text += "<br><br>`";
text += _doc->exec();
text += "`";*/
QStringList list = _doc->mimeTypes();
int i = 0;
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
text += QString::number( i++) + " - " + *it ;
}
return text;
}
void DocLnkItem::action( int act )
{
qDebug("action %i",act);
if (!_doc->isValid()) qDebug("INVALID");
if (act == 0) _doc->execute();
else if (act == 1){
QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
e << _doc->file();
}
}
QIntDict<QString> DocLnkItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) );
result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
return result;
}
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
index c73dcbf..3f0d223 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,99 +1,98 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "doclnkitem.h"
#include "doclnksearch.h"
#include <opie2/owait.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qaction.h>
#include <qfile.h>
-#include <qiconset.h>
#include <qpopupmenu.h>
#include <qtextstream.h>
DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
: AppLnkSearch(parent, name), _popupMenu(0)
{
QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" );
setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) );
actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true );
Config cfg( "osearch", Config::User );
cfg.setGroup( "doclnk_settings" );
actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) );
}
DocLnkSearch::~DocLnkSearch()
{
Config cfg( "osearch", Config::User );
cfg.setGroup( "doclnk_settings" );
cfg.writeEntry( "search_content", actionSearchInFiles->isOn() );
}
void DocLnkSearch::load()
{
_apps = new DocLnkSet(QPEApplication::documentDir());
}
bool DocLnkSearch::searchFile( AppLnk *app )
{
if (!actionSearchInFiles->isOn()) return false;
DocLnk *doc = (DocLnk*)app;
bool found = false;
if ( doc->type().contains( "text" ) ){
#ifdef NEW_OWAIT
QString ouput = QObject::tr("searching %1").arg(doc->file());
OWait( output );
#endif
QFile f(doc->file());
if ( f.open(IO_ReadOnly) ) {
QTextStream t( &f );
while ( !t.eof() )
if (_search.match( t.readLine()) != -1) {
found = true;
break;
}
}
f.close();
}
return found;
}
void DocLnkSearch::insertItem( void *rec )
{
(void)new DocLnkItem( this, (DocLnk*)rec );
_resultCount++;
}
QPopupMenu* DocLnkSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionSearchInFiles->addTo( _popupMenu );
}
return _popupMenu;
// (void) new DocLnkItem( this, (DocLnk*)rec );
// rec is undeclared here
#warning FIXME
_resultCount++;
}
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp
index f6e34fe..8dcfc70 100644
--- a/core/pim/osearch/eventitem.cpp
+++ b/core/pim/osearch/eventitem.cpp
@@ -1,86 +1,84 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "eventitem.h"
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qdatetime.h>
-#include <qpixmap.h>
EventItem::EventItem(OListViewItem* parent, OPimEvent *event)
: ResultItem(parent)
{
_event = event;
setText(0, _event->toShortText() );
setIcon();
}
EventItem::~EventItem()
{
}
QString EventItem::toRichText()
{
return _event->toRichText();
}
void EventItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)");
e << _event->startDateTime().date();
}else if(act == 1){
QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
e << _event->uid();
}
}
QIntDict<QString> EventItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
void EventItem::setIcon()
{
QPixmap icon;
switch ( _event->lastHitField() ) {
case -1:
icon = Resource::loadPixmap( "reset" );
// QWhatsThis::add( icon, QObject::tr("Enter your search terms here") );
break;
case Qtopia::DatebookDescription:
icon = Resource::loadPixmap( "osearch/summary" );
break;
case Qtopia::Notes:
icon = Resource::loadPixmap( "txt" );
break;
case Qtopia::Location:
icon = Resource::loadPixmap( "home" );
break;
case Qtopia::StartDateTime:
case Qtopia::EndDateTime:
icon = Resource::loadPixmap( "osearch/clock" );
break;
default:
icon = Resource::loadPixmap( "DocsIcon" );
break;
}
setPixmap( 0, icon );
}
diff --git a/core/pim/osearch/main.cpp b/core/pim/osearch/main.cpp
index 9a03818..e0a2de3 100644
--- a/core/pim/osearch/main.cpp
+++ b/core/pim/osearch/main.cpp
@@ -1,7 +1,6 @@
#include "mainwindow.h"
-#include <qpe/qpeapplication.h>
#include <opie/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 95f5967..bfe95b0 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,126 +1,126 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "olistview.h"
#include "olistviewitem.h"
#include "resultitem.h"
#include "adresssearch.h"
#include "todosearch.h"
#include "datebooksearch.h"
#include "applnksearch.h"
#include "doclnksearch.h"
#include "mainwindow.h"
#include <opie2/owait.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
+
#include <qpe/qpeapplication.h>
-#include <qpe/config.h>
#include <qpe/global.h>
#include <qtoolbar.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qhbuttongroup.h>
#include <qhbox.h>
#include <qpushbutton.h>
#include <qintdict.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qsignalmapper.h>
#include <qtextbrowser.h>
#include <qregexp.h>
#include <qwhatsthis.h>
#include <qmenubar.h>
static const char* const image1_data[] = {
"14 14 3 1",
". c None",
"# c #000000",
"a c #ff0000",
"..............",
"..##.......###",
".#aa#....##aa#",
"#aaaa#.##aaaa#",
".##aaa#aaaaa##",
"...#aaaaaaa#..",
"....#aaaaa#...",
"...#aaaaa#....",
"..#aaaaaaa#...",
".#aaaaaaaaa#..",
"#aaaa###aaaa#.",
"#aaa#..##aaa#.",
"#aaa#...#aa#..",
".###.....##..."};
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
QMainWindow( parent, name, f ), _currentItem(0)
{
setCaption( tr("OSearch") );
setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
QFrame *mainFrame = new QFrame( this, "mainFrame" );
mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
mainLayout = new QVBoxLayout( mainFrame );
mainLayout->setSpacing( 0 );
mainLayout->setMargin( 3 );
resultsList = new OListView( mainFrame );
resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
mainLayout->addWidget( resultsList );
detailsFrame = new QFrame( mainFrame, "detailsFrame" );
QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
richEdit = new QTextView( detailsFrame );
QWhatsThis::add( richEdit, tr("The details of the current result") );
richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
detailsLayout->addWidget( richEdit );
buttonBox = new QHBox( mainFrame, "Button Box" );
_buttonCount = 0;
mainLayout->addWidget( detailsFrame );
mainLayout->addWidget( buttonBox );
detailsFrame->hide();
buttonBox->hide();
searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
setCentralWidget( mainFrame );
popupTimer = new QTimer();
searchTimer = new QTimer();
connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
signalMapper = new QSignalMapper( this );
diff --git a/core/pim/osearch/olistview.cpp b/core/pim/osearch/olistview.cpp
index 7a7cb26..8fbb31d 100644
--- a/core/pim/osearch/olistview.cpp
+++ b/core/pim/osearch/olistview.cpp
@@ -1,40 +1,39 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
#include "olistview.h"
#include "olistviewitem.h"
#include <qpe/qpeapplication.h>
-#include <qmessagebox.h>
OListView::OListView(QWidget *parent, const char *name )
: QListView(parent,name)
{
setRootIsDecorated( true );
addColumn(tr("Results"),qApp->desktop()->width() - 9 );
//setColumnWidthMode(0, Manual);
setSorting( -1 );
connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
}
OListView::~OListView()
{
}
void OListView::expand(QListViewItem *item)
{
((OListViewItem*)item)->expand();
}
diff --git a/core/pim/osearch/resultitem.cpp b/core/pim/osearch/resultitem.cpp
index f051b12..41c22c0 100644
--- a/core/pim/osearch/resultitem.cpp
+++ b/core/pim/osearch/resultitem.cpp
@@ -1,27 +1,26 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "resultitem.h"
-#include <qmessagebox.h>
ResultItem::ResultItem(OListViewItem* parent)
: OListViewItem(parent)
{
}
ResultItem::~ResultItem()
{
}
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index 5377b9f..7a0b5a7 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -1,92 +1,89 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
-#include "olistviewitem.h"
#include "searchgroup.h"
#include <opie2/owait.h>
-#include <qobject.h>
-#include <qregexp.h>
#include <qapplication.h>
#ifndef NEW_OWAIT
static OWait *wait = 0;
#endif
SearchGroup::SearchGroup(QListView* parent, QString name)
: OListViewItem(parent, name)
{
_name = name;
loaded = false;
}
SearchGroup::~SearchGroup()
{
}
void SearchGroup::expand()
{
//expanded = true;
if (_lastSearch != _search) clearList();
if (_search.isEmpty()) return;
OListViewItem *dummy = new OListViewItem( this, "searching...");
setOpen( true );
repaint();
int res_count = realSearch();
setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
delete dummy;
repaint();
}
void SearchGroup::doSearch()
{
clearList();
if (_search.isEmpty()) return;
_resultCount = realSearch();
// repaint();
}
void SearchGroup::setSearch(QRegExp re)
{
if (re == _search) return;
setText(0, _name+" - "+re.pattern() );
_search = re;
if (isOpen()) expand();
else new OListViewItem( this, "searching...");
}
int SearchGroup::realSearch()
{
if (_lastSearch == _search) return _resultCount;
#ifndef NEW_OWAIT
if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" );
wait->show();
qApp->processEvents();
#else
qDebug("********** NEW_OWAIT *************");
OWait( "searching" );
#endif
if (!loaded) load();
_resultCount = 0;
_resultCount = search();
_lastSearch = _search;
setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")");
#ifndef NEW_OWAIT
wait->hide();
#endif
return _resultCount;
}
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp
index c20f1fd..be780a1 100644
--- a/core/pim/osearch/todoitem.cpp
+++ b/core/pim/osearch/todoitem.cpp
@@ -1,83 +1,82 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "todoitem.h"
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpixmap.h>
TodoItem::TodoItem(OListViewItem* parent, OPimTodo *todo)
: ResultItem(parent)
{
_todo = todo;
setText( 0, todo->toShortText() );
setIcon();
}
TodoItem::~TodoItem()
{
delete _todo;
}
QString TodoItem::toRichText()
{
return _todo->toRichText();
}
void TodoItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/todolist", "show(int)");
e << _todo->uid();
}else if (act == 1){
QCopEnvelope e("QPE/Application/todolist", "edit(int)");
e << _todo->uid();
}
}
QIntDict<QString> TodoItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
void TodoItem::setIcon()
{
QPixmap icon;
switch ( _todo->lastHitField() ) {
case -1:
icon = Resource::loadPixmap( "reset" );
break;
case OPimTodo::Description:
icon = Resource::loadPixmap( "txt" );
break;
case OPimTodo::Summary:
icon = Resource::loadPixmap( "osearch/summary" );
break;
case OPimTodo::Priority:
icon = Resource::loadPixmap( "todo/priority1" );
break;
case OPimTodo::HasDate:
icon = Resource::loadPixmap( "osearch/clock" );
break;
default:
icon = Resource::loadPixmap( "DocsIcon" );
break;
}
setPixmap( 0, icon );
}
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index 5042803..cdf3a1c 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -1,80 +1,79 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "todosearch.h"
#include "todoitem.h"
#include <qpe/resource.h>
#include <qpe/config.h>
-#include <qiconset.h>
#include <qaction.h>
#include <qpopupmenu.h>
TodoSearch::TodoSearch(QListView* parent, QString name)
: SearchGroup(parent, name), _todos(0), _popupMenu(0)
{
// AppLnkSet als(QPEApplication::qpeDir());
// setPixmap( 0, als.findExec("todolist")->pixmap() );
QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true );
Config cfg( "osearch", Config::User );
cfg.setGroup( "todo_settings" );
actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) );
}
TodoSearch::~TodoSearch()
{
Config cfg( "osearch", Config::User );
cfg.setGroup( "todo_settings" );
cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() );
delete _popupMenu;
delete actionShowCompleted;
delete _todos;
}
void TodoSearch::load()
{
_todos = new OPimTodoAccess();
_todos->load();
}
int TodoSearch::search()
{
OPimRecordList<OPimTodo> results = _todos->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++)
insertItem( new OPimTodo( results[i] ));
return _resultCount;
}
void TodoSearch::insertItem( void *rec )
{
OPimTodo *todo = (OPimTodo*)rec;
if (!actionShowCompleted->isOn() &&
todo->isCompleted() ) return;
(void)new TodoItem( this, todo );
_resultCount++;
}
QPopupMenu* TodoSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionShowCompleted->addTo( _popupMenu );
}
return _popupMenu;
}
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index b55a4a7..72cdfd6 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,120 +1,119 @@
/*
* today.cpp
*
* copyright : (c) 2002,2003,2004 by Maximilian Reiß
* email : harlekin@handhelds.org
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#define QTOPIA_INTERNAL_LANGLIST
#include "today.h"
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
-#include <qpe/global.h>
#include <qpe/qpeapplication.h>
#include <qpe/contact.h>
#include <qdir.h>
#include <qtimer.h>
#include <qwhatsthis.h>
struct TodayPlugin {
TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
QLibrary *library;
QInterfacePtr<TodayPluginInterface> iface;
TodayPluginObject *guiPart;
QWidget *guiBox;
QString name;
bool active;
bool excludeRefresh;
int pos;
};
static QValueList<TodayPlugin> pluginList;
static QMap<QString, TodayPlugin> tempList;
Today::Today( QWidget* parent, const char* name, WFlags fl )
: TodayBase( parent, name, fl ) {
QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
#if defined(Q_WS_QWS)
#if !defined(QT_NO_COP)
QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
#endif
#endif
setOwnerField();
m_refreshTimer = new QTimer( this );
connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
m_refreshTimer->start( 15000 );
m_big_box = 0L;
layout = new QVBoxLayout( this );
layout->addWidget( Frame );
layout->addWidget( OwnerField );
m_sv = new QScrollView( this );
m_sv->setResizePolicy( QScrollView::AutoOneFit );
m_sv->setHScrollBarMode( QScrollView::AlwaysOff );
m_sv->setFrameShape( QFrame::NoFrame );
layout->addWidget( m_sv );
layout->setStretchFactor( m_sv,4 );
qApp->processEvents();
loadPlugins();
QPEApplication::showWidget( this );
}
/**
* Qcop receive method.
*/
void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
QDataStream stream( data, IO_ReadOnly );
if ( msg == "message(QString)" ) {
QString message;
stream >> message;
setOwnerField( message );
}
}
void Today::setRefreshTimer( int interval ) {
disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
// 0 is "never" case
if ( !interval == 0 ) {
connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
m_refreshTimer->changeInterval( interval );
}
}
/**
* Initialises the owner field with the default value, the username
*/
void Today::setOwnerField() {
QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
if ( QFile::exists( file ) ) {
Contact cont = Contact::readVCard( file )[0];
QString returnString = cont.fullName();
OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
} else {
OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 0613f2c..b68aad2 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,151 +1,145 @@
/*
               =. This file is part of the OPIE Project
             .=l. Copyright (c) 2002 <>
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <unistd.h>
#include <opie2/opimrecurrence.h>
#include <opie2/opimnotifymanager.h>
#include <opie2/otodoaccessvcal.h>
#include <opie2/oapplicationfactory.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/ir.h>
#include <qpe/resource.h>
#include <qpe/qpemessagebox.h>
#include <qpe/alarmserver.h>
-#include <qpe/timestring.h>
#include <qpe/qpeapplication.h>
#include <qmenubar.h>
#include <qmessagebox.h>
-#include <qtoolbar.h>
-#include <qpopupmenu.h>
#include <qpushbutton.h>
-#include <qwidgetstack.h>
#include <qaction.h>
#include <qtimer.h>
-#include <qvbox.h>
#include <qlayout.h>
-#include <qlineedit.h>
#include <qwhatsthis.h>
#include "quickeditimpl.h"
#include "todotemplatemanager.h"
#include "templateeditor.h"
#include "tableview.h"
#include "textviewshow.h"
#include "todoeditor.h"
#include "mainwindow.h"
OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
using namespace Todo;
MainWindow::MainWindow( QWidget* parent,
const char* name, WFlags )
: OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
{
if (!name)
setName("todo window");
m_syncing = false;
m_showing = false;
m_counter = 0;
m_tempManager = new TemplateManager();
m_tempManager->load();
initUI();
initConfig();
initViews();
initActions();
initEditor();
initShow();
initTemplate();
populateTemplates();
raiseCurrentView();
QTimer::singleShot(0, this, SLOT(populateCategories() ) );
}
void MainWindow::initTemplate() {
m_curTempEd = new TemplateEditor( this, templateManager() );
}
void MainWindow::initActions() {
// Data menu
m_edit->insertItem(QWidget::tr("New from template"), m_template,
-1, 0 );
QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ),
QString::null, 0, this, 0 );
connect(a, SIGNAL( activated() ),
this, SLOT( slotNew() ) );
a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) );
a->addTo(m_tool );
a->addTo(m_edit );
a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ),
QString::null, 0, this, 0 );
connect(a, SIGNAL(activated() ),
this, SLOT( slotEdit() ) );
a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) );
a->addTo( m_tool );
a->addTo( m_edit );
m_editAction = a;
a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 );
connect(a, SIGNAL( activated() ),
this, SLOT( slotShowDetails() ) );
a->addTo( m_edit );
m_edit->insertSeparator();
a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ),
QString::null, 0, this, 0 );
connect(a, SIGNAL(activated() ),
this, SLOT(slotDelete() ) );
a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) );
a->addTo( m_tool );
a->addTo( m_edit );
m_deleteAction = a;
a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 );
connect(a, SIGNAL( activated() ),
this, SLOT( slotDeleteAll() ) );
a->addTo(m_edit );
m_deleteAllAction = a;
a = new QAction( QString::null, QWidget::tr("Delete completed"),
0, this, 0 );
connect(a, SIGNAL( activated() ),
this, SLOT( slotDeleteCompleted() ) );
a->addTo(m_edit );
a->setEnabled( TRUE );
m_deleteCompleteAction = a;