gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS: knokiisync/knokiisync namesdlg.cpp, NONE, 1.1 namesdlg.h, NONE, 1.1


From: Dimitris Stasinopoulos <address@hidden>
Subject: CVS: knokiisync/knokiisync namesdlg.cpp, NONE, 1.1 namesdlg.h, NONE, 1.1 namesdlg.ui, NONE, 1.1 namesdlg.ui.h, NONE, 1.1 overridenab.cpp, NONE, 1.1 overridenab.h, NONE, 1.1 Makefile.am, 1.4, 1.5 Makefile.in, 1.9, 1.10 addresseedlg.cpp, 1.4, 1.5 addresseedlg.h, 1.4, 1.5 addresseedlg.ui, 1.3, 1.4 addresseedlg.ui.h, 1.3, 1.4 conf_dialog.cpp, 1.6, 1.7 conf_dialog.h, 1.6, 1.7 conf_dialog.ui, 1.5, 1.6 conf_dialog.ui.h, 1.5, 1.6 knokiisync.cpp, 1.3, 1.4 knokiisync.h, 1.1.1.1, 1.2 syncview.cpp, 1.6, 1.7 syncview.h, 1.6, 1.7 syncview.ui, 1.5, 1.6 syncview.ui.h, 1.13, 1.14
Date: Mon, 18 Aug 2003 04:13:19 -0400

Update of /cvsroot/gnokii/knokiisync/knokiisync
In directory subversions:/tmp/cvs-serv13522/knokiisync

Modified Files:
        Makefile.am Makefile.in addresseedlg.cpp addresseedlg.h 
        addresseedlg.ui addresseedlg.ui.h conf_dialog.cpp 
        conf_dialog.h conf_dialog.ui conf_dialog.ui.h knokiisync.cpp 
        knokiisync.h syncview.cpp syncview.h syncview.ui syncview.ui.h 
Added Files:
        namesdlg.cpp namesdlg.h namesdlg.ui namesdlg.ui.h 
        overridenab.cpp overridenab.h 
Log Message:
Many, many changes. See the Changelog.

***** Error reading new file: [Errno 2] No such file or directory: 
'namesdlg.cpp'
***** Error reading new file: [Errno 2] No such file or directory: 'namesdlg.h'
--- NEW FILE ---
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>NamesDialog</class>
<widget class="QDialog">
    <property name="name">
        <cstring>NamesDialog</cstring>
    </property>
    <property name="geometry">
        <rect>
            <x>0</x>
            <y>0</y>
            <width>419</width>
            <height>279</height>
        </rect>
    </property>
    <property name="caption">
        <string>Select names</string>
    </property>
    <widget class="QFrame">
        <property name="name">
            <cstring>frame3</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>10</x>
                <y>10</y>
                <width>400</width>
                <height>50</height>
            </rect>
        </property>
        <property name="frameShape">
            <enum>StyledPanel</enum>
        </property>
        <property name="frameShadow">
            <enum>Raised</enum>
        </property>
        <widget class="QComboBox">
            <property name="name">
                <cstring>nameCB1</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>171</x>
                    <y>10</y>
                    <width>220</width>
                    <height>30</height>
                </rect>
            </property>
        </widget>
        <widget class="QComboBox">
            <item>
                <property name="text">
                    <string>Name</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string>Surname</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string>Additional Name</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string></string>
                </property>
            </item>
            <property name="name">
                <cstring>typeCB1</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>10</x>
                    <y>10</y>
                    <width>150</width>
                    <height>30</height>
                </rect>
            </property>
        </widget>
    </widget>
    <widget class="QFrame">
        <property name="name">
            <cstring>frame3_2</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>10</x>
                <y>60</y>
                <width>400</width>
                <height>50</height>
            </rect>
        </property>
        <property name="frameShape">
            <enum>StyledPanel</enum>
        </property>
        <property name="frameShadow">
            <enum>Raised</enum>
        </property>
        <widget class="QComboBox">
            <item>
                <property name="text">
                    <string>Name</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string>Surname</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string>Additional Name</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string></string>
                </property>
            </item>
            <property name="name">
                <cstring>typeCB2</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>10</x>
                    <y>10</y>
                    <width>150</width>
                    <height>30</height>
                </rect>
            </property>
        </widget>
        <widget class="QComboBox">
            <property name="name">
                <cstring>nameCB2</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>171</x>
                    <y>10</y>
                    <width>220</width>
                    <height>30</height>
                </rect>
            </property>
        </widget>
    </widget>
    <widget class="QFrame">
        <property name="name">
            <cstring>frame3_2_2</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>10</x>
                <y>110</y>
                <width>400</width>
                <height>50</height>
            </rect>
        </property>
        <property name="frameShape">
            <enum>StyledPanel</enum>
        </property>
        <property name="frameShadow">
            <enum>Raised</enum>
        </property>
        <widget class="QComboBox">
            <item>
                <property name="text">
                    <string>Name</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string>Surname</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string>Additional Name</string>
                </property>
            </item>
            <item>
                <property name="text">
                    <string></string>
                </property>
            </item>
            <property name="name">
                <cstring>typeCB3</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>10</x>
                    <y>10</y>
                    <width>150</width>
                    <height>30</height>
                </rect>
            </property>
        </widget>
        <widget class="QComboBox">
            <property name="name">
                <cstring>nameCB3</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>171</x>
                    <y>10</y>
                    <width>220</width>
                    <height>30</height>
                </rect>
            </property>
        </widget>
    </widget>
    <widget class="QPushButton">
        <property name="name">
            <cstring>OKButton</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>30</x>
                <y>240</y>
                <width>140</width>
                <height>30</height>
            </rect>
        </property>
        <property name="text">
            <string>OK</string>
        </property>
    </widget>
    <widget class="QPushButton">
        <property name="name">
            <cstring>cancelButton</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>250</x>
                <y>240</y>
                <width>140</width>
                <height>30</height>
            </rect>
        </property>
        <property name="text">
            <string>Cancel</string>
        </property>
    </widget>
    <widget class="QLabel">
        <property name="name">
            <cstring>textLabel1</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>10</x>
                <y>170</y>
                <width>161</width>
                <height>25</height>
            </rect>
        </property>
        <property name="text">
            <string>Formatted Name:</string>
        </property>
    </widget>
    <widget class="QLineEdit">
        <property name="name">
            <cstring>frmtNameLE</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>180</x>
                <y>170</y>
                <width>220</width>
                <height>25</height>
            </rect>
        </property>
    </widget>
    <widget class="QCheckBox">
        <property name="name">
            <cstring>rememberChkBox</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>90</x>
                <y>210</y>
                <width>240</width>
                <height>21</height>
            </rect>
        </property>
        <property name="text">
            <string>Remember this contact the next time</string>
        </property>
    </widget>
</widget>
<connections>
    <connection>
        <sender>OKButton</sender>
        <signal>clicked()</signal>
        <receiver>NamesDialog</receiver>
        <slot>OKButtonClicked()</slot>
    </connection>
    <connection>
        <sender>cancelButton</sender>
        <signal>clicked()</signal>
        <receiver>NamesDialog</receiver>
        <slot>cancelButtonClicked()</slot>
    </connection>
    <connection>
        <sender>typeCB1</sender>
        <signal>activated(const QString&amp;)</signal>
        <receiver>NamesDialog</receiver>
        <slot>typeCB1Changed(const QString&amp;)</slot>
    </connection>
    <connection>
        <sender>typeCB2</sender>
        <signal>activated(const QString&amp;)</signal>
        <receiver>NamesDialog</receiver>
        <slot>typeCB2Changed(const QString&amp;)</slot>
    </connection>
    <connection>
        <sender>typeCB3</sender>
        <signal>activated(const QString&amp;)</signal>
        <receiver>NamesDialog</receiver>
        <slot>typeCB3Changed(const QString&amp;)</slot>
    </connection>
</connections>
<includes>
    <include location="global" impldecl="in 
declaration">kabc/addressee.h</include>
    <include location="local" impldecl="in 
implementation">namesdlg.ui.h</include>
</includes>
<variables>
    <variable access="public">KABC::Addressee * curAddressee;</variable>
    <variable access="private">QPtrList&lt;QComboBox&gt; typesList;</variable>
    <variable access="private">QPtrList&lt;QComboBox&gt; namesList;</variable>
    <variable access="private">QStringList mNames;</variable>
    <variable access="private">QStringList mTypes;</variable>
</variables>
<signals>
    <signal>OKClicked()</signal>
    <signal>cancelClicked()</signal>
</signals>
<slots>
    <slot specifier="non virtual">init()</slot>
    <slot specifier="non virtual">askName(KABC::Addressee * addressee, QString 
separator)</slot>
    <slot specifier="non virtual">OKButtonClicked()</slot>
    <slot specifier="non virtual">cancelButtonClicked()</slot>
    <slot specifier="non virtual">clear()</slot>
    <slot specifier="non virtual">typeCB1Changed(const QString &amp; 
type)</slot>
    <slot specifier="non virtual">typeCB2Changed(const QString &amp; 
type)</slot>
    <slot specifier="non virtual">typeCB3Changed(const QString &amp; 
type)</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

--- NEW FILE ---
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>

void
NamesDialog::init ()
{
        curAddressee = 0;

        typesList.append (typeCB1);
        typesList.append (typeCB2);
        typesList.append (typeCB3);

        namesList.append (nameCB1);
        namesList.append (nameCB2);
        namesList.append (nameCB3);

        nameCB1->setEditable (TRUE);
        nameCB2->setEditable (TRUE);
        nameCB3->setEditable (TRUE);

        typeCB1->clear();
        typeCB2->clear();
        typeCB3->clear();

        mTypes.append ( "");
        mTypes.append (i18n ("Name"));
        mTypes.append (i18n ("Surname"));
        mTypes.append (i18n ("Additional Name"));

        typeCB1->insertStringList (mTypes, 0);
        typeCB2->insertStringList (mTypes, 0);
        typeCB3->insertStringList (mTypes, 0);

        mTypes.remove ( "");

        rememberChkBox->setChecked (TRUE);
}

void
NamesDialog::askName (KABC::Addressee * addressee, QString separator)
{
        QString tmp;
        QStringList names;
        QComboBox * nqcb = 0, * tqcb = 0;

        curAddressee = addressee;

        tmp = addressee->custom ("KnokiiSync", "E_NAMEINPHONE");
        names = QStringList::split (separator, tmp);

        QStringList::Iterator nIt = names.begin ();
        QPtrListIterator<QComboBox> tqcbIt (typesList);
        QPtrListIterator<QComboBox> nqcbIt (namesList);

        frmtNameLE->setText (tmp);

        while ((nqcb = nqcbIt.current()) != 0 && (tqcb = tqcbIt.current()) != 0)
                {
                        ++tqcbIt;
                        ++nqcbIt;

                        if (nIt != names.end ())
                                {
                                        nqcb->insertStringList (names);
                                        nqcb->setCurrentText (*nIt);

                                        ++nIt;
                                }
                        else
                                {
                                        tqcb->setEnabled (FALSE);
                                        nqcb->setEnabled (FALSE);
                                        break;
                                }
                }
        show ();
}

void
NamesDialog::OKButtonClicked ()
{
        QComboBox * nqcb = 0, * tqcb = 0;
        QPtrListIterator<QComboBox> tqcbIt (typesList);
        QPtrListIterator<QComboBox> nqcbIt (namesList);

        QString formattedName = frmtNameLE->text ();
        if (formattedName != "")
                curAddressee->setFormattedName (formattedName);
        else
                {
                        int reply = KMessageBox::warningYesNo (0, i18n ("You 
have not set a formatted name for this contact. If you do not do so, you will 
not be able to upload this contact to the phone. Do you wish to go back and set 
a formatted name?"));
                        if (reply == KMessageBox::Yes)
                                return;
                }

        while ((nqcb = nqcbIt.current ()) != 0 && (tqcb = tqcbIt.current ()) != 
0)
                {
                        ++tqcbIt;
                        ++nqcbIt;

                        if (tqcb->isEnabled () == FALSE)
                                break;

                        if (tqcb->currentText () == i18n ("Name"))
                                {
                                        curAddressee->setGivenName 
(nqcb->currentText ());
                                        curAddressee->insertCustom 
("KnokiiSync", "E_NAME_OV", "1");
                                }
                        else
                                if (tqcb->currentText () == i18n ("Surname"))
                                        {
                                                curAddressee->setFamilyName 
(nqcb->currentText ());
                                                curAddressee->insertCustom 
("KnokiiSync", "E_SURNAME_OV", "1");
                                        }
                                else
                                        if (tqcb->currentText () == i18n 
("Additional Name"))
                                                {
                                                        
curAddressee->setAdditionalName (nqcb->currentText ());
                                                        
curAddressee->insertCustom ("KnokiiSync", "E_ADDNAME_OV", "1");
                                                }
                }

        if (rememberChkBox->isChecked ())
                curAddressee->insertCustom ("KnokiiSync", "E_REMEMBER", "1");

        hide ();
        emit OKClicked ();
}

void
NamesDialog::cancelButtonClicked ()
{
        hide ();
        emit cancelClicked ();
}

void
NamesDialog::clear ()
{
        nameCB1->clear ();
        nameCB2->clear ();
        nameCB3->clear ();
}


void
NamesDialog::typeCB1Changed (const QString & type)
{
        int count = 0;
        QStringList types = mTypes;
        QString currentText;

        if (type != "")
                {
                        count = typeCB2->count ();
                        for (int i = 0; i < count; i++)
                                {
                                        if (typeCB2->text (i) == type)
                                                {
                                                        typeCB2->removeItem (i);
                                                        break;
                                                }
                                }
                        count = typeCB3->count ();
                        for (int i = 0; i < count; i++)
                                {
                                        if (typeCB3->text (i) == type)
                                                {
                                                        typeCB3->removeItem (i);
                                                        break;
                                                }
                                }
                }
        else
                {
                        types.remove (typeCB2->currentText ());
                        types.remove (typeCB3->currentText ());

                        typeCB1->clear ();
                        typeCB1->insertItem ("", 0);
                        typeCB1->insertStringList (types, 1);

                        currentText = typeCB2->currentText ();
                        typeCB2->clear ();
                        typeCB2->insertItem ("", 0);
                        typeCB2->insertItem ("", 0);
                        typeCB2->insertStringList (types, 1);
                        typeCB2->setCurrentText (currentText);

                        currentText = typeCB3->currentText ();
                        typeCB3->clear ();
                        typeCB3->insertItem ("", 0);
                        typeCB3->insertItem ("", 0);
                        typeCB3->insertStringList (types, 1);
                        typeCB3->setCurrentText (currentText);
                }
}

void
NamesDialog::typeCB2Changed (const QString & type)
{
        int count = 0;
        QStringList types = mTypes;
        QString currentText;

        if (type != "")
                {
                        count = typeCB1->count ();
                        for (int i = 0; i < count; i++)
                                {
                                        if (typeCB1->text (i) == type)
                                                {
                                                        typeCB1->removeItem (i);
                                                        break;
                                                }
                                }
                        count = typeCB3->count ();
                        for (int i = 0; i < count; i++)
                                {
                                        if (typeCB3->text (i) == type)
                                                {
                                                        typeCB3->removeItem (i);
                                                        break;
                                                }
                                }
                }
        else
                {
                        types.remove (typeCB1->currentText ());
                        types.remove (typeCB3->currentText ());

                        typeCB2->clear ();
                        typeCB2->insertItem ("", 0);
                        typeCB2->insertStringList (types, 1);

                        currentText = typeCB1->currentText ();
                        typeCB1->clear ();
                        typeCB1->insertItem ("", 0);
                        typeCB1->insertItem ("", 0);
                        typeCB1->insertStringList (types, 1);
                        typeCB1->setCurrentText (currentText);

                        currentText = typeCB3->currentText ();
                        typeCB3->clear ();
                        typeCB3->insertItem ("", 0);
                        typeCB3->insertItem ("", 0);
                        typeCB3->insertStringList (types, 1);
                        typeCB3->setCurrentText (currentText);
                }
}

void
NamesDialog::typeCB3Changed (const QString & type)
{
        int count = 0;
        QStringList types = mTypes;
        QString currentText;

        if (type != "")
                {
                        count = typeCB1->count ();
                        for (int i = 0; i < count; i++)
                                {
                                        if (typeCB1->text (i) == type)
                                                {
                                                        typeCB1->removeItem (i);
                                                        break;
                                                }
                                }
                        count = typeCB2->count ();
                        for (int i = 0; i < count; i++)
                                {
                                        if (typeCB2->text (i) == type)
                                                {
                                                        typeCB2->removeItem (i);
                                                        break;
                                                }
                                }
                }
        else
                {
                        types.remove (typeCB1->currentText ());
                        types.remove (typeCB2->currentText ());

                        typeCB3->clear ();
                        typeCB3->insertItem ("", 0);
                        typeCB3->insertStringList (types, 1);

                        currentText = typeCB1->currentText ();
                        typeCB1->clear ();
                        typeCB1->insertItem ("", 0);
                        typeCB1->insertItem ("", 0);
                        typeCB1->insertStringList (types, 1);
                        typeCB1->setCurrentText (currentText);

                        currentText = typeCB2->currentText ();
                        typeCB2->clear ();
                        typeCB2->insertItem ("", 0);
                        typeCB2->insertItem ("", 0);
                        typeCB2->insertStringList (types, 1);
                        typeCB2->setCurrentText (currentText);
                }
}

--- NEW FILE ---
#include "overridenab.h"

#include <kabc/resource.h>
#include <kstandarddirs.h>
#include <kabc/resourcefile.h>
#include <kabc/vcardformatplugin.h>

bool
OverridenAB::saveAddrBook ()
{
        KABC::Resource *resource = 0;
        QPtrList<KABC::Resource> list;

        deleteRemovedAddressees ();

        list = this->resources ();
        resource = list.at (0);
        KABC::Ticket * ticket = this->requestSaveTicket (resource);
        if (!ticket || !this->save (ticket))
                return false;
        else
                return true;
}

void
OverridenAB::setIMEI (QString IMEI)
{
        QString overridenABFile = locateLocal ("data", 
"knokiisync/"+IMEI+".vcf");
        KABC::Resource * resource = new KABC::ResourceFile (this, 
overridenABFile, new KABC::VCardFormatPlugin);
        resource->setReadOnly (false);
        resource->setFastResource (true);

        if (!addResource (resource))
                delete resource;

        setStandardResource (resource);
}

OverridenAB::OverridenAB ()
{
}

OverridenAB::OverridenAB (QString IMEI)
{
        QString overridenABFile = locateLocal ("data", 
"knokiisync/"+IMEI+".vcf");
        KABC::Resource * resource = new KABC::ResourceFile (this, 
overridenABFile, new KABC::VCardFormatPlugin);
        resource->setReadOnly (false);
        resource->setFastResource (true);

        if (!addResource (resource))
                delete resource;

        setStandardResource (resource);
        load ();
}

OverridenAB::~OverridenAB ()
{
}

--- NEW FILE ---
#include <kabc/addressbook.h>

class OverridenAB : public KABC::AddressBook
{
        public:
                bool saveAddrBook ();
                void setIMEI (QString IMEI);

                OverridenAB ();
                OverridenAB (QString IMEI);
                ~OverridenAB ();
};

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---

--- Diff text surpressed ---





reply via email to

[Prev in Thread] Current Thread [Next in Thread]