summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp16
-rw-r--r--library/backend/categories.cpp9
-rw-r--r--library/backend/categories.h2
-rw-r--r--library/backend/event.cpp4
-rw-r--r--library/backend/palmtoprecord.h12
-rw-r--r--library/datebookdb.cpp12
-rw-r--r--library/finddialog.cpp7
-rw-r--r--library/global.cpp28
-rw-r--r--library/qpeapplication.cpp3
-rw-r--r--library/storage.cpp6
10 files changed, 65 insertions, 34 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 35822dd..00030e8 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -311,49 +311,65 @@ int AppLnk::bigIconSize()
\sa setCategories()
*/
const QArray<int>& AppLnk::categories() const
{
d->ensureCatArray();
return d->mCat;
}
/*!
\fn int AppLnk::id() const
Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet,
this value is 0, otherwise it is a value that is unique for the
duration of the current process.
\sa AppLnkSet::find()
*/
/*!
\fn bool AppLnk::isValid() const
Returns TRUE if this AppLnk is valid; otherwise returns FALSE.
*/
+/*!
+ \fn bool AppLnk::fileKnown() const
+
+ If the with the AppLnk associated file is not equal to QString::null
+*/
+/*!
+ \fn bool AppLnk::linkFileKnown()const
+
+ The filename of the AppLnk
+*/
+/*!
+ \fn void AppLnk::setRotation( const QString& )
+
+ The default rotation of the associated application. This
+ function is included inline for binary compatible issues
+*/
/*!
Creates an invalid AppLnk.
\sa isValid()
*/
AppLnk::AppLnk()
{
mId = 0;
d = new AppLnkPrivate();
}
/*!
Loads \a file (e.g. \e app.desktop) as an AppLnk.
\sa writeLink()
*/
AppLnk::AppLnk( const QString &file )
{
QStringList sl;
d = new AppLnkPrivate();
if ( !file.isNull() ) {
Config config( file, Config::File );
if ( config.isValid() ) {
diff --git a/library/backend/categories.cpp b/library/backend/categories.cpp
index 2e84089..cce9f38 100644
--- a/library/backend/categories.cpp
+++ b/library/backend/categories.cpp
@@ -466,49 +466,49 @@ QString Categories::label( const QString &app, int id ) const
set, the just the first string is returned.
*/
QString Categories::displaySingle( const QString &app,
const QArray<int> &catids,
DisplaySingle display ) const
{
QStringList strs = labels( app, catids );
if ( !strs.count() )
return tr("Unfiled");
strs.sort();
QString r;
if ( strs.count() > 1 ) {
switch ( display ) {
case ShowFirst:
r = strs.first();
break;
case ShowMulti:
r = strs.first() + tr(" (multi.)");
break;
case ShowAll:
r = strs.join(" ");
break;
}
}
- else r = strs.first();
+ else r = strs.first();
return r;
}
/*!
Returns all ids associated with the application CategoryGroup \a app
and the passed in \a labels in that group.
*/
QArray<int> Categories::ids( const QString &app, const QStringList &labels) const
{
QArray<int> results;
QStringList::ConstIterator it;
int i;
for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) {
int value = id( app, *it );
if ( value != 0 ) {
int tmp = results.size();
results.resize( tmp + 1 );
results[ tmp ] = value;
}
}
return results;
}
@@ -827,78 +827,73 @@ void CheckedListView::setChecked( const QStringList &checked )
// iterate over all items
bool showingChecked = FALSE;
for ( QCheckListItem *i = (QCheckListItem *) firstChild();
i; i = (QCheckListItem *)i->nextSibling() )
// see if the item should be checked by searching the
// checked list
if ( checked.find( i->text( 0 ) ) != checked.end() ) {
i->setOn( TRUE );
// make sure it is showing at least one checked item
if ( !showingChecked ) {
ensureItemVisible( i );
showingChecked = TRUE;
}
}
else
i->setOn( FALSE );
}
/*! \fn Categories &Categories::operator= ( const Categories &c )
Performs deep copy.
*/
-/*! \fn QStringList Categories::labels( const QString & app, const QArray<int> &catids ) const
-
- Returns list of labels associated with the application and catids
-*/
-
/*! \fn QStringList Categories::globalCategories() const
Returns list of all global category labels
*/
/*! \fn const QMap<QString, CategoryGroup> &Categories::appGroupMap() const
Returns a map of application names to CategoryGroup. The CategoryGroup
class defines a map of ids to category labels and category labels to ids.
*/
/*! \fn const CategoryGroup &Categories::globalGroup() const
Returns the global CategoryGroup. The CategoryGroup
class defines a map of ids to category labels and category labels to ids.
*/
/*! \fn void Categories::categoryAdded( const Categories &cats, const QString &appname, int uid)
Emitted if a category is added.
\a cats is a const reference to this object
\a appname is the CategoryGroup application name that the category was added to or QString::null if it was global
\a uid is the unique identifier associated with the added category
-*/
+*/
/*! \fn void Categories::categoryRemoved( const Categories &cats, const QString &appname,
int uid)
Emitted if removed category is removed.
\a cats is a const reference to this object
\a appname is the CategoryGroup application name that the category was removed from or QString::null if it was the global CategoryGroup
\a uid is the unique identifier associated with the removed category
*/
/*! \fn void Categories::categoryRenamed( const Categories &cats, const QString &appname,
int uid)
Emitted if \a uid in the \a appname CategoryGroup is renamed in \a cats
object.
\a cats is a const reference to this object
\a appname is the CategoryGroup application name that the category was renamed in or QString::null if it was the global CategoryGroup
\a uid is the unique identifier associated with the renamed category
*/
/*! \fn Categories::Categories( QObject *parent=0, const char *name = 0 )
diff --git a/library/backend/categories.h b/library/backend/categories.h
index ba65ee3..d5b3669 100644
--- a/library/backend/categories.h
+++ b/library/backend/categories.h
@@ -64,49 +64,49 @@ public:
/** Returns label associated with the uid or QString::null if
* not found
*/
const QString &label(int id) const;
/** Returns the uid associated with label or 0 if not found */
int id(const QString &label) const;
/** Returns a sorted list of labels */
QStringList labels() const;
QStringList labels( const QArray<int> &catids ) const;
const QMap<int, QString> &idMap() const { return mIdLabelMap; }
private:
void insert( int uid, const QString &label );
QMap<int, QString> mIdLabelMap;
QMap<QString, int> mLabelIdMap;
static Qtopia::UidGen &uidGen() { return sUidGen; }
static Qtopia::UidGen sUidGen;
};
-/** Map from application name to categories */
+/* Map from application name to categories */
class QPC_EXPORT Categories : public QObject
{
Q_OBJECT
public:
Categories( QObject *parent=0, const char *name = 0 )
: QObject( parent, name ), mGlobalCats(), mAppCats() { }
Categories( const Categories &copyFrom ) : QObject( copyFrom.parent() ),
mGlobalCats( copyFrom.mGlobalCats ),
mAppCats( copyFrom.mAppCats ) { }
virtual ~Categories() { }
Categories &operator= ( const Categories &c )
{ mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; }
void clear();
/** Add the category name as long as it doesn't already exist
* locally or globally. Return UID if added, 0 if conflicts
* (error).
*/
int addCategory( const QString &appname, const QString &catname);
/** Add the category name as long as it doesn't already exist
* locally or globally. Return UID if added, 0 if conflicts
* (error).
diff --git a/library/backend/event.cpp b/library/backend/event.cpp
index d906f19..4c24ab3 100644
--- a/library/backend/event.cpp
+++ b/library/backend/event.cpp
@@ -146,55 +146,55 @@ Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia );
<li>\c MonthlyDay - Event occurs every n months. Event will always occur in
the same week and same day of week as the first event.
<li>\c MonthlyDate - Event occurs every n months. Event will always occur
on the same day of the month as the first event.
<li>\c Yearly - Event occurs every n years.
</ul>
*/
/*!
\fn bool Event::isAllDay() const
Returns TRUE if the event is an all day event. Otherwise returns FALSE.
*/
/*!
\fn void Event::setAllDay(bool allday)
If \a allday is TRUE, will set the event to be an all day event.
Otherwise sets the event to not be an all day event.
\warning This function may affect the start and end times of the event.
*/
/*!
- \fn QDateTime Event::start() const
+ \fn QDateTime Event::start(bool) const
Returns the start date and time of the first occurance of the event.
*/
/*!
- \fn QDateTime Event::end() const
+ \fn QDateTime Event::end(bool) const
Returns the end date and time of the first occurance of the event.
*/
/*!
\fn time_t Event::startTime() const
\internal
*/
/*!
\fn time_t Event::endTime() const
\internal
*/
/*!
\fn void Event::setAlarm(int delay, SoundTypeChoice s)
Sets the alarm delay of the event to \a delay and the sound type of the
alarm to \a s.
*/
/*!
\fn void Event::clearAlarm()
diff --git a/library/backend/palmtoprecord.h b/library/backend/palmtoprecord.h
index 72f7d1c..15cdd6a 100644
--- a/library/backend/palmtoprecord.h
+++ b/library/backend/palmtoprecord.h
@@ -11,51 +11,63 @@
** 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.
**
**********************************************************************/
#ifndef QTPALMTOP_RECORD_H
#define QTPALMTOP_RECORD_H
#include <qglobal.h>
#include "qpcglobal.h"
#include "palmtopuidgen.h"
#include <qarray.h>
#include <qmap.h>
#if defined(QPC_TEMPLATEDLL)
// MOC_SKIP_BEGIN
QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>;
// MOC_SKIP_END
#endif
class QRegExp;
+/**
+ * @short Qtopia namespace
+ * The namespace of Qtopia
+ */
namespace Qtopia {
class RecordPrivate;
+/**
+ * @short The base class of all Records
+ *
+ * The base class for Records in Qtopia
+ * @see Task
+ * @see Event
+ * @see Contact
+ */
class QPC_EXPORT Record
{
public:
Record() : mUid(0), mCats() { }
Record( const Record &c ) : mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { }
virtual ~Record() { }
Record &operator=( const Record &c );
virtual bool match( const QRegExp & ) const { return FALSE; }
void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); }
void setCategories( int single );
const QArray<int> &categories() const { return mCats; }
void reassignCategoryId( int oldId, int newId )
{
int index = mCats.find( oldId );
if ( index >= 0 )
mCats[index] = newId;
}
int uid() const { return mUid; };
virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); }
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp
index 0fedfa8..2f33255 100644
--- a/library/datebookdb.cpp
+++ b/library/datebookdb.cpp
@@ -50,49 +50,49 @@ static QString dateBookJournalFile()
QString str = getenv("HOME");
return QString( str +"/.caljournal" );
}
static QString dateBookFilename()
{
return Global::applicationFileName("datebook","datebook.xml");
}
/* Calculating the next event of a recuring event is actually
computationally inexpensive, esp. compared to checking each day
individually. There are bad worse cases for say the 29th of
february or the 31st of some other months. However
these are still bounded */
bool nextOccurance(const Event &e, const QDate &from, QDateTime &next)
{
// easy checks, first are we too far in the future or too far in the past?
QDate tmpDate;
int freq = e.repeatPattern().frequency;
int diff, diff2, a;
int iday, imonth, iyear;
int dayOfWeek = 0;
int firstOfWeek = 0;
int weekOfMonth;
-
+
if (e.repeatPattern().hasEndDate && e.repeatPattern().endDate() < from)
return FALSE;
if (e.start() >= from) {
next = e.start();
return TRUE;
}
switch ( e.repeatPattern().type ) {
case Event::Weekly:
/* weekly is just daily by 7 */
/* first convert the repeatPattern.Days() mask to the next
day of week valid after from */
dayOfWeek = from.dayOfWeek();
dayOfWeek--; /* we want 0-6, doco for above specs 1-7 */
/* this is done in case freq > 1 and from in week not
for this round */
// firstOfWeek = 0; this is already done at decl.
while(!((1 << firstOfWeek) & e.repeatPattern().days))
firstOfWeek++;
/* there is at least one 'day', or there would be no event */
@@ -440,94 +440,94 @@ QValueList<Event> DateBookDB::getEvents( const QDateTime &start )
QValueListConstIterator<Event> it;
QDateTime dtTmp;
QValueList<Event> tmpList;
for (it = day.begin(); it != day.end(); ++it ) {
dtTmp = (*it).start(TRUE);
if ( dtTmp == start )
tmpList.append( *it );
}
return tmpList;
}
//#### Why is this code duplicated in getEvents ?????
QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDate &from,
const QDate &to )
{
QValueList<EffectiveEvent> tmpList;
QValueListIterator<Event> it;
EffectiveEvent effEv;
QDateTime dtTmp,
dtEnd;
for (it = eventList.begin(); it != eventList.end(); ++it ) {
- if (!(*it).isValidUid())
+ if (!(*it).isValidUid())
(*it).assignUid(); // FIXME: Hack to restore cleared uids
dtTmp = (*it).start(TRUE);
dtEnd = (*it).end(TRUE);
if ( dtTmp.date() >= from && dtTmp.date() <= to ) {
Event tmpEv = *it;
effEv.setEvent(tmpEv);
effEv.setDate( dtTmp.date() );
effEv.setStart( dtTmp.time() );
if ( dtTmp.date() != dtEnd.date() )
effEv.setEnd( QTime(23, 59, 0) );
else
effEv.setEnd( dtEnd.time() );
tmpList.append( effEv );
}
// we must also check for end date information...
if ( dtEnd.date() != dtTmp.date() && dtEnd.date() >= from ) {
QDateTime dt = dtTmp.addDays( 1 );
dt.setTime( QTime(0, 0, 0) );
QDateTime dtStop;
if ( dtEnd > to ) {
dtStop = to;
} else
dtStop = dtEnd;
while ( dt <= dtStop ) {
Event tmpEv = *it;
effEv.setEvent( tmpEv );
effEv.setDate( dt.date() );
if ( dt >= from ) {
effEv.setStart( QTime(0, 0, 0) );
if ( dt.date() == dtEnd.date() )
effEv.setEnd( dtEnd.time() );
else
effEv.setEnd( QTime(23, 59, 59) );
tmpList.append( effEv );
}
dt = dt.addDays( 1 );
}
}
}
// check for repeating events...
QDateTime repeat;
for ( it = repeatEvents.begin(); it != repeatEvents.end(); ++it ) {
- if (!(*it).isValidUid())
+ if (!(*it).isValidUid())
(*it).assignUid(); // FIXME: Hack to restore cleared uids
/* create a false end date, to short circuit on hard
MonthlyDay recurences */
Event dummy_event = *it;
int duration = (*it).start().date().daysTo( (*it).end().date() );
QDate itDate = from.addDays(-duration);
Event::RepeatPattern r = dummy_event.repeatPattern();
if ( !r.hasEndDate || r.endDate() > to ) {
r.setEndDate( to );
r.hasEndDate = TRUE;
}
dummy_event.setRepeat(TRUE, r);
while (nextOccurance(dummy_event, itDate, repeat)) {
if(repeat.date() > to)
break;
effEv.setDate( repeat.date() );
if ((*it).type() == Event::AllDay) {
effEv.setStart( QTime(0,0,0) );
effEv.setEnd( QTime(23,59,59) );
} else {
/* we only occur by days, not hours/minutes/seconds. Hence
@@ -602,98 +602,98 @@ void DateBookDB::addJFEvent( const Event &ev, bool doalarm )
if ( ev.hasRepeat() )
repeatEvents.append( ev );
else
eventList.append( ev );
}
void DateBookDB::editEvent( const Event &old, Event &editedEv )
{
int oldIndex=0;
bool oldHadRepeat = old.hasRepeat();
Event orig;
// write to the journal...
if ( oldHadRepeat ) {
if ( origRepeat( old, orig ) ) // should work always...
oldIndex = repeatEvents.findIndex( orig );
} else
oldIndex = eventList.findIndex( old );
saveJournalEntry( editedEv, ACTION_REPLACE, oldIndex, oldHadRepeat );
// Delete old event
if ( old.hasAlarm() )
delEventAlarm( old );
if ( oldHadRepeat ) {
- if ( editedEv.hasRepeat() ) { // This mean that origRepeat was run above and
+ if ( editedEv.hasRepeat() ) { // This mean that origRepeat was run above and
// orig is initialized
// assumption, when someone edits a repeating event, they
// want to change them all, maybe not perfect, but it works
// for the moment...
repeatEvents.remove( orig );
} else
removeRepeat( old );
} else {
QValueList<Event>::Iterator it = eventList.find( old );
if ( it != eventList.end() )
eventList.remove( it );
}
// Add new event
if ( editedEv.hasAlarm() )
addEventAlarm( editedEv );
if ( editedEv.hasRepeat() )
repeatEvents.append( editedEv );
else
eventList.append( editedEv );
d->clean = false;
}
void DateBookDB::removeEvent( const Event &ev )
{
// write to the journal...
saveJournalEntry( ev, ACTION_REMOVE, -1, false );
removeJFEvent( ev );
d->clean = false;
}
void DateBookDB::removeJFEvent( const Event&ev )
{
if ( ev.hasAlarm() )
delEventAlarm( ev );
if ( ev.hasRepeat() ) {
removeRepeat( ev );
} else {
QValueList<Event>::Iterator it = eventList.find( ev );
if ( it != eventList.end() )
eventList.remove( it );
}
}
// also handles journaling...
void DateBookDB::loadFile( const QString &strFile )
{
-
+
QFile f( strFile );
if ( !f.open( IO_ReadOnly ) )
return;
enum Attribute {
FDescription = 0,
FLocation,
FCategories,
FUid,
FType,
FAlarm,
FSound,
FRType,
FRWeekdays,
FRPosition,
FRFreq,
FRHasEndDate,
FREndDate,
FRStart,
FREnd,
FNote,
FCreated,
FAction,
FActionKey,
@@ -702,49 +702,49 @@ void DateBookDB::loadFile( const QString &strFile )
QAsciiDict<int> dict( 97 );
dict.setAutoDelete( TRUE );
dict.insert( "description", new int(FDescription) );
dict.insert( "location", new int(FLocation) );
dict.insert( "categories", new int(FCategories) );
dict.insert( "uid", new int(FUid) );
dict.insert( "type", new int(FType) );
dict.insert( "alarm", new int(FAlarm) );
dict.insert( "sound", new int(FSound) );
dict.insert( "rtype", new int(FRType) );
dict.insert( "rweekdays", new int(FRWeekdays) );
dict.insert( "rposition", new int(FRPosition) );
dict.insert( "rfreq", new int(FRFreq) );
dict.insert( "rhasenddate", new int(FRHasEndDate) );
dict.insert( "enddt", new int(FREndDate) );
dict.insert( "start", new int(FRStart) );
dict.insert( "end", new int(FREnd) );
dict.insert( "note", new int(FNote) );
dict.insert( "created", new int(FCreated) );
dict.insert( "action", new int(FAction) );
dict.insert( "actionkey", new int(FActionKey) );
dict.insert( "actionorig", new int (FJournalOrigHadRepeat) );
-
+
QByteArray ba = f.readAll();
char* dt = ba.data();
int len = ba.size();
int currentAction,
journalKey,
origHadRepeat; // should be bool, but we need tri-state(not being used)
int i = 0;
char *point;
// hack to get rid of segfaults after reading </DATEBOOK>
while ( (dt+i != 0) && (( point = strstr( dt+i, "<event " ) ) != 0 )) {
i = point - dt;
// if we are reading in events in the general case,
// we are just adding them, so let the actions represent that...
currentAction = ACTION_ADD;
journalKey = -1;
origHadRepeat = -1;
// some temporary variables for dates and times ...
//int startY = 0, startM = 0, startD = 0, starth = 0, startm = 0, starts = 0;
//int endY = 0, endM = 0, endD = 0, endh = 0, endm = 0, ends = 0;
//int enddtY = 0, enddtM = 0, enddtD = 0;
// ... for the alarm settings ...
int alarmTime = -1; Event::SoundTypeChoice alarmSound = Event::Silent;
diff --git a/library/finddialog.cpp b/library/finddialog.cpp
index d9f430a..ddf41a7 100644
--- a/library/finddialog.cpp
+++ b/library/finddialog.cpp
@@ -7,48 +7,55 @@
** 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.
**
**********************************************************************/
// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
// have this class.
#define QTOPIA_INTERNAL_FD
#include "finddialog.h"
#include "findwidget_p.h"
#include <qlayout.h>
#include <qpushbutton.h>
+/*!
+ \class FindDialog finddialog.h
+ \brief A simple FindDialog
+
+ A find dialog. FIXME!!!!
+
+*/
FindDialog::FindDialog( const QString &appName, QWidget *parent,
const char *name, bool modal )
: QDialog( parent, name, modal )
{
setCaption( tr("Find") );
QVBoxLayout *vb;
vb = new QVBoxLayout( this );
fw = new FindWidget( appName, this, "Find Widget" );
vb->addWidget( fw );
QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,
bool,bool,int)),
this, SIGNAL(signalFindClicked(const QString&,
bool,bool,int)) );
QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,
bool,bool,int)),
this, SIGNAL(signalFindClicked(const QString&,
const QDate&,bool,bool,int)) );
d = 0;
}
FindDialog::~FindDialog()
{
}
diff --git a/library/global.cpp b/library/global.cpp
index 68a3a75..ce39751 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -89,49 +89,49 @@ signals:
class StartingAppList : public QObject {
Q_OBJECT
public:
static void add( const QString& name );
static bool isStarting( const QString name );
private slots:
void handleNewChannel( const QString &);
private:
StartingAppList( QObject *parent=0, const char* name=0 ) ;
QDict<QTime> dict;
static StartingAppList *appl;
};
StartingAppList* StartingAppList::appl = 0;
StartingAppList::StartingAppList( QObject *parent, const char* name )
:QObject( parent, name )
{
#if QT_VERSION >= 232 && defined(QWS)
connect( qwsServer, SIGNAL( newChannel(const QString&)),
this, SLOT( handleNewChannel(const QString&)) );
-#endif
+#endif
dict.setAutoDelete( TRUE );
}
void StartingAppList::add( const QString& name )
{
#if QT_VERSION >= 232 && !defined(QT_NO_COP)
if ( !appl )
appl = new StartingAppList;
QTime *t = new QTime;
t->start();
appl->dict.insert( "QPE/Application/" + name, t );
#endif
}
bool StartingAppList::isStarting( const QString name )
{
#if QT_VERSION >= 232 && !defined(QT_NO_COP)
if ( appl ) {
QTime *t = appl->dict.find( "QPE/Application/" + name );
if ( !t )
return FALSE;
if ( t->elapsed() > 10000 ) {
// timeout in case of crash or something
appl->dict.remove( "QPE/Application/" + name );
@@ -367,49 +367,49 @@ QString Global::applicationFileName(const QString& appname, const QString& filen
if ( d.mkdir(r) == false )
return QString::null;
r += "/"; r += filename;
return r;
}
/*!
\internal
*/
void Global::createDocDir()
{
if ( !docDirCreated ) {
docDirCreated = TRUE;
mkdir( QPEApplication::documentDir().latin1(), 0755 );
}
}
/*!
Displays a status \a message to the user. This usually appears
in the taskbar for a short amount of time, then disappears.
*/
void Global::statusMessage(const QString& message)
{
-#if!defined(QT_NO_COP)
+#if !defined(QT_NO_COP)
QCopEnvelope e( "QPE/TaskBar", "message(QString)" );
e << message;
#endif
}
/*!
\internal
*/
void Global::applyStyle()
{
#if !defined(QT_NO_COP)
QCopChannel::send( "QPE/System", "applyStyle()" );
#else
((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version
#endif
}
/*!
\internal
*/
QWidget *Global::shutdown( bool )
{
#if !defined(QT_NO_COP)
QCopChannel::send( "QPE/System", "shutdown()" );
@@ -540,141 +540,141 @@ void Global::terminate( const AppLnk* app )
QCopEnvelope e(channel, "quit()");
}
#endif
}
/*!
Low-level function to run command \a c.
\warning Do not use this function. Use execute instead.
\sa execute()
*/
void Global::invoke(const QString &c)
{
// Convert the command line in to a list of arguments
QStringList list = QStringList::split(QRegExp(" *"),c);
#if !defined(QT_NO_COP)
QString ap=list[0];
// see if the application is already running
// XXX should lock file /tmp/qcop-msg-ap
if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
// If the channel is already register, the app is already running, so show it.
{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
-
+
QCopEnvelope e("QPE/System", "notBusy(QString)" );
e << ap;
return;
}
// XXX should unlock file /tmp/qcop-msg-ap
//see if it is being started
if ( StartingAppList::isStarting( ap ) ) {
QCopEnvelope e("QPE/System", "notBusy(QString)" );
e << ap;
return;
}
#endif
#ifdef QT_NO_QWS_MULTIPROCESS
QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
#else
QStrList slist;
unsigned int j;
for ( j = 0; j < list.count(); j++ )
slist.append( list[j].utf8() );
const char **args = new (const char *)[slist.count() + 1];
for ( j = 0; j < slist.count(); j++ )
args[j] = slist.at(j);
args[j] = NULL;
#if !defined(QT_NO_COP)
// an attempt to show a wait...
// more logic should be used, but this will be fine for the moment...
QCopEnvelope ( "QPE/System", "busy()" );
#endif
#ifdef HAVE_QUICKEXEC
QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
qDebug("libfile = %s", libexe.latin1() );
if ( QFile::exists( libexe ) ) {
qDebug("calling quickexec %s", libexe.latin1() );
quickexecv( libexe.utf8().data(), (const char **)args );
} else
#endif
- {
- bool success = false;
+ {
+ bool success = false;
int pfd [2];
if ( ::pipe ( pfd ) < 0 )
pfd [0] = pfd [1] = -1;
-
+
pid_t pid = ::fork ( );
-
+
if ( pid == 0 ) { // child
for ( int fd = 3; fd < 100; fd++ ) {
if ( fd != pfd [1] )
::close ( fd );
}
::setpgid ( ::getpid ( ), ::getppid ( ));
// Closing of fd[1] indicates that the execvp succeeded!
if ( pfd [1] >= 0 )
::fcntl ( pfd [1], F_SETFD, FD_CLOEXEC );
-
+
// Try bindir first, so that foo/bar works too
::execv ( qpeDir ( ) + "/bin/" + args [0], (char * const *) args );
::execvp ( args [0], (char * const *) args );
-
+
char resultByte = 1;
if ( pfd [1] >= 0 )
::write ( pfd [1], &resultByte, 1 );
- ::_exit ( -1 );
+ ::_exit ( -1 );
}
else if ( pid > 0 ) {
success = true;
-
- if ( pfd [1] >= 0 )
+
+ if ( pfd [1] >= 0 )
::close ( pfd [1] );
if ( pfd [0] >= 0 ) {
while ( true ) {
char resultByte;
int n = ::read ( pfd [0], &resultByte, 1 );
if ( n == 1 ) {
success = false;
break;
}
if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR )))
continue;
-
+
break; // success
}
::close ( pfd [0] );
}
}
- if ( success )
+ if ( success )
StartingAppList::add( list[0] );
else
QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 );
}
#endif //QT_NO_QWS_MULTIPROCESS
}
/*!
Executes the application identfied by \a c, passing \a
document if it isn't null.
Note that a better approach might be to send a QCop message to the
application's QPE/Application/\e{appname} channel.
*/
void Global::execute( const QString &c, const QString& document )
{
if ( qApp->type() != QApplication::GuiServer ) {
// ask the server to do the work
#if !defined(QT_NO_COP)
if ( document.isNull() ) {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << c;
} else {
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c562f6c..2ef60d5 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -429,49 +429,49 @@ static void setTreble( int t = 0, int percent = -1 )
\fn void QPEApplication::clockChanged( bool ampm );
This signal is emitted when the user changes the clock's style. If
\a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise,
they want a 24-hour clock.
*/
/*!
\fn void QPEApplication::volumeChanged( bool muted )
This signal is emitted whenever the mute state is changed. If \a
muted is TRUE, then sound output has been muted.
*/
/*!
\fn void QPEApplication::weekChanged( bool startOnMonday )
This signal is emitted if the week start day is changed. If \a
startOnMonday is TRUE then the first day of the week is Monday; if
\a startOnMonday is FALSE then the first day of the week is
Sunday.
*/
/*!
- \fn void QPEApplication::dateFormatChanged()
+ \fn void QPEApplication::dateFormatChanged(DateFormat)
This signal is emitted whenever the date format is changed.
*/
/*!
\fn void QPEApplication::flush()
###
*/
/*!
\fn void QPEApplication::reload()
*/
/*!
\fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data )
This signal is emitted when a message is received on this
application's QPE/Application/<i>appname</i> \link qcop.html
QCop\endlink channel.
The slot to which you connect this signal uses \a msg and \a data
in the following way:
@@ -1747,48 +1747,49 @@ void QPEApplication::hideOrQuit()
// completely useless implementations of builtin new and delete that
// use about 50% of your CPU. Here we revert to the simple libc
// functions.
void* operator new[]( size_t size )
{
return malloc( size );
}
void* operator new( size_t size )
{
return malloc( size );
}
void operator delete[]( void* p )
{
free( p );
}
void operator delete[]( void* p, size_t /*size*/ )
{
free( p );
}
+
void operator delete( void* p )
{
free( p );
}
void operator delete( void* p, size_t /*size*/ )
{
free( p );
}
#endif
#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP)
#include <qwidgetlist.h>
#ifdef QWS
#include <qgfx_qws.h>
extern QRect qt_maxWindowRect;
void qt_setMaxWindowRect(const QRect& r )
{
qt_maxWindowRect = qt_screen->mapFromDevice( r,
qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) );
// Re-resize any maximized windows
QWidgetList* l = QApplication::topLevelWidgets();
if ( l ) {
diff --git a/library/storage.cpp b/library/storage.cpp
index f4c1c02..12f9df9 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -179,69 +179,69 @@ void StorageInfo::update()
i.current()->update();
}
#endif
}
bool deviceTab( const char *device) {
QString name = device;
bool hasDevice=false;
struct mntent *me;
FILE *mntfp = setmntent( "/etc/mtab", "r" );
if ( mntfp ) {
while ( (me = getmntent( mntfp )) != 0 ) {
QString deviceName = me->mnt_fsname;
// qDebug(deviceName);
if( deviceName.left(name.length()) == name) {
hasDevice = true;
}
}
}
endmntent( mntfp );
return hasDevice;
}
/*!
- * @fn hasCf()
+ * @fn static bool StorageInfo::hasCf()
* @brief returns whether device has Cf mounted
*
*/
bool StorageInfo::hasCf()
{
return deviceTab("/dev/hd");
}
/*!
- * @fn hasSd()
+ * @fn static bool StorageInfo::hasSd()
* @brief returns whether device has SD mounted
*
*/
bool StorageInfo::hasSd()
{
return deviceTab("/dev/mmcd");
}
/*!
- * @fn hasMmc()
+ * @fn static bool StorageInfo::hasMmc()
* @brief reutrns whether device has mmc mounted
*
*/
bool StorageInfo::hasMmc()
{
bool hasMmc=false;
if( deviceTab("/dev/mmc/part"))
hasMmc=true;
if( deviceTab("/dev/mmcd"))
hasMmc=true;
return hasMmc;
}
//---------------------------------------------------------------------------
FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o )
: fsdisk( disk ), fspath( path ), humanname( name ), blkSize(512), totalBlks(0), availBlks(0), removable( rem ), opts( o )
{
update();
}
void FileSystem::update()
{