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 $
Version : $Revision: 1.52 $
Version : $Revision: 1.53 $
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)
throw (XmlRpcException)
{
releaseEditedPlaylist();
cancelEditedPlaylist();
if (!playlistId.get()) {
playlistId = storage->createPlaylist(sessionId);
}
editedPlaylist = storage->editPlaylist(sessionId, playlistId);
editedPlaylist->createSavedCopy();
return editedPlaylist;
}
/*------------------------------------------------------------------------------
* Release the edited playlist.
* Cancel the edited playlist: undo changes and release the lock.
*----------------------------------------------------------------------------*/
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: releaseEditedPlaylist(void)
GLiveSupport :: cancelEditedPlaylist(void)
throw (XmlRpcException)
{
if (editedPlaylist.get()) {
if (editedPlaylist) {
if (editedPlaylist->isLocked()) {
storage->releasePlaylist(editedPlaylist);
editedPlaylist->revertToSavedCopy();
storage->savePlaylist(sessionId, editedPlaylist);
}
editedPlaylist.reset();
}
@ -703,12 +705,17 @@ LiveSupport :: GLiveSupport ::
GLiveSupport :: savePlaylist(void)
throw (XmlRpcException)
{
storage->savePlaylist(sessionId, editedPlaylist);
Ptr<Playlist>::Ref playlist;
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId,
editedPlaylist->getId());
addToScratchpad(playlist);
editedPlaylist.reset();
if (editedPlaylist) {
if (editedPlaylist->isLocked()) {
editedPlaylist->deleteSavedCopy();
storage->savePlaylist(sessionId, editedPlaylist);
playlist = storage->getPlaylist(sessionId, editedPlaylist->getId());
addToScratchpad(playlist);
}
editedPlaylist.reset();
}
return playlist;
}

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -102,7 +102,7 @@ class MasterPanelWindow;
* respective documentation.
*
* @author $Author: fgerlits $
* @version $Revision: 1.40 $
* @version $Revision: 1.41 $
* @see LocalizedObject#getBundle(const xmlpp::Element &)
* @see AuthenticationClientFactory
* @see StorageClientFactory
@ -546,13 +546,13 @@ class GLiveSupport : public LocalizedConfigurable,
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.
* @see #openPlaylistForEditing
*/
void
releaseEditedPlaylist(void) throw (XmlRpcException);
cancelEditedPlaylist(void) throw (XmlRpcException);
/**
* Return the scheduled entries for a specified time interval.

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -175,6 +175,7 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
Ptr<Playlist>::Ref playlist;
title.reset(new Glib::ustring(nameEntry->get_text()));
// TODO: check for empty title and display "are you sure?" message
playlist = gLiveSupport->getEditedPlaylist();
if (!playlist) {
@ -190,8 +191,6 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
*playlist->getTitle());
statusBar->set_text(*statusText);
gLiveSupport->releaseEditedPlaylist();
// clean the entry fields
nameEntry->set_text("");
entriesModel->clear();
@ -207,7 +206,8 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
void
SimplePlaylistManagementWindow :: onCloseButtonClicked (void) throw ()
{
gLiveSupport->releaseEditedPlaylist();
// TODO: display "are you sure?" message
gLiveSupport->cancelEditedPlaylist();
hide();
}