diff --git a/livesupport/src/modules/core/include/LiveSupport/Core/SearchCriteria.h b/livesupport/src/modules/core/include/LiveSupport/Core/SearchCriteria.h index 1a0435680..a3e3eeef7 100644 --- a/livesupport/src/modules/core/include/LiveSupport/Core/SearchCriteria.h +++ b/livesupport/src/modules/core/include/LiveSupport/Core/SearchCriteria.h @@ -43,6 +43,7 @@ #include #include #include +#include #include "LiveSupport/Core/Ptr.h" @@ -55,6 +56,8 @@ namespace Storage { namespace LiveSupport { namespace Core { +using namespace boost::posix_time; + /* ================================================================ constants */ @@ -137,6 +140,16 @@ class SearchCriteria */ SearchConditionListType searchConditions; + /** + * The mtime to use for "ls:mtime". + */ + Ptr::Ref mtimeValue; + + /** + * The comparison operator to use for "ls:mtime". + */ + std::string mtimeComparisonOperator; + /** * The maximum number of conditions to be returned. */ @@ -252,6 +265,18 @@ class SearchCriteria const std::string & value) throw(std::invalid_argument); + /** + * Add a search condition specifying the mtime (modified-at time). + * + * @param comparisonOperator one of "=", "partial", "prefix", + * "<", "<=", ">" or ">=" + * @param value the value of the mtime to compare to + */ + void + addMtimeCondition(const std::string & comparisonOperator, + Ptr::Ref value) + throw(std::invalid_argument); + /** * Add a search condition. * diff --git a/livesupport/src/modules/core/include/LiveSupport/Core/TimeConversion.h b/livesupport/src/modules/core/include/LiveSupport/Core/TimeConversion.h index 532476d10..33ebf229f 100644 --- a/livesupport/src/modules/core/include/LiveSupport/Core/TimeConversion.h +++ b/livesupport/src/modules/core/include/LiveSupport/Core/TimeConversion.h @@ -162,7 +162,7 @@ class TimeConversion * @return a struct tm, holding the same time. */ static void - ptimeToTm(Ptr::Ref convertFrom, struct tm & convertTo) + ptimeToTm(Ptr::Ref convertFrom, struct tm & convertTo) throw (); /** diff --git a/livesupport/src/modules/core/src/SearchCriteria.cxx b/livesupport/src/modules/core/src/SearchCriteria.cxx index 9083c1c4c..4a240cf54 100644 --- a/livesupport/src/modules/core/src/SearchCriteria.cxx +++ b/livesupport/src/modules/core/src/SearchCriteria.cxx @@ -33,9 +33,11 @@ #include "configure.h" #endif +#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/SearchCriteria.h" using namespace LiveSupport::Core; +using namespace boost::posix_time; /* =================================================== local data structures */ @@ -86,6 +88,28 @@ SearchCriteria :: addCondition(const std::string & key, } +/*------------------------------------------------------------------------------ + * Add a search condition specifying the mtime (modified-at time). + *----------------------------------------------------------------------------*/ +void +SearchCriteria :: addMtimeCondition(const std::string & comparisonOperator, + Ptr::Ref value) + throw(std::invalid_argument) +{ + std::string lowerCaseOp = lowerCase(comparisonOperator); + + if (lowerCaseOp == "=" + || lowerCaseOp == "partial" || lowerCaseOp == "prefix" + || lowerCaseOp == "<" || lowerCaseOp == "<=" + || lowerCaseOp == ">" || lowerCaseOp == ">=") { + mtimeComparisonOperator = lowerCaseOp; + mtimeValue = value; + } else { + throw std::invalid_argument("bad comparison operator argument"); + } +} + + /*------------------------------------------------------------------------------ * Convert to an XmlRpc::XmlRpcValue. *----------------------------------------------------------------------------*/ @@ -111,6 +135,19 @@ SearchCriteria :: operator XmlRpc::XmlRpcValue() const condition["val"] = it->value; conditionList[i] = condition; } + + if (mtimeValue) { + int i = conditionList.size(); + struct tm * mtimeStructTm; + TimeConversion::ptimeToTm(mtimeValue, *mtimeStructTm); + + XmlRpc::XmlRpcValue condition; + condition["cat"] = "ls:mtime"; + condition["op"] = mtimeComparisonOperator; + condition["val"] = XmlRpc::XmlRpcValue(mtimeStructTm); + conditionList[i] = condition; + } + returnValue["conditions"] = conditionList; if (limit) { @@ -121,6 +158,7 @@ SearchCriteria :: operator XmlRpc::XmlRpcValue() const returnValue["offset"] = offset; } +std::cerr << returnValue << std::endl; return returnValue; } diff --git a/livesupport/src/modules/core/src/TimeConversion.cxx b/livesupport/src/modules/core/src/TimeConversion.cxx index c896f571b..a1ab8f7df 100644 --- a/livesupport/src/modules/core/src/TimeConversion.cxx +++ b/livesupport/src/modules/core/src/TimeConversion.cxx @@ -105,7 +105,8 @@ TimeConversion :: tmToPtime(const struct tm *time) * Convert a boost::ptime to a struct tm *----------------------------------------------------------------------------*/ void -TimeConversion :: ptimeToTm(Ptr::Ref convertFrom, struct tm & convertTo) +TimeConversion :: ptimeToTm(Ptr::Ref convertFrom, + struct tm & convertTo) throw () { date date = convertFrom->date(); diff --git a/livesupport/src/modules/widgets/etc/Makefile.in b/livesupport/src/modules/widgets/etc/Makefile.in index be6e8ff42..1258d716d 100644 --- a/livesupport/src/modules/widgets/etc/Makefile.in +++ b/livesupport/src/modules/widgets/etc/Makefile.in @@ -147,7 +147,8 @@ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \ ${TMP_DIR}/Colors.o \ ${TMP_DIR}/DialogWindow.o \ ${TMP_DIR}/ScrolledWindow.o \ - ${TMP_DIR}/ScrolledNotebook.o + ${TMP_DIR}/ScrolledNotebook.o \ + ${TMP_DIR}/DateTimeChooserWindow.o TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \ ${TMP_DIR}/main.o diff --git a/livesupport/src/modules/widgets/include/LiveSupport/Widgets/DateTimeChooserWindow.h b/livesupport/src/modules/widgets/include/LiveSupport/Widgets/DateTimeChooserWindow.h new file mode 100644 index 000000000..b813d32a5 --- /dev/null +++ b/livesupport/src/modules/widgets/include/LiveSupport/Widgets/DateTimeChooserWindow.h @@ -0,0 +1,160 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision$ + Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/DateTimeChooserWindow.h $ + +------------------------------------------------------------------------------*/ +#ifndef DateTimeChooserWindow_h +#define DateTimeChooserWindow_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include +#include +#include +#include +#include + +#include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Core/LocalizedObject.h" +#include "LiveSupport/Widgets/EntryBin.h" + +#include "LiveSupport/Widgets/WhiteWindow.h" + +namespace LiveSupport { +namespace Widgets { + +using namespace LiveSupport::Core; +using namespace boost::posix_time; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * A dialog window for choosing a date/time. + * + * The constructor is called with a resource bundle. The resource bundle + * is expected to contain keys named cancelButtonLabel, okButtonLabel, + * hourLabel and minuteLabel. + * + * The return value of the run() method is a boost::posix_time::ptime value. + * The DateTimeChooserWindow object is not destroyed when it returns from + * run(); it is the responsibility of the caller to delete it (or it can be + * reused a few times first). + * + * @author $Author: fgerlits $ + * @version $Revision$ + */ +class DateTimeChooserWindow : public WhiteWindow, + public LocalizedObject +{ + private: + /** + * The calendar where the date is chosen. + */ + Gtk::Calendar * calendar; + + /** + * The entry field for the hour. + */ + EntryBin * hourEntry; + + /** + * The entry field for the minute. + */ + EntryBin * minuteEntry; + + /** + * The return value; set to 0 if the user pressed Cancel. + */ + Ptr::Ref chosenDateTime; + + + protected: + /** + * The event handler for the Cancel button clicked. + */ + void + onCancelButtonClicked(void) throw (); + + /** + * The event handler for the OK button clicked. + */ + void + onOkButtonClicked(void) throw (); + + + public: + /** + * Constructor. + * + * @param bundle a resource bundle containing the localized + * button labels + */ + DateTimeChooserWindow(Ptr::Ref bundle) throw (); + + /** + * A virtual destructor, as this class has virtual functions. + */ + virtual + ~DateTimeChooserWindow(void) throw () + { + } + + /** + * Run the window and return the date/time selected. + * The returned value may be a 0 pointer (if the user pressed Cancel), + * and it may be not_a_date_time, if the user's selection is invalid. + */ + Ptr::Ref + run(void) throw (); + +}; + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Widgets +} // namespace LiveSupport + +#endif // DateTimeChooserWindow_h + diff --git a/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 4486ff88d..48179f38a 100644 --- a/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h +++ b/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h @@ -58,6 +58,7 @@ #include "LiveSupport/Widgets/EntryBin.h" #include "LiveSupport/Widgets/DialogWindow.h" #include "LiveSupport/Widgets/ZebraTreeView.h" +#include "LiveSupport/Widgets/DateTimeChooserWindow.h" namespace LiveSupport { @@ -374,6 +375,19 @@ class WidgetFactory : Ptr::Ref bundle, int buttons = DialogWindow::okButton) throw (); + + /** + * Create a DateTimeChooserWindow. + * It lets the user select a date/time. + * It is the reponsibility of the caller to dispose of the created + * object properly. + * + * @param bundle localization for the button(s). + * @return the DateTimeChooserWindow object. + */ + DateTimeChooserWindow * + createDateTimeChooserWindow(Ptr::Ref bundle) + throw (); }; diff --git a/livesupport/src/modules/widgets/src/DateTimeChooserWindow.cxx b/livesupport/src/modules/widgets/src/DateTimeChooserWindow.cxx new file mode 100644 index 000000000..38cf19e65 --- /dev/null +++ b/livesupport/src/modules/widgets/src/DateTimeChooserWindow.cxx @@ -0,0 +1,175 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision$ + Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/src/DateTimeChooserWindow.cxx $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "LiveSupport/Widgets/WidgetFactory.h" +#include "LiveSupport/Widgets/Colors.h" +#include "LiveSupport/Widgets/Button.h" + +#include "LiveSupport/Widgets/DateTimeChooserWindow.h" + + +using namespace LiveSupport::Widgets; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Constructor. + *----------------------------------------------------------------------------*/ +DateTimeChooserWindow :: DateTimeChooserWindow(Ptr::Ref bundle) + throw () + : WhiteWindow("", + Colors::White, + WidgetFactory::getInstance()->getWhiteWindowCorners(), + WhiteWindow::isModal | WhiteWindow::isBornHidden), + LocalizedObject(bundle) +{ + Ptr::Ref wf = WidgetFactory::getInstance(); + + Gtk::Label * hourLabel; + Gtk::Label * minuteLabel; + Button * cancelButton; + Button * okButton; + + try { + set_title(*getResourceUstring("windowTitle")); + hourLabel = Gtk::manage(new Gtk::Label( + *getResourceUstring("hourLabel"))); + minuteLabel = Gtk::manage(new Gtk::Label( + *getResourceUstring("minuteLabel"))); + cancelButton = Gtk::manage(wf->createButton( + *getResourceUstring("cancelButtonLabel"))); + okButton = Gtk::manage(wf->createButton( + *getResourceUstring("okButtonLabel"))); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + std::exit(1); + } + + calendar = Gtk::manage(new Gtk::Calendar()); + hourEntry = Gtk::manage(wf->createEntryBin()); + minuteEntry = Gtk::manage(wf->createEntryBin()); + + cancelButton->signal_clicked().connect(sigc::mem_fun(*this, + &DateTimeChooserWindow::onCancelButtonClicked)); + okButton->signal_clicked().connect(sigc::mem_fun(*this, + &DateTimeChooserWindow::onOkButtonClicked)); + + Gtk::ButtonBox * buttonBox = Gtk::manage(new Gtk::HButtonBox( + Gtk::BUTTONBOX_END, 5)); + buttonBox->pack_start(*cancelButton); + buttonBox->pack_start(*okButton); + + Gtk::Box * entryBox = Gtk::manage(new Gtk::HBox()); + entryBox->pack_start(*hourLabel, Gtk::PACK_SHRINK, 5); + entryBox->pack_start(*hourEntry, Gtk::PACK_EXPAND_WIDGET, 5); + entryBox->pack_start(*minuteLabel, Gtk::PACK_SHRINK, 5); + entryBox->pack_start(*minuteEntry, Gtk::PACK_EXPAND_WIDGET, 5); + + Gtk::Box * layout = Gtk::manage(new Gtk::VBox()); + layout->pack_start(*calendar, Gtk::PACK_EXPAND_WIDGET, 5); + layout->pack_start(*entryBox, Gtk::PACK_SHRINK, 5); + layout->pack_start(*buttonBox, Gtk::PACK_SHRINK, 5); + + set_default_size(200, 300); + + add(*layout); +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Cancel button clicked + *----------------------------------------------------------------------------*/ +void +DateTimeChooserWindow :: onCancelButtonClicked(void) throw () +{ + chosenDateTime.reset(); + hide(); +} + + +/*------------------------------------------------------------------------------ + * Event handler for the OK button clicked. + *----------------------------------------------------------------------------*/ +void +DateTimeChooserWindow :: onOkButtonClicked(void) throw () +{ + std::stringstream dateTime; + + guint year; + guint month; + guint day; + calendar->get_date(year, month, day); + dateTime << std::setfill('0') << std::setw(4) + << year + << std::setfill('0') << std::setw(2) + << month + 1 + << std::setfill('0') << std::setw(2) + << day; + + Glib::ustring hour = hourEntry ->get_text().substr(0,2); + Glib::ustring minute = minuteEntry->get_text().substr(0,2); + dateTime << "T" + << std::setfill('0') << std::setw(2) + << hour + << std::setfill('0') << std::setw(2) + << minute + << "00"; + + chosenDateTime.reset(new ptime(from_iso_string(dateTime.str()))); + + hide(); +} + + +/*------------------------------------------------------------------------------ + * Show the window and return the button clicked. + *----------------------------------------------------------------------------*/ +Ptr::Ref +DateTimeChooserWindow :: run(void) throw () +{ + show_all(); + Gtk::Main::run(*this); + return chosenDateTime; +} + diff --git a/livesupport/src/modules/widgets/src/WidgetFactory.cxx b/livesupport/src/modules/widgets/src/WidgetFactory.cxx index eeafc33c5..dc849d951 100644 --- a/livesupport/src/modules/widgets/src/WidgetFactory.cxx +++ b/livesupport/src/modules/widgets/src/WidgetFactory.cxx @@ -673,3 +673,14 @@ WidgetFactory :: createDialogWindow(Ptr::Ref message, return new DialogWindow(message, buttons, bundle); } + +/*------------------------------------------------------------------------------ + * Create a date/time chooser window. + *----------------------------------------------------------------------------*/ +DateTimeChooserWindow * +WidgetFactory :: createDateTimeChooserWindow(Ptr::Ref bundle) + throw () +{ + return new DateTimeChooserWindow(bundle); +} + diff --git a/livesupport/src/products/gLiveSupport/src/BackupView.cxx b/livesupport/src/products/gLiveSupport/src/BackupView.cxx index dfa9339c5..098b56618 100644 --- a/livesupport/src/products/gLiveSupport/src/BackupView.cxx +++ b/livesupport/src/products/gLiveSupport/src/BackupView.cxx @@ -39,13 +39,13 @@ #include #include -#include "LiveSupport/Widgets/ScrolledWindow.h" #include "BackupView.h" using namespace LiveSupport::Core; using namespace LiveSupport::Widgets; using namespace LiveSupport::GLiveSupport; +using namespace boost::posix_time; /* =================================================== local data structures */ @@ -67,26 +67,54 @@ BackupView :: BackupView (Ptr::Ref gLiveSupport, : LocalizedObject(bundle), gLiveSupport(gLiveSupport) { + Ptr::Ref wf = WidgetFactory::getInstance(); + Gtk::Label * backupTitleLabel; + Gtk::Label * mtimeLabel; + Gtk::Button * chooseTimeButton; + Gtk::Button * resetTimeButton; try { backupTitleLabel = Gtk::manage(new Gtk::Label( - *getResourceUstring("backupTitleLabel"))); + *getResourceUstring("backupTitleLabel"))); + mtimeLabel = Gtk::manage(new Gtk::Label( + *getResourceUstring("mtimeTextLabel"))); + chooseTimeButton = Gtk::manage(wf->createButton( + *getResourceUstring("chooseTimeButtonLabel"))); + resetTimeButton = Gtk::manage(wf->createButton( + *getResourceUstring("resetTimeButtonLabel"))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; std::exit(1); } - Ptr::Ref wf = WidgetFactory::getInstance(); + chooseTimeButton->signal_clicked().connect(sigc::mem_fun( + *this, &BackupView::onChooseTimeButtonClicked )); + resetTimeButton->signal_clicked().connect(sigc::mem_fun( + *this, &BackupView::onResetTimeButtonClicked )); + backupTitleEntry = Gtk::manage(wf->createEntryBin()); + mtimeEntry = Gtk::manage(wf->createEntryBin()); + + mtimeEntry->getEntry()->set_editable(false); + mtimeEntry->getEntry()->set_alignment(0.5); + mtimeEntry->getEntry()->set_width_chars(20); + writeMtimeEntry(); Gtk::Box * backupTitleBox = Gtk::manage(new Gtk::HBox); backupTitleBox->pack_start(*backupTitleLabel, Gtk::PACK_SHRINK, 5); backupTitleBox->pack_start(*backupTitleEntry, Gtk::PACK_SHRINK, 5); + Gtk::Box * mtimeBox = Gtk::manage(new Gtk::HBox); + mtimeBox->pack_start(*mtimeLabel, Gtk::PACK_SHRINK, 5); + mtimeBox->pack_start(*mtimeEntry, Gtk::PACK_SHRINK, 5); + mtimeBox->pack_start(*chooseTimeButton, Gtk::PACK_SHRINK, 5); + mtimeBox->pack_start(*resetTimeButton, Gtk::PACK_SHRINK, 5); + Gtk::Box * criteriaView = constructCriteriaView(); Gtk::Box * topPane = Gtk::manage(new Gtk::VBox); topPane->pack_start(*backupTitleBox, Gtk::PACK_SHRINK, 5); + topPane->pack_start(*mtimeBox, Gtk::PACK_SHRINK, 5); topPane->pack_start(*criteriaView, Gtk::PACK_EXPAND_WIDGET, 5); Gtk::Box * bottomPane = constructBackupListView(); @@ -96,6 +124,9 @@ BackupView :: BackupView (Ptr::Ref gLiveSupport, twoPanedView->pack2(*bottomPane, Gtk::PACK_EXPAND_WIDGET, 5); add(*twoPanedView); + + dateTimeChooserWindow.reset(wf->createDateTimeChooserWindow( + gLiveSupport->getBundle("dateTimeChooserWindow") )); } @@ -185,6 +216,32 @@ BackupView :: constructBackupListView(void) throw () } +/*------------------------------------------------------------------------------ + * Event handler for the time chooser button being clicked. + *----------------------------------------------------------------------------*/ +void +BackupView :: onChooseTimeButtonClicked(void) throw () +{ + Ptr::Ref userMtime = dateTimeChooserWindow->run(); + + if (userMtime && *userMtime != not_a_date_time) { + mtime = userMtime; + writeMtimeEntry(); + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the "reset time" button being clicked. + *----------------------------------------------------------------------------*/ +void +BackupView :: onResetTimeButtonClicked(void) throw () +{ + mtime.reset(); + writeMtimeEntry(); +} + + /*------------------------------------------------------------------------------ * Initiate the creation of a new backup. *----------------------------------------------------------------------------*/ @@ -194,6 +251,10 @@ BackupView :: onCreateBackup(void) throw () Ptr::Ref title = readTitle(); Ptr::Ref criteria = criteriaEntry->getSearchCriteria(); + if (mtime) { + criteria->addMtimeCondition(">=", mtime); + } + try { backupList->add(title, criteria); @@ -336,3 +397,17 @@ BackupView :: readTitle(void) throw () return title; } + +/*------------------------------------------------------------------------------ + * Format and write the contents of mtime into the mtimeEntry. + *----------------------------------------------------------------------------*/ +void +BackupView :: writeMtimeEntry(void) throw () +{ + if (mtime) { + mtimeEntry->set_text(to_simple_string(*mtime)); + } else { + mtimeEntry->set_text("-"); + } +} + diff --git a/livesupport/src/products/gLiveSupport/src/BackupView.h b/livesupport/src/products/gLiveSupport/src/BackupView.h index 3818abc78..4760398fc 100644 --- a/livesupport/src/products/gLiveSupport/src/BackupView.h +++ b/livesupport/src/products/gLiveSupport/src/BackupView.h @@ -41,11 +41,14 @@ #endif #include +#include #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/LocalizedObject.h" +#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Widgets/Button.h" #include "LiveSupport/Widgets/ScrolledWindow.h" +#include "LiveSupport/Widgets/DateTimeChooserWindow.h" #include "AdvancedSearchEntry.h" #include "BackupList.h" #include "GLiveSupport.h" @@ -55,6 +58,7 @@ namespace GLiveSupport { using namespace LiveSupport::Core; using namespace LiveSupport::Widgets; +using namespace boost::posix_time; /* ================================================================ constants */ @@ -94,6 +98,21 @@ class BackupView : public Gtk::VBox, */ EntryBin * backupTitleEntry; + /** + * The "modified since" time for the backup. + */ + Ptr::Ref mtime; + + /** + * The entry field holding the "modified since" time for the backup. + */ + EntryBin * mtimeEntry; + + /** + * The window for entering the "modified since" time. + */ + Ptr::Ref dateTimeChooserWindow; + /** * The object for entering the backup criteria. */ @@ -139,7 +158,13 @@ class BackupView : public Gtk::VBox, */ Ptr::Ref readTitle(void) throw (); - + + /** + * Format and write the contents of mtime into the mtimeEntry. + */ + void + writeMtimeEntry(void) throw (); + protected: /** @@ -147,6 +172,18 @@ class BackupView : public Gtk::VBox, */ Ptr::Ref gLiveSupport; + /** + * Event handler for the time chooser button being clicked. + */ + void + onChooseTimeButtonClicked(void) throw (); + + /** + * Event handler for the "reset time" button being clicked. + */ + void + onResetTimeButtonClicked(void) throw (); + /** * Initiate the creation of a new backup. */ diff --git a/livesupport/src/products/gLiveSupport/src/OptionsWindow.cxx b/livesupport/src/products/gLiveSupport/src/OptionsWindow.cxx index 61f9757ff..cab5e803c 100644 --- a/livesupport/src/products/gLiveSupport/src/OptionsWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/OptionsWindow.cxx @@ -163,7 +163,7 @@ OptionsWindow :: OptionsWindow (Ptr::Ref gLiveSupport, // show everything set_name(windowName); - set_default_size(700, 400); + set_default_size(700, 450); set_modal(false); property_window_position().set_value(Gtk::WIN_POS_NONE); diff --git a/livesupport/src/products/gLiveSupport/var/root.txt b/livesupport/src/products/gLiveSupport/var/root.txt index 3f210713f..6892003b4 100644 --- a/livesupport/src/products/gLiveSupport/var/root.txt +++ b/livesupport/src/products/gLiveSupport/var/root.txt @@ -280,6 +280,10 @@ root:table dateColumnLabel:string { "Date" } statusColumnLabel:string { "Status" } + mtimeTextLabel:string { "Modified since:" } + chooseTimeButtonLabel:string { "Choose time" } + resetTimeButtonLabel:string { "Reset" } + backupButtonLabel:string { "Backup" } deleteButtonLabel:string { "Delete" } saveButtonLabel:string { "Save" } @@ -291,6 +295,17 @@ root:table backupErrorMsg:string { "Backup error: " } } + dateTimeChooserWindow:table + { + windowTitle:string { "Select the date and time" } + + cancelButtonLabel:string { "Cancel" } + okButtonLabel:string { "OK" } + + hourLabel:string { "hour:" } + minuteLabel:string { "minute:" } + } + metadataTypes:table { title:string { "Title" }