summaryrefslogtreecommitdiff
authorzecke <zecke>2003-04-16 10:57:59 (UTC)
committer zecke <zecke>2003-04-16 10:57:59 (UTC)
commiteeb29547890a2d162de66d7d5b98d3840a7e2d79 (patch) (side-by-side diff)
tree973c6de7aae2fd5ba368efb87fa24234f0e12aa3
parentdfa2d294b3af09bf3757a3c2294a925093e72fc6 (diff)
downloadopie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.zip
opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.tar.gz
opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.tar.bz2
Fix API docu
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/applnk.cpp16
-rw-r--r--library/backend/categories.cpp5
-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.cpp0
-rw-r--r--library/finddialog.cpp7
-rw-r--r--library/global.cpp0
-rw-r--r--library/qpeapplication.cpp3
-rw-r--r--library/storage.cpp6
10 files changed, 43 insertions, 12 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 35822dd..00030e8 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -287,97 +287,113 @@ int AppLnk::bigIconSize()
Returns the Rotation property. The value is 0, 90, 180 or 270
degrees.
*/
/*!
\fn QString AppLnk::comment() const
Returns the Comment property.
\sa setComment()
*/
/*!
\fn QStringList AppLnk::mimeTypes() const
Returns the MimeTypes property. This is the list of MIME types
that the application can view or edit.
*/
/*!
\fn const QArray<int>& AppLnk::categories() const
Returns the Categories property.
See the CategoryWidget for more details.
\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() ) {
config.setGroup( "Desktop Entry" );
mName = config.readEntry( "Name", file );
mExec = config.readEntry( "Exec" );
mType = config.readEntry( "Type", QString::null );
mIconFile = config.readEntry( "Icon", QString::null );
mRotation = config.readEntry( "Rotation", "" );
mComment = config.readEntry( "Comment", QString::null );
// MIME types are case-insensitive.
mMimeTypes = config.readListEntry( "MimeType", ';' );
for (QStringList::Iterator it=mMimeTypes.begin(); it!=mMimeTypes.end(); ++it)
*it = (*it).lower();
mMimeTypeIcons = config.readListEntry( "MimeTypeIcons", ';' );
mLinkFile = file;
mFile = config.readEntry("File", QString::null);
if ( !mExec. isEmpty ( )) {
mFile = QString::null;
}
else if ( mFile[0] != '/' ) {
int slash = file.findRev('/');
if ( slash >= 0 ) {
mFile = file.left(slash) + '/' + mFile;
}
}
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
@@ -803,101 +803,96 @@ void Categories::dump() const
}
}
QStringList CheckedListView::checked() const
{
QStringList strs;
for ( QCheckListItem *i = (QCheckListItem *) firstChild();
i; i = (QCheckListItem *)i->nextSibling() )
if ( i->isOn() )
strs += i->text( 0 );
return strs;
}
void CheckedListView::addCheckableList( const QStringList &options )
{
for ( QStringList::ConstIterator it = options.begin();
it != options.end(); ++it ) {
(void) new QCheckListItem( this, *it,
QCheckListItem::CheckBox );
}
}
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
*/
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
@@ -40,97 +40,97 @@ template class QPC_EXPORT QMap< QString, CategoryGroup >;
// MOC_SKIP_END
#endif
class QPC_EXPORT CategoryGroup
{
friend class Categories;
public:
CategoryGroup(): mIdLabelMap(), mLabelIdMap() { }
CategoryGroup( const CategoryGroup &c ) :
mIdLabelMap( c.mIdLabelMap), mLabelIdMap( c.mLabelIdMap ) { }
void clear() { mIdLabelMap.clear(); mLabelIdMap.clear(); }
int add( const QString &label );
bool add( int uid, const QString &label );
bool remove( const QString &label );
bool remove( int uid );
bool rename( int uid, const QString &newLabel );
bool rename( const QString &oldLabel, const QString &newLabel );
bool contains(int id) const;
bool contains(const QString &label) const;
/** 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).
*/
int addCategory( const QString &appname, const QString &catname, int uid);
/** Add the global category just checking that it doesn't
* already exist globally. Return UID if added, 0 if conflicts.
*/
int addGlobalCategory( const QString &catname );
/** Add the global category just checking that it doesn't
* already exist globally. Return UID if added, 0 if conflicts.
*/
int addGlobalCategory( const QString &catname, int uid );
/** Removes the category from the application; if it is not found
* in the application, then it removes it from the global list
*/
bool removeCategory( const QString &appName, const QString &catName,
bool checkGlobal = TRUE);
bool removeCategory( const QString &appName, int uid );
bool removeGlobalCategory( const QString &catName );
bool removeGlobalCategory( int uid );
QArray<int> ids( const QString &app, const QStringList &labels) const;
/** Returns the id associated with the app */
int id( const QString &app, const QString &cat ) const;
/** Returns the label associated with the id */
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
@@ -122,103 +122,103 @@ Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia );
/*!
\fn bool Event::operator!=( const Event & ) const
\internal
*/
/*!
\fn bool Event::operator>( const Event & ) const
\internal
*/
/*!
\fn bool Event::operator>=( const Event & ) const
\internal
*/
/*!
\enum Event::RepeatType
This enum defines how a event will repeat, if at all.
<ul>
<li>\c NoRepeat - Event does not repeat.
<li>\c Daily - Event occurs every n days.
<li>\c Weekly - Event occurs every n weeks.
<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()
Clears the alarm for the event.
*/
/*!
\fn int Event::alarmDelay() const
Returns the delay in minutes between the alarm for an event and the
start of the event.
*/
/*!
\fn Event::RepeatType Event::repeatType() const
Returns the repeat pattern type for the event.
\sa frequency()
*/
/*!
\fn int Event::weekOffset() const
Returns the number of weeks from the start of the month that this event
occurs.
*/
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
@@ -1,85 +1,97 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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.
**
**********************************************************************/
#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 ); }
bool isValidUid() const { return mUid != 0; }
void assignUid() { setUid( uidGen().generate() ); }
virtual QString customField(const QString &) const;
virtual void setCustomField(const QString &, const QString &);
virtual void removeCustomField(const QString &);
virtual bool operator == ( const Record &r ) const
{ return mUid == r.mUid; }
virtual bool operator != ( const Record &r ) const
{ return mUid != r.mUid; }
// convenience methods provided for loading and saving to xml
static QString idsToString( const QArray<int> &ids );
// convenience methods provided for loading and saving to xml
static QArray<int> idsFromString( const QString &str );
// for debugging
static void dump( const QMap<int, QString> &map );
protected:
virtual UidGen &uidGen() = 0;
virtual QString customToXml() const;
private:
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp
index 0fedfa8..2f33255 100644
--- a/library/datebookdb.cpp
+++ b/library/datebookdb.cpp
diff --git a/library/finddialog.cpp b/library/finddialog.cpp
index d9f430a..ddf41a7 100644
--- a/library/finddialog.cpp
+++ b/library/finddialog.cpp
@@ -1,78 +1,85 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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.
**
**********************************************************************/
// 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()
{
}
QString FindDialog::findText() const
{
return fw->findText();
}
void FindDialog::setUseDate( bool show )
{
fw->setUseDate( show );
}
void FindDialog::setDate( const QDate &dt )
{
fw->setDate( dt );
}
void FindDialog::slotNotFound()
{
fw->slotNotFound();
}
void FindDialog::slotWrapAround()
{
fw->slotWrapAround();
}
diff --git a/library/global.cpp b/library/global.cpp
index 68a3a75..ce39751 100644
--- a/library/global.cpp
+++ b/library/global.cpp
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c562f6c..2ef60d5 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -405,97 +405,97 @@ static void setTreble( int t = 0, int percent = -1 )
qpeDir() and documentDir() functions return the respective paths.
The grabKeyboard() and ungrabKeyboard() functions are used to
control whether the application takes control of the device's
physical buttons (e.g. application launch keys). The stylus' mode of
operation is set with setStylusOperation() and retrieved with
stylusOperation(). There are also setInputMethodHint() and
inputMethodHint() functions.
\ingroup qtopiaemb
*/
/*!
\fn void QPEApplication::clientMoused()
\internal
*/
/*!
\fn void QPEApplication::timeChanged();
This signal is emitted when the time changes outside the normal
passage of time, i.e. if the time is set backwards or forwards.
*/
/*!
\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:
\code
void MyWidget::receive( const QCString& msg, const QByteArray& data )
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "someMessage(int,int,int)" ) {
int a,b,c;
stream >> a >> b >> c;
...
} else if ( msg == "otherMessage(QString)" ) {
...
}
}
\endcode
\sa qcop.html
Note that messages received here may be processed by qpe application
and emitted as signals, such as flush() and reload().
*/
/*!
Constructs a QPEApplication just as you would construct
a QApplication, passing \a argc, \a argv, and \a t.
@@ -1723,84 +1723,85 @@ void QPEApplication::tryQuit()
*/
void QPEApplication::hideOrQuit()
{
processEvents();
// If we are a preloaded application we don't actually quit, so emit
// a System message indicating we're quasi-closing.
if ( d->preloaded && d->qpe_main_widget )
#ifndef QT_NO_COP
{
QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
e << d->appName;
d->qpe_main_widget->hide();
}
#endif
else
quit();
}
#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
// The libraries with the skiff package (and possibly others) have
// 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 ) {
QWidget * w = l->first();
while ( w ) {
if ( w->isVisible() && w->isMaximized() ) {
w->showMaximized();
}
w = l->next();
}
delete l;
}
}
#endif
#endif
diff --git a/library/storage.cpp b/library/storage.cpp
index f4c1c02..12f9df9 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -155,107 +155,107 @@ void StorageInfo::update()
removable = TRUE;
} else if ( disk.left(7) == "/dev/hd" )
humanname = tr("Hard Disk") + " " + disk;
else if ( disk.left(7) == "/dev/sd" )
humanname = tr("SCSI Hard Disk") + " " + disk;
else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs
humanname = tr("Internal Memory");
else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
humanname = tr("Internal Storage");
else if ( disk.left(14) == "/dev/mtdblock/" )
humanname = tr("Internal Storage") + " " + disk;
else if ( disk.left(13) == "/dev/mtdblock" )
humanname = tr("Internal Storage") + " " + disk;
else if ( disk.left(9) == "/dev/root" )
humanname = tr("Internal Storage") + " " + disk;
else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs
humanname = tr("Internal Memory");
FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts );
mFileSystems.append( fs );
}
emit disksChanged();
} else {
// just update them
for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
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()
{
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct statfs fs;
if ( !statfs( fspath.latin1(), &fs ) ) {
blkSize = fs.f_bsize;
totalBlks = fs.f_blocks;
availBlks = fs.f_bavail;
} else {
blkSize = 0;
totalBlks = 0;
availBlks = 0;
}
#endif
}