X-Git-Url: https://ruin.nu/git/?p=adress.git;a=blobdiff_plain;f=mainwindow.cpp;h=ce83c8cae5d1f6b7baa8638b04c60dfe53cb3476;hp=68afb4353941166251e07141d5a7e1ec3d0c1127;hb=1197b29fa2d68f604352fe6eef3e9776a63bb87b;hpb=47556496969ef4c98f36d54c0dd1eac44d2d6caf diff --git a/mainwindow.cpp b/mainwindow.cpp index 68afb43..ce83c8c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,10 +1,4 @@ #include "mainwindow.h" -#include -#include -#include -#include -#include -#include "contact.h" #include /* BRÖÖL @@ -14,7 +8,6 @@ MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) : CMainWindowBase( parent, name, fl ) { - slotLoad(); } /* @@ -30,13 +23,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 +70,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()) @@ -101,7 +103,7 @@ void MainWindow::slotSearch() qWarning( "MainWindow::slotSearch() not yet implemented!" ); } -void slotModify(QListViewItem* lvi) +void MainWindow::slotModify(QListViewItem* lvi) { qWarning( "MainWindow::slotModif(QListViewItem*) not yet implemented!" ); }