This commit is contained in:
fgerlits 2005-06-28 19:03:54 +00:00
parent db6135efb8
commit c870f91164
3 changed files with 26 additions and 19 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.52 $ Version : $Revision: 1.53 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -637,29 +637,31 @@ LiveSupport :: GLiveSupport ::
GLiveSupport :: openPlaylistForEditing(Ptr<UniqueId>::Ref playlistId) GLiveSupport :: openPlaylistForEditing(Ptr<UniqueId>::Ref playlistId)
throw (XmlRpcException) throw (XmlRpcException)
{ {
releaseEditedPlaylist(); cancelEditedPlaylist();
if (!playlistId.get()) { if (!playlistId.get()) {
playlistId = storage->createPlaylist(sessionId); playlistId = storage->createPlaylist(sessionId);
} }
editedPlaylist = storage->editPlaylist(sessionId, playlistId); editedPlaylist = storage->editPlaylist(sessionId, playlistId);
editedPlaylist->createSavedCopy();
return editedPlaylist; return editedPlaylist;
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Release the edited playlist. * Cancel the edited playlist: undo changes and release the lock.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
LiveSupport :: GLiveSupport :: LiveSupport :: GLiveSupport ::
GLiveSupport :: releaseEditedPlaylist(void) GLiveSupport :: cancelEditedPlaylist(void)
throw (XmlRpcException) throw (XmlRpcException)
{ {
if (editedPlaylist.get()) { if (editedPlaylist) {
if (editedPlaylist->isLocked()) { if (editedPlaylist->isLocked()) {
storage->releasePlaylist(editedPlaylist); editedPlaylist->revertToSavedCopy();
storage->savePlaylist(sessionId, editedPlaylist);
} }
editedPlaylist.reset(); editedPlaylist.reset();
} }
@ -703,12 +705,17 @@ LiveSupport :: GLiveSupport ::
GLiveSupport :: savePlaylist(void) GLiveSupport :: savePlaylist(void)
throw (XmlRpcException) throw (XmlRpcException)
{ {
storage->savePlaylist(sessionId, editedPlaylist); Ptr<Playlist>::Ref playlist;
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId, if (editedPlaylist) {
editedPlaylist->getId()); if (editedPlaylist->isLocked()) {
addToScratchpad(playlist); editedPlaylist->deleteSavedCopy();
editedPlaylist.reset(); storage->savePlaylist(sessionId, editedPlaylist);
playlist = storage->getPlaylist(sessionId, editedPlaylist->getId());
addToScratchpad(playlist);
}
editedPlaylist.reset();
}
return playlist; return playlist;
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.40 $ Version : $Revision: 1.41 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -102,7 +102,7 @@ class MasterPanelWindow;
* respective documentation. * respective documentation.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.40 $ * @version $Revision: 1.41 $
* @see LocalizedObject#getBundle(const xmlpp::Element &) * @see LocalizedObject#getBundle(const xmlpp::Element &)
* @see AuthenticationClientFactory * @see AuthenticationClientFactory
* @see StorageClientFactory * @see StorageClientFactory
@ -546,13 +546,13 @@ class GLiveSupport : public LocalizedConfigurable,
savePlaylist(void) throw (XmlRpcException); savePlaylist(void) throw (XmlRpcException);
/** /**
* Release the playlist that was opened for editing. * Cancel the edited playlist: undo changes and release the lock.
* *
* @exception XmlRpcException on XML-RPC errors. * @exception XmlRpcException on XML-RPC errors.
* @see #openPlaylistForEditing * @see #openPlaylistForEditing
*/ */
void void
releaseEditedPlaylist(void) throw (XmlRpcException); cancelEditedPlaylist(void) throw (XmlRpcException);
/** /**
* Return the scheduled entries for a specified time interval. * Return the scheduled entries for a specified time interval.

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.14 $ Version : $Revision: 1.15 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -175,6 +175,7 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
title.reset(new Glib::ustring(nameEntry->get_text())); title.reset(new Glib::ustring(nameEntry->get_text()));
// TODO: check for empty title and display "are you sure?" message
playlist = gLiveSupport->getEditedPlaylist(); playlist = gLiveSupport->getEditedPlaylist();
if (!playlist) { if (!playlist) {
@ -190,8 +191,6 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
*playlist->getTitle()); *playlist->getTitle());
statusBar->set_text(*statusText); statusBar->set_text(*statusText);
gLiveSupport->releaseEditedPlaylist();
// clean the entry fields // clean the entry fields
nameEntry->set_text(""); nameEntry->set_text("");
entriesModel->clear(); entriesModel->clear();
@ -207,7 +206,8 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
void void
SimplePlaylistManagementWindow :: onCloseButtonClicked (void) throw () SimplePlaylistManagementWindow :: onCloseButtonClicked (void) throw ()
{ {
gLiveSupport->releaseEditedPlaylist(); // TODO: display "are you sure?" message
gLiveSupport->cancelEditedPlaylist();
hide(); hide();
} }