From e0f970005a87f2c542be7cca46b14fda3282d1bb Mon Sep 17 00:00:00 2001 From: chris2511 Date: Tue, 5 Aug 2003 18:45:30 +0000 Subject: [PATCH] import of multiple items of 1 type implemented --- Makefile.in | 5 ++-- widgets/MainWindow.cpp | 58 +++++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6b506318..3cbf4f99 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,6 +26,7 @@ OBJS=ui/ui.o widgets/widgets.o view/view.o lib/libpki.o SUBDIRS=ui lib widgets view all: $(SUBDIRS) xca +re: clean all xca: $(OBJS) $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o xca @@ -49,8 +50,8 @@ distclean: clean dist: test ! -z "$(TVERSION)" - rm -rf $(TARGET) - cvs export -r $(TAG) -d $(TARGET) xca && \ + #rm -rf $(TARGET) + #cvs export -r $(TAG) -d $(TARGET) xca && (cd $(TARGET) && autoconf && \ ./mkxcapro.sh && lrelease xca.pro && \ cat rpm/xca.spec |sed s/VERSION/$(TVERSION)/g >rpm/$(TARGET)-1.spec && \ diff --git a/widgets/MainWindow.cpp b/widgets/MainWindow.cpp index 44b42a5e..2e652763 100644 --- a/widgets/MainWindow.cpp +++ b/widgets/MainWindow.cpp @@ -200,8 +200,15 @@ void MainWindow::read_cmdline() { int cnt = 1; char *arg = NULL; - pki_base *item; + pki_base *item = NULL; load_base *lb = NULL; + load_cert *lc = new load_cert(); + load_req *lr = new load_req(); + load_key *lk = new load_key(); + load_pkcs12 *lp12 = new load_pkcs12(); + load_pkcs7 *lp7 = new load_pkcs7(); + load_crl *lcr = new load_crl(); + load_temp *lt = new load_temp(); exitApp = 0; ImportMulti *dlgi = NULL; @@ -211,25 +218,25 @@ void MainWindow::read_cmdline() arg = qApp->argv()[cnt]; if (arg[0] == '-') { // option switch (arg[1]) { - case 'c' : lb = new load_cert(); + case 'c' : lb = lc; exitApp =1; break; - case 'r' : lb = new load_req(); + case 'r' : lb = lr; exitApp =1; break; - case 'k' : lb = new load_key(); + case 'k' : lb = lk; exitApp =1; break; - case 'p' : lb = new load_pkcs12(); + case 'p' : lb = lp12; exitApp =1; break; - case '7' : lb = new load_pkcs7(); + case '7' : lb = lp7; exitApp =1; break; - case 'l' : lb = new load_crl(); + case 'l' : lb = lcr; exitApp =1; break; - case 't' : lb = new load_temp(); + case 't' : lb = lt; exitApp =1; break; case 'v' : printf("%s Version %s\n", @@ -250,31 +257,30 @@ void MainWindow::read_cmdline() arg=qApp->argv()[cnt]; } } - try { - if (lb != NULL) { - try { - item = lb->loadItem(arg); - } - catch (errorEx &err) { - Error(err); - if (item) { - delete item; - item = NULL; - } - } + if (lb) { + try { + item = lb->loadItem(arg); dlgi->addItem(item); - delete lb; - lb = NULL; } - } - - catch (errorEx &err) { - Error(err); + catch (errorEx &err) { + Error(err); + if (item) { + delete item; + item = NULL; + } + } } cnt++; } dlgi->execute(); delete dlgi; + delete lt; + delete lcr; + delete lp7; + delete lp12; + delete lk; + delete lr; + delete lc; }