*** empty log message ***
authorMichael Andreen <harv@ruin.nu>
Sat, 2 Dec 2000 14:19:11 +0000 (14:19 +0000)
committerMichael Andreen <harv@ruin.nu>
Sat, 2 Dec 2000 14:19:11 +0000 (14:19 +0000)
functions.h [deleted file]
mainwindow.cpp
mainwindow.h

diff --git a/functions.h b/functions.h
deleted file mode 100644 (file)
index afb6972..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#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
index 68afb43..4552b94 100644 (file)
@@ -1,10 +1,4 @@
 #include "mainwindow.h"
-#include <qfile.h>
-#include <qfiledialog.h>
-#include <qtextstream.h>
-#include <qstring.h>
-#include <qlistview.h>
-#include "contact.h"
 #include <iostream>
 
 /* BRÖÖL
@@ -30,13 +24,19 @@ MainWindow::~MainWindow()
  */
 void MainWindow::slotSave()
 {
-       if (filename == "")
-               return;
+       if (filename.isNull())
+       {
+               filename = QFileDialog::getSaveFileName( 0, "Adresslista (*.adr)");
+               if (filename.isNull())
+               {
+                       return;
+               }
+       }                     
 
        QFile f(filename);
 
        if ( !f.open( IO_WriteOnly ) )
-                   return false;
+                   return;
              
        QTextStream t(&f);
        QString s;
@@ -71,14 +71,17 @@ void MainWindow::slotDel()
  */
 void MainWindow::slotLoad()
 {
-       slotSave();
+       filename = QFileDialog::getOpenFileName(0, "Adressfiler (*.adr)", this); 
+
        QFile f(filename);
-       do
+       if ( !f.open( IO_ReadOnly ) )
+               return;
+                       
+       while (CContact::getNum() != 0)
        {
-               filename(QFileDialog::getOpenFileName(0, "Adressfiler (*.adr)", this)); 
+               delete CContact::getFirst();
        }
-       while ( !f.open( IO_ReadOnly ) );
-                       
+       
        QTextStream t(&f);
 
        while (!t.eof())
index 8eca343..2a65fe3 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 #include "ui/mainwindowbase.h"
+#include <qfile.h>
+#include <qfiledialog.h>
+#include <qtextstream.h>
+#include <qstring.h>
+#include <qlistview.h>
+#include "contact.h"
 
 class MainWindow : public CMainWindowBase
 {