Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference

phonebook.h

This is the verbatim text of the phonebook.h include file. It is provided only for illustration; the copyright remains with Trolltech.


/**********************************************************************
** Copyright (C) 2000-2005 Trolltech AS.  All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** Licensees holding a valid license agreement from Trolltech or any of its
** authorized distributors may use this file in accordance with
** the License Agreement provided with the Licensed Software.
**
** 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/pricing.html or email sales@trolltech.com for
**   information about Trolltech's Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef PHONEBOOK_H
#define PHONEBOOK_H


#include "phone.h"


#include <qstringlist.h>
#include <qvaluelist.h>


class PhoneBookPrivate;
class QDataStream;


class PhoneBookEntry
{
public:
    PhoneBookEntry() { _index = 0; }
    ~PhoneBookEntry() {}

    //methods to satisfy qvaluelist
    PhoneBookEntry( const PhoneBookEntry &other )
    {
	_index = other._index;
	_number = other._number;
	_text = other._text;
    }

    PhoneBookEntry &operator=( const PhoneBookEntry &other )
    {
	_index = other._index;
	_number = other._number;
	_text = other._text;
	return *this;
    }

    bool operator==( const PhoneBookEntry &other )
    {
	return _index == other._index;
    }

    uint index() const { return _index; }
    void setIndex( uint value ) { _index = value; }

    QString number() const { return _number; }
    void setNumber( const QString& value ) { _number = value; }

    QString text() const { return _text; }
    void setText( const QString& value ) { _text = value; }

private:
    uint _index;
    QString _number;
    QString _text;
};


QDataStream &operator>>( QDataStream&, PhoneBookEntry& );
QDataStream &operator<<( QDataStream&, const PhoneBookEntry& );


class PhoneBook : public QObject
{
    Q_OBJECT
    friend class PhoneLine;
    friend class PhoneLinePrivate;

private:
    PhoneBook( PhoneBookPrivate *d, QObject *parent );
    ~PhoneBook();

public:

    PhoneLine& line() const;

    void getEntries( const QString& store = "SM" );

    void add( const QString& number, const QString& text, const QString& store = "SM", bool flush = TRUE );

    void remove( uint index, const QString& store = "SM", bool flush = TRUE );

    void update( uint index, const QString& number, const QString& text, const QString& store = "SM", bool flush = TRUE );

    void flush( const QString& store = "SM" );

    void setPassword( const QString& store, const QString& passwd );
    void clearPassword( const QString& store );

signals:
    void entries( const PhoneLine& line, const QString& store, const QValueList<PhoneBookEntry>& list );

private:
    PhoneBookPrivate *d;
};


#endif // PHONEBOOK_H


Copyright © 2005 Trolltech Trademarks
Qtopia version 2.2.0