Hello community, here is the log from the commit of package sumf checked in at Thu Sep 28 20:45:46 CEST 2006. -------- --- sumf/sumf.changes 2006-08-11 12:30:58.000000000 +0200 +++ /mounts/work_src_done/STABLE/sumf/sumf.changes 2006-09-28 16:13:28.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Sep 28 14:32:19 CEST 2006 - hschaa@suse.de + +- update to 0.2.3 + * added new dialog for backup management + +------------------------------------------------------------------- Old: ---- sumf-0.2.1.tar.bz2 New: ---- sumf-0.2.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sumf.spec ++++++ --- /var/tmp/diff_new_pack.GhmoDa/_old 2006-09-28 20:45:16.000000000 +0200 +++ /var/tmp/diff_new_pack.GhmoDa/_new 2006-09-28 20:45:17.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package sumf (Version 0.2.1) +# spec file for package sumf (Version 0.2.3) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -14,8 +14,8 @@ BuildRequires: intltool kscpm perl-XML-Parser qt3-devel scpm-devel update-desktop-files URL: http://forge.novell.com/modules/xfmod/project/?scpm Summary: SCPM Universal Management Front-End -Version: 0.2.1 -Release: 20 +Version: 0.2.3 +Release: 1 Group: System/Management License: GPL Source: sumf-%{version}.tar.bz2 @@ -61,6 +61,9 @@ test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT %changelog -n sumf +* Thu Sep 28 2006 - hschaa@suse.de +- update to 0.2.3 + * added new dialog for backup management * Fri Aug 11 2006 - jg@suse.de - disabled unmaintaned Ukrainian translations - fixed some missing Asian translation strings (bug 179143) ++++++ sumf-0.2.1.tar.bz2 -> sumf-0.2.3.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/ChangeLog new/sumf-0.2.3/ChangeLog --- old/sumf-0.2.1/ChangeLog 2006-06-02 16:22:04.000000000 +0200 +++ new/sumf-0.2.3/ChangeLog 2006-09-28 14:24:44.000000000 +0200 @@ -1,3 +1,6 @@ +0.2.3 + - added new dialog for managing backups + current - disabled unmaintaned Ukrainian translations - fixed some missing Asian translation strings (bug 179143) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/configure.ac new/sumf-0.2.3/configure.ac --- old/sumf-0.2.1/configure.ac 2006-06-02 16:18:46.000000000 +0200 +++ new/sumf-0.2.3/configure.ac 2006-09-28 15:09:59.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT(sumf, 0.2.1) +AC_INIT(sumf, 0.2.3) AM_INIT_AUTOMAKE AC_CANONICAL_BUILD diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/Makefile.am new/sumf-0.2.3/src/Makefile.am --- old/sumf-0.2.1/src/Makefile.am 2006-01-23 18:03:19.000000000 +0100 +++ new/sumf-0.2.3/src/Makefile.am 2006-09-28 13:49:00.000000000 +0200 @@ -18,19 +18,29 @@ main_window_impl.moc.cpp \ switch_window_impl.moc.cpp \ details_window_impl.moc.cpp \ - edit_window_impl.moc.cpp + edit_window_impl.moc.cpp \ + backups_window.moc.cpp \ + backups_window_impl.moc.cpp \ + selectbackup_window.moc.cpp \ + selectbackup_window_impl.moc.cpp \ + diff_window_impl.moc.cpp all_METASOURCES = main_window.cpp \ switch_window.cpp \ details_window.cpp \ edit_window.cpp \ progress_window.cpp \ - diff_window.cpp + diff_window.cpp \ + backups_window.cpp \ + selectbackup_window.cpp all_IMPLEMENTATIONS = main_window_impl.cpp \ switch_window_impl.cpp \ details_window_impl.cpp \ - edit_window_impl.cpp + edit_window_impl.cpp \ + backups_window_impl.cpp \ + selectbackup_window_impl.cpp \ + diff_window_impl.cpp bin_PROGRAMS = sumf diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/backups_window.ui new/sumf-0.2.3/src/backups_window.ui --- old/sumf-0.2.1/src/backups_window.ui 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/backups_window.ui 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,413 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>BackupsWindow</class> +<widget class="QDialog"> + <property name="name"> + <cstring>BackupsWindow</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>740</width> + <height>628</height> + </rect> + </property> + <property name="caption"> + <string>Manage backups</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>frame7</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblLabelActiveProfile</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Active profile:</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>lblActiveProfile</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>lblInfo</cstring> + </property> + <property name="text"> + <string>Please select all resources you want to have backed up, restored or removed</string> + </property> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>frmResourceBackups</cstring> + </property> + <property name="title"> + <string>Resources</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>frmQuickSearch</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblSearch</cstring> + </property> + <property name="text"> + <string>Quick search:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>txtQuickSearch</cstring> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdClearQuickSearch</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </widget> + </hbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frmResourceList</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Resource</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Type</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Backup</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>listResources</cstring> + </property> + <property name="selectionMode"> + <enum>Single</enum> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="showSortIndicator"> + <bool>false</bool> + </property> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + <property name="resizeMode"> + <enum>NoColumn</enum> + </property> + </widget> + </hbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frame8</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdSelectBackup</cstring> + </property> + <property name="text"> + <string>Select backup version</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdShowDiff</cstring> + </property> + <property name="text"> + <string>Show Changes</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>410</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frmButtons</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdBackup</cstring> + </property> + <property name="text"> + <string>Backup</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdRestore</cstring> + </property> + <property name="text"> + <string>Restore</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdRemoveBackup</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdClose</cstring> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="293">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff61000000ec49444154388db591316e84301045df20c4012005c92190d8bd0072c519b881cfc3692890e8a94cc11122377b019a491322d6311151942f596246ffcd7c1bf8a3e4a47fbbc8bfc49aaf805e3cb73402bf8fe308c0b66d006459f6f49de739755d03908470dff7ccf38c3186b66d71ceb1ae2bce39dab6c518c3300cf1d8d65ab5d66ad7757a54acdeaf20fbe6a6699e263e1e0f9665f9b6a9aa2a8aa2609a2680bb005a9665ec31f1dea3aa5fb588b07bbdf700f754551189ffcd23bcd7a1371111098d217c84426ff269880e39c26729d3835154557f0262bd24309c26395334975e9c22226fbfdaf62ffa0038017fdc8ddc35150000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>cmdBackup</sender> + <signal>clicked()</signal> + <receiver>BackupsWindow</receiver> + <slot>backup()</slot> + </connection> + <connection> + <sender>cmdRestore</sender> + <signal>clicked()</signal> + <receiver>BackupsWindow</receiver> + <slot>restore()</slot> + </connection> + <connection> + <sender>cmdClose</sender> + <signal>clicked()</signal> + <receiver>BackupsWindow</receiver> + <slot>close()</slot> + </connection> + <connection> + <sender>cmdSelectBackup</sender> + <signal>clicked()</signal> + <receiver>BackupsWindow</receiver> + <slot>selectBackup()</slot> + </connection> + <connection> + <sender>cmdShowDiff</sender> + <signal>clicked()</signal> + <receiver>BackupsWindow</receiver> + <slot>showDiff()</slot> + </connection> + <connection> + <sender>listResources</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>BackupsWindow</receiver> + <slot>selectBackup()</slot> + </connection> + <connection> + <sender>cmdRemoveBackup</sender> + <signal>clicked()</signal> + <receiver>BackupsWindow</receiver> + <slot>remove()</slot> + </connection> + <connection> + <sender>txtQuickSearch</sender> + <signal>textChanged(const QString&)</signal> + <receiver>BackupsWindow</receiver> + <slot>quickSearch(const QString&)</slot> + </connection> + <connection> + <sender>cmdClearQuickSearch</sender> + <signal>clicked()</signal> + <receiver>txtQuickSearch</receiver> + <slot>clear()</slot> + </connection> +</connections> +<slots> + <slot>showDiff()</slot> + <slot>restore()</slot> + <slot>quickSearch(const QString &text)</slot> + <slot>clearQuickSearch()</slot> + <slot>selectBackup()</slot> + <slot>backup()</slot> + <slot>remove()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/backups_window_impl.cpp new/sumf-0.2.3/src/backups_window_impl.cpp --- old/sumf-0.2.1/src/backups_window_impl.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/backups_window_impl.cpp 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,227 @@ +/**** + * + * Project: SCPM Unversal Management Frontend + * File: backups_window_impl.cpp + * Description: allows managing backups of resources + * Author: Helmut Schaa (hschaa@suse.de) + * + * Copyright 2005 SUSE LINUX Products GmbH + * + ***/ +#include "backups_window_impl.h" +#include "sexi.h" +#include "i18n.h" +#include <qlineedit.h> +#include <qmessagebox.h> +#include <qfiledialog.h> +#include <qlistview.h> +#include <qdatetime.h> +#include <qpushbutton.h> +#include "selectbackup_window_impl.h" +#include "diff_window_impl.h" + +using namespace std; + +BackupsWindow_impl::BackupsWindow_impl( QWidget* parent , const char* name , bool modal , WFlags fl ) + : BackupsWindow(parent, name, modal, fl) +{ + // set profile + scpm_status_t scpm_status = sexi->GetStatus(); + m_profile = scpm_status.active_profile; + lblActiveProfile->setText(scpm_status.active_profile); + + // load available backups + FillListResources(); +} + +void BackupsWindow_impl::FillListResources() +{ + listResources->clear(); + + BWCheckListItem* item=NULL; + // get a list of resources with the appropriate number of available backups + vector<SEXI::backup_resource_t > resources = sexi->ListBackupResources(m_profile); + QDateTime dt; + + // insert all resources in the listview + for(unsigned int i=0; i<resources.size(); i++) + { + item = new BWCheckListItem(listResources, 0, QCheckListItem::CheckBox); + item->setText(0, resources[i].name); + item->setText(1, resources[i].type); + if (resources[i].versions.size() > 0) + { + dt.setTime_t(resources[i].versions[0].first); + item->act_version = resources[i].versions[0]; + } + item->setText(2, resources[i].versions.size() > 0 ? dt.toString(Qt::LocalDate) : "-"); + item->br = resources[i]; + } + + // perhaps there was a quick-search active? + if (!txtQuickSearch->text().isEmpty()) + this->quickSearch(txtQuickSearch->text()); +} + +void BackupsWindow_impl::backup() +{ + QListViewItemIterator it( listResources ); + vector<pair<string, string> > resources2backup; + BWCheckListItem* bli = NULL; + + // get all selected resources + while ( it.current() ) { + if (it.current()->rtti() == BWCheckListItem::RTTI) + bli = (BWCheckListItem*)it.current(); + // only restore checked resources + if ( bli->isOn() ) + { + pair<string, string> p(bli->br.type, bli->br.name); + resources2backup.push_back(p); + } + ++it; + } + + if (resources2backup.size() == 0) + QMessageBox::information(this, gt("manage backups"), gt("please select all resources you want to have backed up")); + else + { + // backup + sexi->AddBackupResources(resources2backup, m_profile); + // reaload available backups + this->FillListResources(); + } +} + +void BackupsWindow_impl::restore() +{ + QListViewItemIterator it( listResources ); + vector<pair<string, string> > resources2restore; + vector<string> versions; + BWCheckListItem* bli = NULL; + + // get all selected resources + while ( it.current() ) { + if (it.current()->rtti() == BWCheckListItem::RTTI) + bli = (BWCheckListItem*)it.current(); + // only restore checked resources + if ( bli->isOn() ) + if (bli->br.versions.size() > 0) + { + pair<string, string> p(bli->br.type, bli->br.name); + resources2restore.push_back(p); + versions.push_back(bli->act_version.second); + } + ++it; + } + if (resources2restore.size() == 0) + QMessageBox::information(this, gt("manage backups"), gt("please select all resources you want to have restored")); + else + { + // restore... + sexi->RestoreBackupResources(resources2restore, versions, m_profile); + // reload available backups + this->FillListResources(); + } +} + +void BackupsWindow_impl::quickSearch(const QString& text) +{ + // hide all items not matching the search string + QListViewItemIterator it( listResources ); + while ( it.current() ) { + it.current()->setVisible( it.current()->text(0).find(text)>-1 ); + ++it; + } +} + +void BackupsWindow_impl::selectBackup() +{ + QListViewItem* lvi = listResources->currentItem (); + BWCheckListItem* cli = NULL; + // is it one of the backup items? + if (lvi) + if (lvi->rtti() == BWCheckListItem::RTTI) + { + // yes, it is, so lets get the backup-relevant infos + cli = (BWCheckListItem*)lvi; + if (cli->br.versions.size() > 0) + { + // show the selection-dialog + SelectBackupWindow_impl sbw(&(cli->br)); + if (sbw.result() == 0) + sbw.exec(); + + // get the resulting backup-version + pair<time_t, string> p; + if (sbw.GetSelectedBackup(p)) + { + // and set it in the list + cli->act_version=p; + QDateTime dt; + dt.setTime_t(p.first); + cli->setText(2, dt.toString(Qt::LocalDate)); + } + } + else + { + QMessageBox::information(this, gt("manage backups"), gt("the selected resource does not have any backups")); + } + } +} + +void BackupsWindow_impl::showDiff() +{ + QListViewItem* lvi = listResources->currentItem (); + BWCheckListItem* cli = NULL; + // is it one of the backup items? + if (lvi) + if (lvi->rtti() == BWCheckListItem::RTTI) + { + // yes, it is, so lets get the backup-relevant infos + cli = (BWCheckListItem*)lvi; + if (cli->br.versions.size() > 0) + { + DiffWindow_impl df(cli->br.name, cli->br.type, true, cli->act_version.second ); + if (df.result() == 0) + df.exec(); + } + else + { + QMessageBox::information(this, gt("manage backups"), gt("the selected resource does not have any backups")); + } + } + +} + +void BackupsWindow_impl::remove() +{ + QListViewItemIterator it( listResources ); + vector<pair<string, string> > resources2remove; + vector<string> versions; + BWCheckListItem* bli = NULL; + + // get all selected resources + while ( it.current() ) { + if (it.current()->rtti() == BWCheckListItem::RTTI) + bli = (BWCheckListItem*)it.current(); + // only restore checked resources + if ( bli->isOn() ) + if (bli->br.versions.size() > 0) + { + pair<string, string> p(bli->br.type, bli->br.name); + resources2remove.push_back(p); + versions.push_back(bli->act_version.second); + } + ++it; + } + if (resources2remove.size() == 0) + QMessageBox::information(this, gt("manage backups"), gt("please select all resources you want to have removed")); + else + { + // remove... + sexi->RemoveBackupResources(resources2remove, versions, m_profile); + // reload available backups + this->FillListResources(); + } +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/backups_window_impl.h new/sumf-0.2.3/src/backups_window_impl.h --- old/sumf-0.2.1/src/backups_window_impl.h 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/backups_window_impl.h 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,53 @@ +/**** + * + * Project: SCPM Unversal Management Frontend + * File: details_window_impl.h + * Description: Allows managment of backups + * Author: Helmut Schaa (hschaa@suse.de) + * + * Copyright 2005 SUSE LINUX Products GmbH + * + ***/ +#ifndef BACKUPSWINDOW_IMPL_H +#define BACKUPSWINDOW_IMPL_H + +#include "backups_window.h" +#include "sexi.h" +#include <scpm_types.h> +#include <qlistview.h> + +class BWCheckListItem : public QCheckListItem +{ + public: + static const int RTTI = 1000; + SEXI::backup_resource_t br; + pair<time_t, string> act_version; + + BWCheckListItem(QListView * parent, const QString & text, Type tt = RadioButtonController ) + : QCheckListItem(parent, text, tt) {} + virtual int rtti() const {return RTTI;} + +}; + +class BackupsWindow_impl : public BackupsWindow +{ + Q_OBJECT + +public: + BackupsWindow_impl( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + +public slots: + void backup(); + void restore(); + void quickSearch(const QString &text); + void selectBackup(); + void showDiff(); + void remove(); + +private: + void FillListResources(); + + std::string m_profile; +}; + +#endif // BACKUPSWINDOW_H Binary files old/sumf-0.2.1/src/clear_left.png and new/sumf-0.2.3/src/clear_left.png differ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/details_window_impl.cpp new/sumf-0.2.3/src/details_window_impl.cpp --- old/sumf-0.2.1/src/details_window_impl.cpp 2005-08-30 17:13:56.000000000 +0200 +++ new/sumf-0.2.3/src/details_window_impl.cpp 2006-09-28 13:49:00.000000000 +0200 @@ -10,7 +10,7 @@ ***/ #include "details_window_impl.h" -#include "diff_window.h" +#include "diff_window_impl.h" #include "i18n.h" #include <qlistview.h> #include <qlabel.h> @@ -86,12 +86,8 @@ { QListViewItem *item = listResources->selectedItem(); if (!item) return; - std::stringstream ss; - sexi->ShowChanges( ss, item->text(2), item->text(1), false); - DiffWindow df; - df.labelResource->setText( item->text(1) + " (" + item->text(2) + ")" ); - char buf[255]; - while (ss.getline(buf, 254)) df.textChanges->append( buf ); + + DiffWindow_impl df(item->text(1), item->text(2), false, ""); df.exec(); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/diff_window_impl.cpp new/sumf-0.2.3/src/diff_window_impl.cpp --- old/sumf-0.2.1/src/diff_window_impl.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/diff_window_impl.cpp 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,23 @@ +/**** + * + * Project: SCPM Unversal Management Frontend + * File: backups_window_impl.cpp + * Description: Show Diff + * Author: Helmut Schaa (hschaa@suse.de) + * + * Copyright 2005 SUSE LINUX Products GmbH + * + ***/ +#include "diff_window_impl.h" +#include "sexi.h" +#include <sstream> +DiffWindow_impl::DiffWindow_impl( string res_name, string res_type, bool backup, string version, QWidget* parent, const char* name, bool modal, WFlags fl ) + : DiffWindow( parent, name, modal, fl ) +{ + std::stringstream ss; + sexi->ShowChanges( ss, res_type, res_name, backup, version); + labelResource->setText( res_name + " (" + res_type + ")" ); + char buf[255]; + while (ss.getline(buf, 254)) textChanges->append( buf ); +} + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/diff_window_impl.h new/sumf-0.2.3/src/diff_window_impl.h --- old/sumf-0.2.1/src/diff_window_impl.h 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/diff_window_impl.h 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,33 @@ +/**** + * + * Project: SCPM Unversal Management Frontend + * File: diff_window_impl.h + * Description: Show Diff + * Author: Helmut Schaa (hschaa@suse.de) + * + * Copyright 2005 SUSE LINUX Products GmbH + * + ***/ +#ifndef DIFFWINDOW_IMPL_H +#define DIFFWINDOW_IMPL_H + +#include <qvariant.h> +#include <qdialog.h> +#include <diff_window.h> +#include <string> +#include <qlabel.h> + +using namespace std; + +class DiffWindow_impl : public DiffWindow +{ + Q_OBJECT + +public: + DiffWindow_impl( string name, string type, bool backup, string version, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + +protected: +protected slots: +}; + +#endif // DIFFWINDOW_IMPL_H diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/edit_window.cpp new/sumf-0.2.3/src/edit_window.cpp --- old/sumf-0.2.1/src/edit_window.cpp 2005-08-17 19:31:03.000000000 +0200 +++ new/sumf-0.2.3/src/edit_window.cpp 2006-09-28 10:51:14.000000000 +0200 @@ -1,12 +1,13 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'edit_window.ui' ** -** Created: Wed Aug 17 19:27:23 2005 -** by: The User Interface Compiler ($Id: edit_window.cpp,v 1.2 2005/08/17 17:31:03 gleissner Exp $) +** Created: Mon Jun 12 14:52:44 2006 +** by: The User Interface Compiler ($Id: edit_window.cpp,v 1.3 2006/09/28 08:51:14 gleissner Exp $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ +#include "i18n.h" // PCH include #include "edit_window.h" #include <qvariant.h> @@ -145,28 +146,28 @@ */ void EditWindow::languageChange() { - setCaption( tr( "Edit profile" ) ); - groupBox6->setTitle( tr( "Switch scripts" ) ); - textLabel3->setText( tr( "Prestart" ) ); - textLabel4->setText( tr( "Poststart" ) ); - textLabel5->setText( tr( "Prestop" ) ); - textLabel6->setText( tr( "Poststop" ) ); - buttonBrowserPrestart->setText( tr( "..." ) ); - buttonBrowserPoststart->setText( tr( "..." ) ); - buttonBrowserPoststop->setText( tr( "..." ) ); - buttonBrowserPrestop->setText( tr( "..." ) ); - buttonClearPrestart->setText( tr( "clear" ) ); - buttonClearPoststart->setText( tr( "clear" ) ); - buttonClearPrestop->setText( tr( "clear" ) ); - buttonClearPoststop->setText( tr( "clear" ) ); - groupBox5->setTitle( tr( "Profile settings" ) ); - textLabel1->setText( tr( "Name" ) ); - textLabel2->setText( tr( "Description" ) ); + setCaption( gt( "Edit profile" ) ); + groupBox6->setTitle( gt( "Switch scripts" ) ); + textLabel3->setText( gt( "Prestart" ) ); + textLabel4->setText( gt( "Poststart" ) ); + textLabel5->setText( gt( "Prestop" ) ); + textLabel6->setText( gt( "Poststop" ) ); + buttonBrowserPrestart->setText( gt( "..." ) ); + buttonBrowserPoststart->setText( gt( "..." ) ); + buttonBrowserPoststop->setText( gt( "..." ) ); + buttonBrowserPrestop->setText( gt( "..." ) ); + buttonClearPrestart->setText( gt( "clear" ) ); + buttonClearPoststart->setText( gt( "clear" ) ); + buttonClearPrestop->setText( gt( "clear" ) ); + buttonClearPoststop->setText( gt( "clear" ) ); + groupBox5->setTitle( gt( "Profile settings" ) ); + textLabel1->setText( gt( "Name" ) ); + textLabel2->setText( gt( "Description" ) ); lineEditDescription->setText( QString::null ); - buttonCancel->setText( tr( "&Cancel" ) ); - buttonCancel->setAccel( QKeySequence( tr( "Alt+C" ) ) ); - buttonOK->setText( tr( "&OK" ) ); - buttonOK->setAccel( QKeySequence( tr( "Alt+O" ) ) ); + buttonCancel->setText( gt( "&Cancel" ) ); + buttonCancel->setAccel( QKeySequence( gt( "Alt+C" ) ) ); + buttonOK->setText( gt( "&OK" ) ); + buttonOK->setAccel( QKeySequence( gt( "Alt+O" ) ) ); } void EditWindow::SaveAndClose() diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/edit_window_impl.cpp new/sumf-0.2.3/src/edit_window_impl.cpp --- old/sumf-0.2.1/src/edit_window_impl.cpp 2005-08-30 19:15:40.000000000 +0200 +++ new/sumf-0.2.3/src/edit_window_impl.cpp 2006-09-28 10:51:14.000000000 +0200 @@ -22,11 +22,11 @@ { lineEditName->setText( profile ); try { - lineEditDescription->setText( QString::fromUtf8(sexi->GetDescription( profile ).c_str()) ); - lineEditPrestart->setText( QString::fromUtf8(sexi->GetScript( profile, SEXI::PRESTART ).c_str()) ); - lineEditPrestop->setText( QString::fromUtf8(sexi->GetScript( profile, SEXI::PRESTOP ).c_str()) ); - lineEditPoststart->setText( QString::fromUtf8(sexi->GetScript( profile, SEXI::POSTSTART ).c_str()) ); - lineEditPoststop->setText( QString::fromUtf8(sexi->GetScript( profile, SEXI::POSTSTOP ).c_str()) ); + lineEditDescription->setText( QString::fromUtf8(sexi->GetDescription( std::string(profile.utf8()) ).c_str()) ); + lineEditPrestart->setText( QString::fromUtf8(sexi->GetScript( std::string(profile.utf8()), SEXI::PRESTART ).c_str()) ); + lineEditPrestop->setText( QString::fromUtf8(sexi->GetScript( std::string(profile.utf8()), SEXI::PRESTOP ).c_str()) ); + lineEditPoststart->setText( QString::fromUtf8(sexi->GetScript( std::string(profile.utf8()), SEXI::POSTSTART ).c_str()) ); + lineEditPoststop->setText( QString::fromUtf8(sexi->GetScript( std::string(profile.utf8()), SEXI::POSTSTOP ).c_str()) ); setResult(0); } catch( SEXI::op_failed &e ) { @@ -37,13 +37,13 @@ void EditWindow_impl::SaveAndClose() { - sexi->SetDescription( current_name, std::string(lineEditDescription->text().utf8()) ); - sexi->SetScript( current_name, std::string(lineEditPrestart->text().utf8()), SEXI::PRESTART ); - sexi->SetScript( current_name, std::string(lineEditPrestop->text().utf8()), SEXI::PRESTOP ); - sexi->SetScript( current_name, std::string(lineEditPoststart->text().utf8()), SEXI::POSTSTART ); - sexi->SetScript( current_name, std::string(lineEditPoststop->text().utf8()), SEXI::POSTSTOP ); + sexi->SetDescription( std::string(current_name.utf8()), std::string(lineEditDescription->text().utf8()) ); + sexi->SetScript( std::string(current_name.utf8()), std::string(lineEditPrestart->text().utf8()), SEXI::PRESTART ); + sexi->SetScript( std::string(current_name.utf8()), std::string(lineEditPrestop->text().utf8()), SEXI::PRESTOP ); + sexi->SetScript( std::string(current_name.utf8()), std::string(lineEditPoststart->text().utf8()), SEXI::POSTSTART ); + sexi->SetScript( std::string(current_name.utf8()), std::string(lineEditPoststop->text().utf8()), SEXI::POSTSTOP ); if (lineEditName->text() != current_name) - sexi->RenameProfile( current_name, std::string(lineEditName->text().utf8()) ); + sexi->RenameProfile( std::string( current_name.utf8()), std::string(lineEditName->text().utf8()) ); accept(); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/main.cpp new/sumf-0.2.3/src/main.cpp --- old/sumf-0.2.1/src/main.cpp 2006-06-02 16:18:46.000000000 +0200 +++ new/sumf-0.2.3/src/main.cpp 2006-09-28 10:51:14.000000000 +0200 @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -/* $Id: main.cpp,v 1.12 2006/06/02 14:18:46 gleissner Exp $ */ +/* $Id: main.cpp,v 1.13 2006/09/28 08:51:14 gleissner Exp $ */ #include <stdio.h> #include <stdlib.h> #include <iostream> @@ -57,8 +57,9 @@ // translations for Qt QTranslator qt( 0 ); - qt.load( QString( "qt_" ) + QTextCodec::locale(), "." ); - app.installTranslator( &qt ); + qt.load( QString( "qt_" ) + QTextCodec::locale(), "/usr/lib/qt3/translations" ); + qDebug( "Loading translations %s path %s\n", QTextCodec::locale(), qInstallPathTranslations() ); + app.installTranslator( &qt ); // translations for application strings setlocale( LC_ALL, "" ); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/main_window.ui new/sumf-0.2.3/src/main_window.ui --- old/sumf-0.2.1/src/main_window.ui 2005-08-17 19:31:03.000000000 +0200 +++ new/sumf-0.2.3/src/main_window.ui 2006-09-28 13:49:00.000000000 +0200 @@ -88,6 +88,7 @@ <action name="menuProfileEdit"/> <action name="menuProfileRemove"/> <action name="menuProfileSwitch"/> + <action name="menuManageBackups"/> <separator/> <action name="menuQuit"/> </item> @@ -348,6 +349,20 @@ <string>Always show Switch Window</string> </property> </action> + <action> + <property name="name"> + <cstring>menuManageBackups</cstring> + </property> + <property name="text"> + <string>Manage Backups</string> + </property> + <property name="menuText"> + <string>Manage Backups</string> + </property> + <property name="accel"> + <string>Ctrl+B</string> + </property> + </action> </actions> <connections> <connection> @@ -440,6 +455,12 @@ <receiver>MainWindow</receiver> <slot>profileSwitch()</slot> </connection> + <connection> + <sender>menuManageBackups</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>manageBackups()</slot> + </connection> </connections> <slots> <slot>fileExit()</slot> @@ -457,6 +478,7 @@ <slot>runYaST()</slot> <slot>toggleAutoClose(bool)</slot> <slot>toggleShowAlways(bool)</slot> + <slot>manageBackups()</slot> </slots> <layoutdefaults spacing="6" margin="11"/> </UI> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/main_window_impl.cpp new/sumf-0.2.3/src/main_window_impl.cpp --- old/sumf-0.2.1/src/main_window_impl.cpp 2006-05-29 17:46:11.000000000 +0200 +++ new/sumf-0.2.3/src/main_window_impl.cpp 2006-09-28 13:49:00.000000000 +0200 @@ -20,6 +20,7 @@ #include "edit_window_impl.h" #include "sexi.h" #include "i18n.h" +#include "backups_window_impl.h" MainWindow_impl::MainWindow_impl( bool so, QWidget* parent, const char* name, WFlags fl ) : MainWindow( parent, name, fl ) @@ -212,6 +213,12 @@ { try { scpm_status_t scpm_status = sexi->GetStatus(); + // detemine which profile should be selected + string profile; + QListViewItem *item = listProfiles->selectedItem(); + if (item) + profile = std::string(item->text(1).utf8()); + listProfiles->clear(); if (scpm_status.locked) { listProfiles->setEnabled( false ); @@ -225,7 +232,10 @@ profiles[i] == scpm_status.active_profile ? "->" : "", QString::fromUtf8(profiles[i].c_str()), QString::fromUtf8(sexi->GetDescription( profiles[i] ).c_str()) ); + if (profiles[i]==profile || (profile.empty() && profiles[i] == scpm_status.active_profile)) + listProfiles->setSelected(elem, true); } + statusBar()->clear(); } catch( SEXI::op_failed &e ) { @@ -261,3 +271,10 @@ { always_show_switch = on; } + +void MainWindow_impl::manageBackups() +{ + BackupsWindow_impl bw; + if (bw.result() == 0) + bw.exec(); +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/main_window_impl.h new/sumf-0.2.3/src/main_window_impl.h --- old/sumf-0.2.1/src/main_window_impl.h 2006-01-23 18:05:06.000000000 +0100 +++ new/sumf-0.2.3/src/main_window_impl.h 2006-09-28 13:49:00.000000000 +0200 @@ -46,6 +46,7 @@ void reloadList(); void toggleAutoClose(bool); void toggleShowAlways(bool); + void manageBackups(); protected: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/selectbackup_window.ui new/sumf-0.2.3/src/selectbackup_window.ui --- old/sumf-0.2.1/src/selectbackup_window.ui 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/selectbackup_window.ui 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,100 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>SelectBackupWindow</class> +<widget class="QDialog"> + <property name="name"> + <cstring>SelectBackupWindow</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>266</width> + <height>252</height> + </rect> + </property> + <property name="caption"> + <string>Select backup version</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Backup</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>listBackups</cstring> + </property> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frame3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdOK</cstring> + </property> + <property name="text"> + <string>ok</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>cmdCancel</cstring> + </property> + <property name="text"> + <string>cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>cmdCancel</sender> + <signal>clicked()</signal> + <receiver>SelectBackupWindow</receiver> + <slot>cancel()</slot> + </connection> + <connection> + <sender>cmdOK</sender> + <signal>clicked()</signal> + <receiver>SelectBackupWindow</receiver> + <slot>ok()</slot> + </connection> + <connection> + <sender>listBackups</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>SelectBackupWindow</receiver> + <slot>ok()</slot> + </connection> +</connections> +<slots> + <slot>cancel()</slot> + <slot>ok()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/selectbackup_window_impl.cpp new/sumf-0.2.3/src/selectbackup_window_impl.cpp --- old/sumf-0.2.1/src/selectbackup_window_impl.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/selectbackup_window_impl.cpp 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,61 @@ +/**** + * + * Project: SCPM Unversal Management Frontend + * File: selectbackup_window_impl.cpp + * Description: shows available backups for a resource + * Author: Helmut Schaa (hschaa@suse.de) + * + * Copyright 2005 SUSE LINUX Products GmbH + * + ***/ +#include "selectbackup_window_impl.h" +#include "sexi.h" +#include "i18n.h" +#include <qdatetime.h> +#include <qlistview.h> + +using namespace std; + +SelectBackupWindow_impl::SelectBackupWindow_impl( const SEXI::backup_resource_t* br, QWidget* parent , const char* name, bool modal, WFlags fl ) + : SelectBackupWindow(parent, name, modal, fl) +{ + SBListViewItem* item=NULL; + QDateTime dt; + + if (br) + for (unsigned int i=0; i < br->versions.size(); i++) + { + item = new SBListViewItem(listBackups, item); + dt.setTime_t(br->versions[i].first); + item->setText(0, dt.toString(Qt::LocalDate)); + item->version=br->versions[i]; + } + + canceled = false; +} + +bool SelectBackupWindow_impl::GetSelectedBackup(pair<time_t, string> &p) +{ + QListViewItem* lvi = listBackups->currentItem(); + SBListViewItem* sbi = NULL; + if (lvi && !canceled) + if(lvi->rtti() == SBListViewItem::RTTI) + { + sbi = (SBListViewItem*) lvi; + p = sbi->version; + return true; + } + return false; +} + +void SelectBackupWindow_impl::cancel() +{ + canceled=true; + this->close(); +} + +void SelectBackupWindow_impl::ok() +{ + canceled=false; + this->close(); +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/selectbackup_window_impl.h new/sumf-0.2.3/src/selectbackup_window_impl.h --- old/sumf-0.2.1/src/selectbackup_window_impl.h 1970-01-01 01:00:00.000000000 +0100 +++ new/sumf-0.2.3/src/selectbackup_window_impl.h 2006-09-28 13:49:00.000000000 +0200 @@ -0,0 +1,45 @@ +/**** + * + * Project: SCPM Unversal Management Frontend + * File: selectbackup_window_impl.h + * Description: shows available backups for a resource + * Author: Helmut Schaa (hschaa@suse.de) + * + * Copyright 2005 SUSE LINUX Products GmbH + * + ***/ +#ifndef SELECTBACKUPWINDOW_IMPL_H +#define SELECTBACKUPWINDOW_IMPL_H + +#include "selectbackup_window.h" +#include "sexi.h" +#include <scpm_types.h> +#include <qlistview.h> + +class SBListViewItem : public QListViewItem +{ + public: + static const int RTTI = 1001; + pair<time_t, string> version; + + SBListViewItem(QListView * parent, QListViewItem* lvi) : QListViewItem(parent, lvi) {} + virtual int rtti() const {return RTTI;} + +}; + + +class SelectBackupWindow_impl : public SelectBackupWindow +{ + Q_OBJECT + +public: + SelectBackupWindow_impl(const SEXI::backup_resource_t * br, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + bool GetSelectedBackup(pair<time_t, string> &p); +public slots: + void cancel(); + void ok(); +private: + bool canceled; +}; + +#endif // SELECTBACKUPWINDOW_IMPL_H diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/sexi.cpp new/sumf-0.2.3/src/sexi.cpp --- old/sumf-0.2.1/src/sexi.cpp 2006-04-03 16:25:21.000000000 +0200 +++ new/sumf-0.2.3/src/sexi.cpp 2006-09-28 13:49:00.000000000 +0200 @@ -12,6 +12,7 @@ #include <qpushbutton.h> #include <qmessagebox.h> #include "sexi.h" +#include <algorithm> #define scpmerror QMessageBox::critical( 0, gettext( "Error" ), QString::fromUtf8(scpm_error) ) @@ -22,6 +23,7 @@ switch_info = NULL; progress_win = pw; scpm = new SCPM(scpm_flag_hash, msgstream, barstream ); + scdb = SCDB::GetHandle(); } SEXI::~SEXI( ) @@ -160,23 +162,93 @@ ProgressExec( SEXEC::RECOVER, (rollback) ? "yes" : "no" ); } -void SEXI::ShowChanges( std::stringstream &output, const std::string &type, const std::string &name, bool backup ) +void SEXI::ShowChanges( std::stringstream &output, const std::string &type, const std::string &name, bool backup, std::string version ) { - if (!scpm->ShowChanges( output, type, name, backup ) ) scpm_error; + if (!scpm->ShowChanges( output, type, name, backup, version ) ) scpm_error; } -bool SEXI::ProgressExec( SEXEC::scpm_command_e cmd, std::string arg1, std::string arg2 ) +std::vector<SEXI::backup_resource_t> SEXI::ListBackupResources(const std::string &profile) +{ + std::vector<backup_info_t> backups; + std::vector<backup_resource_t> ret; + std::vector<std::string> types; + std::vector<std::string> resources; + + // get list of all available resources + types=scdb->ResourceGetTypes(); + for (unsigned int typeidx=0; typeidx<types.size(); typeidx++) + { + backup_resource_t br; + br.type = types[typeidx]; + resources = scdb->ResourceGetNames(types[typeidx]); + for (unsigned int residx=0; residx<resources.size(); residx++) + { + br.name = resources[residx]; + ret.push_back(br); + } + } + + // get number of available backups per resource + scpm->ListBackups( profile, &backups); + for(unsigned int i = 0; i < backups.size(); i++) + { + for(unsigned int j=0; j < ret.size(); j++) + { + if (backups[i].name == ret[j].name && backups[i].type==ret[j].type) + { + ret[j].versions = backups[i].versions; + sort(ret[j].versions.begin(), ret[j].versions.end(), greater< pair<time_t, string> >() ); + break; + } + } + } + return ret; +} + +bool SEXI::RestoreBackupResources(const std::vector<std::pair<std::string, std::string> > &res, const std::vector<std::string> &versions, std::string &profile) +{ + ProgressExec(SEXEC::RESTOREBACKUP, profile, "", &res, &versions); +} + +bool SEXI::AddBackupResources(const std::vector<std::pair<std::string, std::string> > &res, std::string &profile) +{ + ProgressExec(SEXEC::ADDBACKUP, profile, "", &res); +} + +bool SEXI::RemoveBackupResources(const std::vector<std::pair<std::string, std::string> > &res, const std::vector<std::string> &versions, std::string &profile) +{ + ProgressExec(SEXEC::REMOVEBACKUP, profile, "", &res, &versions); +} + +bool SEXI::ProgressExec( SEXEC::scpm_command_e cmd, std::string arg1, std::string arg2, const vector<pair<string, string> >* res, const vector<string> * ver ) { SEXEC se( scpm, success, *switch_info ); progress_win->buttonClose->setEnabled( false ); - se.SetCommand( cmd, arg1, arg2 ); - ProgressWriter p( progress_win->progressBar, progress_win->textProgress, msgstream, barstream ); + se.SetCommand( cmd, arg1, arg2, res, ver ); +// ProgressWriter p( progress_win->progressBar, progress_win->textProgress, msgstream, barstream ); progress_win->show(); - p.start(); +// p.start(); se.start(); - while (se.running()) { qApp->processEvents(); usleep(1000); }; - p.terminateWriter(); - p.wait(); + char buf[255]; + + while (se.running()) + { + // print status messages + if ( msgstream.get(buf,255,'\0') ) { + progress_win->textProgress->insert(QObject::tr(buf)); + } + msgstream.clear(); + // show progress + while ( barstream.get() != EOF ) { + progress_win->progressBar->setProgress( progress_win->progressBar->progress()+1 ); + } + barstream.clear(); + // let events be processed + qApp->processEvents(); + usleep(1000); + }; +// p.terminateWriter(); +// p.wait(); se.wait(); progress_win->buttonClose->setEnabled( true ); if (!auto_close) progress_win->exec(); @@ -191,11 +263,13 @@ cmd = NONE; } -void SEXEC::SetCommand( scpm_command_e command, std::string &arg1, std::string &arg2 ) +void SEXEC::SetCommand( scpm_command_e command, std::string &arg1, std::string &arg2, const vector<pair<string, string> >* res, const vector<string> * ver ) { cmd = command; argument1 = arg1; argument2 = arg2; + if (res) resources = *res; + if (ver) versions = *ver; } void SEXEC::run( ) @@ -230,6 +304,15 @@ case RECOVER: success = scpm->Recover( (argument1 == "yes") ? true : false ); break; + case RESTOREBACKUP: + success = scpm->RestoreBackup(resources, versions, argument1); + break; + case ADDBACKUP: + success = scpm->AddBackup(resources, argument1); + break; + case REMOVEBACKUP: + success = scpm->RemoveBackup(resources, versions, argument1); + break; } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/sexi.h new/sumf-0.2.3/src/sexi.h --- old/sumf-0.2.1/src/sexi.h 2006-04-03 16:25:21.000000000 +0200 +++ new/sumf-0.2.3/src/sexi.h 2006-09-28 13:49:00.000000000 +0200 @@ -12,6 +12,7 @@ #define SEXI_H #include <scpm.h> +#include <scdb.h> #include <string> #include <vector> #include <qtextedit.h> @@ -32,11 +33,14 @@ SWITCH, SAVE, ENABLE, - RECOVER + RECOVER, + ADDBACKUP, + RESTOREBACKUP, + REMOVEBACKUP }; SEXEC(SCPM *s, bool &succ, switch_info_t &si); - void SetCommand( scpm_command_e command, std::string &arg1, std::string &arg2 ); + void SetCommand( scpm_command_e command, std::string &arg1, std::string &arg2, const vector<pair<string, string> > *resources=NULL, const vector<string> *versions=NULL ); void run( ); private: @@ -46,6 +50,8 @@ bool &success; std::string argument1; std::string argument2; + vector<pair<string,string> > resources; + vector<string> versions; }; class SEXI @@ -68,6 +74,12 @@ POSTSTART, POSTSTOP }; + + typedef struct backup_resource_t { + std::string name; + std::string type; + vector<pair<time_t, string> > versions; + }; static SEXI *GetHandle() { return handle; }; @@ -91,13 +103,19 @@ void Disable( ); void Recover( bool rollback ); void ShowChanges( std::stringstream &output, const std::string &type, - const std::string &name, bool backup=false ); - bool ProgressExec( SEXEC::scpm_command_e cmd, std::string arg1="", std::string arg2="" ); + const std::string &name, bool backup=false, std::string version="" ); + bool ProgressExec( SEXEC::scpm_command_e cmd, std::string arg1="", std::string arg2="" , const vector<pair<string, string> > *resources=NULL, const vector<string> *versions=NULL ); + void Reinit( ); + std::vector<backup_resource_t> ListBackupResources(const std::string &profile); + bool RestoreBackupResources(const std::vector<std::pair<std::string, std::string> > &res, const std::vector<std::string> &versions, std::string &profile); + bool AddBackupResources(const std::vector<std::pair<std::string, std::string> > &res, std::string &profile); + bool RemoveBackupResources(const std::vector<std::pair<std::string, std::string> > &res, const std::vector<std::string> &versions, std::string &profile); private: ProgressWindow *progress_win; SCPM *scpm; + SCDB *scdb; std::stringstream msgstream; std::stringstream barstream; bool success; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sumf-0.2.1/src/switch_window_impl.cpp new/sumf-0.2.3/src/switch_window_impl.cpp --- old/sumf-0.2.1/src/switch_window_impl.cpp 2005-08-30 17:13:56.000000000 +0200 +++ new/sumf-0.2.3/src/switch_window_impl.cpp 2006-09-28 10:51:14.000000000 +0200 @@ -21,13 +21,13 @@ : SwitchWindow( parent, name, modal, fl ) { try { - labelActive->setText( sexi->GetActiveProfile() ); + labelActive->setText( QString::fromUtf8( sexi->GetActiveProfile().c_str() ) ); } catch( SEXI::op_failed &e ) { // very unlikely labelActive->setText( gt("unknown") ); } - labelDestination->setText( sexi->switch_info->profile_name ); + labelDestination->setText( QString::fromUtf8( sexi->switch_info->profile_name.c_str() ) ); if (sexi->switch_info->profile_modified) ParseGroups( sexi->switch_info->modified_resources ); QListViewItem *elem = listResources->firstChild(); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@suse.de