]> ruin.nu Git - adress.git/commitdiff
Initial revision
authorMichael Andreen <harv@ruin.nu>
Fri, 1 Dec 2000 18:19:12 +0000 (18:19 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 1 Dec 2000 18:19:12 +0000 (18:19 +0000)
12 files changed:
Makefile [new file with mode: 0644]
adress.pro [new file with mode: 0644]
contact.cpp [new file with mode: 0644]
contact.h [new file with mode: 0644]
file.cpp [new file with mode: 0644]
functions.h [new file with mode: 0644]
main.cpp [new file with mode: 0644]
mainwindow.cpp [new file with mode: 0644]
mainwindow.h [new file with mode: 0644]
ui/contactmodifyerbase.ui [new file with mode: 0644]
ui/mainwindowbase.ui [new file with mode: 0644]
ui/searchresultbase.ui [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..185dd6b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,179 @@
+#############################################################################
+# Makefile for building adress
+# Generated by tmake at 18:07, 2000/12/01
+#     Project: adress
+#    Template: app
+#############################################################################
+
+####### Compiler, tools and options
+
+CC     =       gcc
+CXX    =       g++
+CFLAGS =       -pipe -Wall -W -g3
+CXXFLAGS=      -pipe -Wall -W -g3
+INCPATH        =       -I$(QTDIR)/include
+LINK   =       g++
+LFLAGS =       
+LIBS   =       $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt -lXext -lX11 -lm
+MOC    =       $(QTDIR)/bin/moc
+UIC    =       $(QTDIR)/bin/uic
+
+TAR    =       tar -cf
+GZIP   =       gzip -9f
+
+####### Files
+
+HEADERS =      contact.h \
+               mainwindow.h
+SOURCES =      contact.cpp \
+               main.cpp \
+               mainwindow.cpp
+OBJECTS =      contact.o \
+               main.o \
+               mainwindow.o \
+               ui/contactmodifyerbase.o \
+               ui/mainwindowbase.o \
+               ui/searchresultbase.o
+INTERFACES =   ui/contactmodifyerbase.ui \
+               ui/mainwindowbase.ui \
+               ui/searchresultbase.ui
+UICDECLS =     ui/contactmodifyerbase.h \
+               ui/mainwindowbase.h \
+               ui/searchresultbase.h
+UICIMPLS =     ui/contactmodifyerbase.cpp \
+               ui/mainwindowbase.cpp \
+               ui/searchresultbase.cpp
+SRCMOC =       moc_mainwindow.cpp \
+               ui/moc_contactmodifyerbase.cpp \
+               ui/moc_mainwindowbase.cpp \
+               ui/moc_searchresultbase.cpp
+OBJMOC =       moc_mainwindow.o \
+               ui/moc_contactmodifyerbase.o \
+               ui/moc_mainwindowbase.o \
+               ui/moc_searchresultbase.o
+DIST   =       
+TARGET =       adress
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cxx.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.cc.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.C.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+.c.o:
+       $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+####### Build rules
+
+
+all: $(TARGET)
+
+$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) 
+       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
+
+moc: $(SRCMOC)
+
+tmake: Makefile
+
+Makefile: adress.pro
+       tmake adress.pro -o Makefile
+
+dist:
+       $(TAR) adress.tar adress.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
+       $(GZIP) adress.tar
+
+clean:
+       -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
+       -rm -f *~ core
+
+####### Sub-libraries
+
+
+###### Combined headers
+
+
+####### Compile
+
+contact.o: contact.cpp \
+               contact.h
+
+main.o: main.cpp \
+               mainwindow.h \
+               ui/mainwindowbase.h
+
+mainwindow.o: mainwindow.cpp \
+               mainwindow.h \
+               ui/mainwindowbase.h \
+               contact.h
+
+ui/contactmodifyerbase.h: ui/contactmodifyerbase.ui
+       $(UIC) ui/contactmodifyerbase.ui -o ui/contactmodifyerbase.h
+
+contactmodifyerbase.h: ui/contactmodifyerbase.ui
+       $(UIC) ui/contactmodifyerbase.ui -o contactmodifyerbase.h
+
+ui/contactmodifyerbase.cpp: ui/contactmodifyerbase.ui
+       $(UIC) ui/contactmodifyerbase.ui -i contactmodifyerbase.h -o ui/contactmodifyerbase.cpp
+
+ui/mainwindowbase.h: ui/mainwindowbase.ui
+       $(UIC) ui/mainwindowbase.ui -o ui/mainwindowbase.h
+
+mainwindowbase.h: ui/mainwindowbase.ui
+       $(UIC) ui/mainwindowbase.ui -o mainwindowbase.h
+
+ui/mainwindowbase.cpp: ui/mainwindowbase.ui
+       $(UIC) ui/mainwindowbase.ui -i mainwindowbase.h -o ui/mainwindowbase.cpp
+
+ui/searchresultbase.h: ui/searchresultbase.ui
+       $(UIC) ui/searchresultbase.ui -o ui/searchresultbase.h
+
+searchresultbase.h: ui/searchresultbase.ui
+       $(UIC) ui/searchresultbase.ui -o searchresultbase.h
+
+ui/searchresultbase.cpp: ui/searchresultbase.ui
+       $(UIC) ui/searchresultbase.ui -i searchresultbase.h -o ui/searchresultbase.cpp
+
+ui/contactmodifyerbase.o: ui/contactmodifyerbase.cpp \
+               ui/contactmodifyerbase.h
+
+ui/mainwindowbase.o: ui/mainwindowbase.cpp \
+               ui/mainwindowbase.h
+
+ui/searchresultbase.o: ui/searchresultbase.cpp \
+               ui/searchresultbase.h
+
+moc_mainwindow.o: moc_mainwindow.cpp \
+               mainwindow.h \
+               ui/mainwindowbase.h
+
+ui/moc_contactmodifyerbase.o: ui/moc_contactmodifyerbase.cpp \
+               ui/contactmodifyerbase.h
+
+ui/moc_mainwindowbase.o: ui/moc_mainwindowbase.cpp \
+               ui/mainwindowbase.h
+
+ui/moc_searchresultbase.o: ui/moc_searchresultbase.cpp \
+               ui/searchresultbase.h
+
+moc_mainwindow.cpp: mainwindow.h
+       $(MOC) mainwindow.h -o moc_mainwindow.cpp
+
+ui/moc_contactmodifyerbase.cpp: ui/contactmodifyerbase.h
+       $(MOC) ui/contactmodifyerbase.h -o ui/moc_contactmodifyerbase.cpp
+
+ui/moc_mainwindowbase.cpp: ui/mainwindowbase.h
+       $(MOC) ui/mainwindowbase.h -o ui/moc_mainwindowbase.cpp
+
+ui/moc_searchresultbase.cpp: ui/searchresultbase.h
+       $(MOC) ui/searchresultbase.h -o ui/moc_searchresultbase.cpp
+
diff --git a/adress.pro b/adress.pro
new file mode 100644 (file)
index 0000000..fd2afb6
--- /dev/null
@@ -0,0 +1,10 @@
+TEMPLATE       = app
+CONFIG         = qt warn_on debug
+HEADERS                = contact.h \
+                 mainwindow.h 
+SOURCES                = contact.cpp \
+                 main.cpp \
+                 mainwindow.cpp 
+INTERFACES     = ui/contactmodifyerbase.ui \
+                 ui/mainwindowbase.ui \
+                 ui/searchresultbase.ui
diff --git a/contact.cpp b/contact.cpp
new file mode 100644 (file)
index 0000000..acda66f
--- /dev/null
@@ -0,0 +1,202 @@
+#include "contact.h"
+#include <cctype>
+#include <cstring>
+#include <stl_algo.h>
+
+CContact* CContact::first = '\0';
+int CContact::num = 0;
+/*
+QString toLower(QString& s)
+{
+       QString st = s;
+       transform(st.begin(), st.end(), st.begin(), tolower);
+       return st;
+}*/
+
+
+CContact::CContact(QString &firstname, QString &lastname, QString &adress, QString &phonenumber)
+{
+       strings[0] = firstname;
+       strings[1] = lastname;
+       strings[2] = adress;
+       strings[3] = phonenumber;
+
+       num++;
+       next = '\0';
+       prev = '\0';
+       sort();
+       
+}
+
+CContact::~CContact()
+{
+       num--;
+       remove();
+}
+
+void CContact::remove()
+{
+       if (next != '\0' && prev != '\0')
+       {
+               next->prev = prev;
+               prev->next = next;
+       }
+       else if (next != '\0' && prev == '\0')
+       {
+               next->prev = '\0';
+               first = next;
+       }
+       else if (next == '\0' && prev != '\0')
+       {
+               prev->next = '\0';
+       }
+       else
+       {
+               first = '\0';
+       }
+       next = '\0';
+       prev = '\0';
+}
+       
+void CContact::sort()
+{
+       if (first == '\0')
+       {
+               first = this;
+               prev = '\0';
+               next = '\0';
+               return;
+       }
+       CContact* contact = first;
+       while (contact != '\0')
+       {
+               int test = strings[1].upper().compare(contact->strings[1].upper());
+               
+               if (test == 0)
+               {
+                       //int test2 = strcasecmp(strings[0].c_str(), contact->strings[0].c_str());
+                       int test2 = strings[0].upper().compare(contact->strings[0].upper());
+                       
+                       if (test2 < 0)
+                       {
+                               next = contact;
+                               if (first == contact)
+                               {
+                                       first = this;
+                                       prev = '\0';
+                                       contact->prev = this;
+                               }
+                               else
+                               {
+                                       prev = contact->prev;
+                                       prev->next = this;
+                                       contact->prev = this;
+                               }
+                               break;
+                       }
+               }
+       
+               if (test < 0)
+               {
+                       next = contact;
+                       if (first == contact)
+                       {
+                               first = this;
+                               prev = '\0';
+                               contact->prev = this;
+                       }
+                       else
+                       {
+                               prev = contact->prev;
+                               prev->next = this;
+                               contact->prev = this;
+                       }
+                       break;
+               }
+               if (contact->next == '\0')
+               {
+                       prev = contact;
+                       next = '\0';
+                       contact->next = this;
+
+                       break;
+               }
+       
+               contact = contact->next;
+       }
+}
+       
+//Some functions
+QString CContact::firstname()
+{
+       return strings[0];
+}
+
+QString CContact::lastname()
+{
+       return strings[1];
+}
+
+QString CContact::adress()
+{
+       return strings[2];
+}
+
+QString CContact::phoneNumber()
+{
+       return strings[3];
+}
+
+bool CContact::search(int i, QString s)
+{
+       if (i > 0 && i < 5)
+       {
+               //char* s1 = s.c_str();
+               int test = strings[i - 1 ].find(s,0,false );
+//             cout << strings[i - 1] << "\n" << s << "\n" << test << "\nTryck Enter";
+//             cin.get();
+               if (test == 0) //QString::npos) //4294967295)
+                       return true;
+               else
+                       return false;
+       }
+       else
+               return false;
+}
+
+void CContact::modify(int i, QString s)
+{
+       if (i > 0 && i < 5)
+       {
+//             cout << "Modifierar strängen " << i << " med namnet " << strings[0] << " \n";
+               strings[i - 1] = s;
+               if (i == 2)
+               {
+               //      cout << "Tar bort gammal konfiguration\n";
+                       remove();
+               //      cout << "Lägger till den på rätt plats+n";
+                       sort();
+               }
+       }
+}
+//Static functions
+CContact* CContact::getFirst()
+{
+       return first;
+}
+
+int CContact::getNum()
+{
+       return num;
+}
+
+
+CContact* CContact::getNext()
+{
+       return next;
+}
+
+CContact* CContact::getPrev()
+{
+       return prev;
+}
diff --git a/contact.h b/contact.h
new file mode 100644 (file)
index 0000000..3f16e26
--- /dev/null
+++ b/contact.h
@@ -0,0 +1,41 @@
+#ifndef __contacth__
+#define __contacth__
+
+#include <qstring.h>
+#include <algorithm>
+#include <cctype>
+
+class CContact
+{
+public:
+       CContact(QString &firstname, QString &lastname, QString &adress, QString &phonenumber);
+       ~CContact();
+
+       QString firstname();
+       QString lastname();
+       QString adress();
+       QString phoneNumber();
+       
+       bool search(int i, QString s);
+       void modify(int i, QString s);
+
+       //Static funktions
+       static CContact* getFirst();
+       static int getNum();
+
+       CContact* getNext();
+       CContact* getPrev();
+
+
+protected:
+       QString strings[4];
+                               
+       //Linked list
+       static CContact* first;
+       static int num;
+       CContact* next;
+       CContact* prev;
+       void sort();
+       void remove();
+};
+#endif
diff --git a/file.cpp b/file.cpp
new file mode 100644 (file)
index 0000000..86e57d1
--- /dev/null
+++ b/file.cpp
@@ -0,0 +1,44 @@
+#include <fstream>
+#include <string>
+#include "functions.h"
+#include <iostream>
+
+void load()
+{
+       ifstream in("/root/.adress");
+       
+       while (!in.eof())
+       {
+               string fname;
+               string lname;
+               string adr;
+               string pn;
+               getline(in, fname);
+//             cout << "Skapar " << fname << "\n";
+//             cin.get();
+               getline(in, lname);
+               getline(in, adr);
+               getline(in, pn);
+               if (fname == "" && lname == "" && lname == "" && pn == "")
+                       continue;
+               (void) new CContact(fname, lname, adr, pn);
+       }
+}
+
+void save()
+{
+       ofstream out;
+       out.open("/root/.adress");
+
+       CContact* contact = CContact::getFirst();
+
+       while ( contact != '\0')
+       {
+               out << contact->firstname() << "\n";
+               out << contact->lastname() << "\n";
+               out << contact->adress() << "\n";
+               out << contact->phoneNumber() << "\n";
+               contact=contact->getNext();
+       }
+       out.close();
+}
diff --git a/functions.h b/functions.h
new file mode 100644 (file)
index 0000000..afb6972
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __functions_h__
+#define __functions_h__
+#include "contact.h"
+
+void display();
+void add();
+void remove();
+void printContactInfo(int num, CContact* contact);
+void search();
+
+void save();
+void load();
+
+void modify();
+
+#endif
diff --git a/main.cpp b/main.cpp
new file mode 100644 (file)
index 0000000..89376c3
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,31 @@
+
+#include <qapplication.h>
+#include <qfont.h>
+#include <qstring.h>
+#include <qtextcodec.h>
+#include <qtranslator.h>
+
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+  QApplication a(argc, argv);
+  //a.setFont(QFont("helvetica", 12));
+  //QTranslator tor( 0 );
+  // set the location where your .qm files are in load() below as the last parameter instead of "."
+  // for development, use "/" to use the english original as
+  // .qm files are stored in the base project directory.
+  //tor.load( QString("|.") + QTextCodec::locale(), "." );
+  //a.installTranslator( &tor );
+  /* uncomment the following line, if you want a Windows 95 look*/
+  // a.setStyle(WindowsStyle);
+    
+  MainWindow* mw=new MainWindow();
+  a.setMainWidget(mw);
+
+  mw->show();
+
+  return a.exec();
+}
+
+
diff --git a/mainwindow.cpp b/mainwindow.cpp
new file mode 100644 (file)
index 0000000..34c431e
--- /dev/null
@@ -0,0 +1,103 @@
+#include "mainwindow.h"
+#include <qfile.h>
+#include <qfiledialog.h>
+#include <qtextstream.h>
+#include <qstring.h>
+#include <qlistview.h>
+#include "contact.h"
+#include <iostream>
+
+/* 
+ *  Constructs a MainWindow which is a child of 'parent', with the 
+ *  name 'name' and widget flags set to 'f' 
+ */
+MainWindow::MainWindow( QWidget* parent,  const char* name, WFlags fl )
+    : CMainWindowBase( parent, name, fl )
+{
+       //connect(LoadButton, SIGNAL(clicked()), SLOT(slotLoad()));
+}
+
+/*  
+ *  Destroys the object and frees any allocated resources
+ */
+MainWindow::~MainWindow()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/* 
+ * public slot
+ */
+void MainWindow::slotSave()
+{
+    qWarning( "MainWindow::slotSave() not yet implemented!" ); 
+}
+/* 
+ * public slot
+ */
+void MainWindow::slotAdd()
+{
+    qWarning( "MainWindow::slotAdd() not yet implemented!" ); 
+}
+/* 
+ * public slot
+ */
+void MainWindow::slotDel()
+{
+    qWarning( "MainWindow::slotDel() not yet implemented!" ); 
+}
+/* 
+ * public slot
+ */
+void MainWindow::slotLoad()
+{
+       QString filename(QFileDialog::getOpenFileName(0, "Adressfiler (*.adr)", this)); 
+       cout << "Funkar";
+       QFile f(filename);
+       if ( !f.open( IO_ReadOnly ) )
+                   return;
+       
+       QTextStream t(&f);
+
+       while (!t.eof())
+       {
+               QString fname = t.readLine();
+               QString lname = t.readLine();
+               QString adr             = t.readLine();
+               QString pn              = t.readLine();
+    if (fname == "" && lname == "" && lname == "" && pn == "")
+                             continue;
+               (void) new CContact(fname, lname, adr, pn);
+       }
+       updateView();
+}
+/* 
+ * public slot
+ */
+void MainWindow::slotSearch()
+{
+    qWarning( "MainWindow::slotSearch() not yet implemented!" ); 
+}
+
+
+/*
+ * This funtion puts all contacts in the listview
+ */
+void MainWindow::updateView()
+{
+       
+       ContactView->clear();
+
+       CContact* contact = CContact::getFirst();
+
+       int i = 1;
+       QString s;
+
+       while (contact != '\0')
+       {
+               s = i;
+               (void) new QListViewItem(ContactView, s, contact->lastname(), contact->firstname(), contact->adress(), contact->phoneNumber());
+               contact = contact->getNext();
+               i++;
+       }
+}
diff --git a/mainwindow.h b/mainwindow.h
new file mode 100644 (file)
index 0000000..4bb69de
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+#include "ui/mainwindowbase.h"
+
+class MainWindow : public CMainWindowBase
+{ 
+    Q_OBJECT
+
+public:
+    MainWindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+    ~MainWindow();
+
+public slots:
+    void slotSave();
+    void slotAdd();
+    void slotDel();
+    void slotLoad();
+    void slotSearch();
+
+protected:
+               void updateView();
+};
+
+#endif // MAINWINDOW_H
diff --git a/ui/contactmodifyerbase.ui b/ui/contactmodifyerbase.ui
new file mode 100644 (file)
index 0000000..47f8536
--- /dev/null
@@ -0,0 +1,263 @@
+<!DOCTYPE UI><UI>
+<class>ContactModifierBase</class>
+<author>Michael Andreen</author>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>MyDialog</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>538</width>
+            <height>201</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Lägg till kontakt</string>
+    </property>
+    <property stdset="1">
+        <name>sizeGripEnabled</name>
+        <bool>true</bool>
+    </property>
+    <grid>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <widget row="1"  column="0" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout10</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>buttonOk</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;OK</string>
+                    </property>
+                    <property stdset="1">
+                        <name>autoDefault</name>
+                        <bool>true</bool>
+                    </property>
+                    <property stdset="1">
+                        <name>default</name>
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer1</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property stdset="1">
+                        <name>sizeType</name>
+                        <enum>Expanding</enum>
+                    </property>
+                    <property>
+                        <name>sizeHint</name>
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>buttonCancel</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Cancel</string>
+                    </property>
+                    <property stdset="1">
+                        <name>autoDefault</name>
+                        <bool>true</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+        <widget row="0"  column="0" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout13</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout12</cstring>
+                    </property>
+                    <vbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QLabel</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>TextLabel1</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Förnamn</string>
+                            </property>
+                            <property>
+                                <name>buddy</name>
+                                <cstring>FirstnameLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLabel</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>TextLabel2</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Efternamn</string>
+                            </property>
+                            <property>
+                                <name>buddy</name>
+                                <cstring>LastnameLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLabel</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>TextLabel3</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Adress</string>
+                            </property>
+                            <property>
+                                <name>buddy</name>
+                                <cstring>AdressLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLabel</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>TextLabel4</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Telefonnummer</string>
+                            </property>
+                            <property>
+                                <name>buddy</name>
+                                <cstring>PhoneNumberLine</cstring>
+                            </property>
+                        </widget>
+                    </vbox>
+                </widget>
+                <widget>
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout11</cstring>
+                    </property>
+                    <vbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QLineEdit</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>FirstnameLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLineEdit</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>LastnameLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLineEdit</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>AdressLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLineEdit</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>PhoneNumberLine</cstring>
+                            </property>
+                        </widget>
+                    </vbox>
+                </widget>
+            </hbox>
+        </widget>
+    </grid>
+</widget>
+<connections>
+    <connection>
+        <sender>buttonOk</sender>
+        <signal>clicked()</signal>
+        <receiver>MyDialog</receiver>
+        <slot>accept()</slot>
+    </connection>
+    <connection>
+        <sender>buttonCancel</sender>
+        <signal>clicked()</signal>
+        <receiver>MyDialog</receiver>
+        <slot>reject()</slot>
+    </connection>
+</connections>
+</UI>
diff --git a/ui/mainwindowbase.ui b/ui/mainwindowbase.ui
new file mode 100644 (file)
index 0000000..dc56395
--- /dev/null
@@ -0,0 +1,385 @@
+<!DOCTYPE UI><UI>
+<class>CMainWindowBase</class>
+<author>Michael Andreen</author>
+<widget>
+    <class>QWidget</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>unnamed</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>542</width>
+            <height>398</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Form1</string>
+    </property>
+    <grid>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <widget row="0"  column="0" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout4</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QListView</class>
+                    <column>
+                        <property>
+                            <name>text</name>
+                            <string>Num</string>
+                        </property>
+                        <property>
+                            <name>clickable</name>
+                            <bool>true</bool>
+                        </property>
+                        <property>
+                            <name>resizeable</name>
+                            <bool>true</bool>
+                        </property>
+                    </column>
+                    <column>
+                        <property>
+                            <name>text</name>
+                            <string>Efternamn</string>
+                        </property>
+                        <property>
+                            <name>clickable</name>
+                            <bool>true</bool>
+                        </property>
+                        <property>
+                            <name>resizeable</name>
+                            <bool>true</bool>
+                        </property>
+                    </column>
+                    <column>
+                        <property>
+                            <name>text</name>
+                            <string>Förnamn</string>
+                        </property>
+                        <property>
+                            <name>clickable</name>
+                            <bool>true</bool>
+                        </property>
+                        <property>
+                            <name>resizeable</name>
+                            <bool>true</bool>
+                        </property>
+                    </column>
+                    <column>
+                        <property>
+                            <name>text</name>
+                            <string>Adress</string>
+                        </property>
+                        <property>
+                            <name>clickable</name>
+                            <bool>true</bool>
+                        </property>
+                        <property>
+                            <name>resizeable</name>
+                            <bool>true</bool>
+                        </property>
+                    </column>
+                    <column>
+                        <property>
+                            <name>text</name>
+                            <string>Telefonnummer</string>
+                        </property>
+                        <property>
+                            <name>clickable</name>
+                            <bool>true</bool>
+                        </property>
+                        <property>
+                            <name>resizeable</name>
+                            <bool>true</bool>
+                        </property>
+                    </column>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>ContactView</cstring>
+                    </property>
+                </widget>
+                <widget>
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout3</cstring>
+                    </property>
+                    <vbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QPushButton</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>LoadButton</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Ladda fil</string>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QPushButton</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>SaveButton</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Spara</string>
+                            </property>
+                        </widget>
+                        <spacer>
+                            <property>
+                                <name>name</name>
+                                <cstring>Spacer1</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>orientation</name>
+                                <enum>Vertical</enum>
+                            </property>
+                            <property stdset="1">
+                                <name>sizeType</name>
+                                <enum>Expanding</enum>
+                            </property>
+                            <property>
+                                <name>sizeHint</name>
+                                <size>
+                                    <width>20</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                        <widget>
+                            <class>QPushButton</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>AddButton</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Ny kontakt</string>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QPushButton</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>DelButton</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Ta bort</string>
+                            </property>
+                        </widget>
+                    </vbox>
+                </widget>
+            </hbox>
+        </widget>
+        <widget row="1"  column="0" >
+            <class>QGroupBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>GroupBox1</cstring>
+            </property>
+            <property stdset="1">
+                <name>title</name>
+                <string>GroupBox1</string>
+            </property>
+            <grid>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>11</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget row="0"  column="0" >
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout1</cstring>
+                    </property>
+                    <hbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QLabel</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>TextLabel1</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>Sök &amp;kategori:</string>
+                            </property>
+                            <property>
+                                <name>buddy</name>
+                                <cstring>SearchCombo</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QComboBox</class>
+                            <item>
+                                <property>
+                                    <name>text</name>
+                                    <string>Förnamn</string>
+                                </property>
+                            </item>
+                            <item>
+                                <property>
+                                    <name>text</name>
+                                    <string>Efternamn</string>
+                                </property>
+                            </item>
+                            <item>
+                                <property>
+                                    <name>text</name>
+                                    <string>Adress</string>
+                                </property>
+                            </item>
+                            <item>
+                                <property>
+                                    <name>text</name>
+                                    <string>Telefonnummer</string>
+                                </property>
+                            </item>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>SearchCombo</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QPushButton</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>SearchButton</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>S&amp;ök</string>
+                            </property>
+                            <property stdset="1">
+                                <name>default</name>
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </hbox>
+                </widget>
+                <widget row="1"  column="0" >
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout2</cstring>
+                    </property>
+                    <hbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QLabel</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>TextLabel2</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>Sök&amp;ord</string>
+                            </property>
+                            <property>
+                                <name>buddy</name>
+                                <cstring>SearchLine</cstring>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QLineEdit</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>SearchLine</cstring>
+                            </property>
+                        </widget>
+                    </hbox>
+                </widget>
+            </grid>
+        </widget>
+    </grid>
+</widget>
+<connections>
+    <connection>
+        <sender>LoadButton</sender>
+        <signal>clicked()</signal>
+        <receiver>unnamed</receiver>
+        <slot>slotLoad()</slot>
+    </connection>
+    <connection>
+        <sender>SaveButton</sender>
+        <signal>clicked()</signal>
+        <receiver>unnamed</receiver>
+        <slot>slotSave()</slot>
+    </connection>
+    <connection>
+        <sender>AddButton</sender>
+        <signal>clicked()</signal>
+        <receiver>unnamed</receiver>
+        <slot>slotAdd()</slot>
+    </connection>
+    <connection>
+        <sender>DelButton</sender>
+        <signal>clicked()</signal>
+        <receiver>unnamed</receiver>
+        <slot>slotDel()</slot>
+    </connection>
+    <connection>
+        <sender>SearchButton</sender>
+        <signal>clicked()</signal>
+        <receiver>unnamed</receiver>
+        <slot>slotSearch()</slot>
+    </connection>
+    <slot access="public">slotSave()</slot>
+    <slot access="public">slotAdd()</slot>
+    <slot access="public">slotDel()</slot>
+    <slot access="public">slotLoad()</slot>
+    <slot access="public">slotSearch()</slot>
+</connections>
+</UI>
diff --git a/ui/searchresultbase.ui b/ui/searchresultbase.ui
new file mode 100644 (file)
index 0000000..82b2394
--- /dev/null
@@ -0,0 +1,278 @@
+<!DOCTYPE UI><UI>
+<class>SearchResultBase</class>
+<author>Michael Andreen</author>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>MyDialog</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>515</width>
+            <height>286</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Sökresultat</string>
+    </property>
+    <property stdset="1">
+        <name>sizeGripEnabled</name>
+        <bool>true</bool>
+    </property>
+    <grid>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <widget row="0"  column="0" >
+            <class>QListView</class>
+            <column>
+                <property>
+                    <name>text</name>
+                    <string>Num</string>
+                </property>
+                <property>
+                    <name>clickable</name>
+                    <bool>true</bool>
+                </property>
+                <property>
+                    <name>resizeable</name>
+                    <bool>true</bool>
+                </property>
+            </column>
+            <column>
+                <property>
+                    <name>text</name>
+                    <string>Efternamn</string>
+                </property>
+                <property>
+                    <name>clickable</name>
+                    <bool>true</bool>
+                </property>
+                <property>
+                    <name>resizeable</name>
+                    <bool>true</bool>
+                </property>
+            </column>
+            <column>
+                <property>
+                    <name>text</name>
+                    <string>Förnamn</string>
+                </property>
+                <property>
+                    <name>clickable</name>
+                    <bool>true</bool>
+                </property>
+                <property>
+                    <name>resizeable</name>
+                    <bool>true</bool>
+                </property>
+            </column>
+            <column>
+                <property>
+                    <name>text</name>
+                    <string>Adress</string>
+                </property>
+                <property>
+                    <name>clickable</name>
+                    <bool>true</bool>
+                </property>
+                <property>
+                    <name>resizeable</name>
+                    <bool>true</bool>
+                </property>
+            </column>
+            <column>
+                <property>
+                    <name>text</name>
+                    <string>Telefonnummer</string>
+                </property>
+                <property>
+                    <name>clickable</name>
+                    <bool>true</bool>
+                </property>
+                <property>
+                    <name>resizeable</name>
+                    <bool>true</bool>
+                </property>
+            </column>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>ContactView</cstring>
+            </property>
+        </widget>
+        <widget row="2"  column="0" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout15</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>buttonOk</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;OK</string>
+                    </property>
+                    <property stdset="1">
+                        <name>autoDefault</name>
+                        <bool>true</bool>
+                    </property>
+                    <property stdset="1">
+                        <name>default</name>
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Horizontal Spacing2</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property stdset="1">
+                        <name>sizeType</name>
+                        <enum>Expanding</enum>
+                    </property>
+                    <property>
+                        <name>sizeHint</name>
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>buttonCancel</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Cancel</string>
+                    </property>
+                    <property stdset="1">
+                        <name>autoDefault</name>
+                        <bool>true</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+        <widget row="1"  column="0" >
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout17</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer3</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property stdset="1">
+                        <name>sizeType</name>
+                        <enum>Expanding</enum>
+                    </property>
+                    <property>
+                        <name>sizeHint</name>
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>DelButton</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Ta bort</string>
+                    </property>
+                </widget>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer4</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>orientation</name>
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property stdset="1">
+                        <name>sizeType</name>
+                        <enum>Expanding</enum>
+                    </property>
+                    <property>
+                        <name>sizeHint</name>
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+            </hbox>
+        </widget>
+    </grid>
+</widget>
+<connections>
+    <connection>
+        <sender>buttonOk</sender>
+        <signal>clicked()</signal>
+        <receiver>MyDialog</receiver>
+        <slot>accept()</slot>
+    </connection>
+    <connection>
+        <sender>buttonCancel</sender>
+        <signal>clicked()</signal>
+        <receiver>MyDialog</receiver>
+        <slot>reject()</slot>
+    </connection>
+    <connection>
+        <sender>DelButton</sender>
+        <signal>clicked()</signal>
+        <receiver>MyDialog</receiver>
+        <slot>slotDel()</slot>
+    </connection>
+    <slot access="public">slotDel()</slot>
+</connections>
+</UI>