Skip to content

Commit

Permalink
Added ability to log out.
Browse files Browse the repository at this point in the history
When adding a new album, pictures that were added to the list of pictures to upload are no longer forgotten.
  • Loading branch information
Pierre-Luc Paour committed Nov 11, 2002
1 parent 9696c8c commit 349a580
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
17 changes: 10 additions & 7 deletions com/gallery/GalleryRemote/GalleryComm.java
Expand Up @@ -41,6 +41,11 @@
public abstract class GalleryComm {
private static final String MODULE = "GalComm";
int[] capabilities = null;

/**
* Flag to hold logged in status. Only need to log in once.
*/
protected boolean isLoggedIn = false;

/* -------------------------------------------------------------------------
* STATIC INITIALIZATON
Expand Down Expand Up @@ -105,16 +110,14 @@ public void newAlbum( StatusUpdate su, Album parentAlbum,
throw new RuntimeException( "This method is not available on this protocol" );
}

/**
* Causes the GalleryComm instance to fetch the album properties
* for the given Album.
*
* @param su an instance that implements the StatusUpdate interface.
*/
public void logOut() {
throw new RuntimeException( "This method is not available on this protocol" );
isLoggedIn = false;
}

public boolean isLoggedIn() {
return isLoggedIn;
}

public boolean hasCapability(int capability) {
return java.util.Arrays.binarySearch(capabilities, capability) >= 0;
}
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/GalleryComm1.java
Expand Up @@ -34,7 +34,6 @@ public class GalleryComm1 extends GalleryComm implements GalleryCommCapabilities
public static final String PROTOCAL_VERSION = "1";
public static final String SCRIPT_NAME = "gallery_remote.php";

protected boolean isLoggedIn = false;
protected Gallery g = null;
int pId = -1;

Expand Down
15 changes: 3 additions & 12 deletions com/gallery/GalleryRemote/GalleryComm2.java
Expand Up @@ -60,11 +60,6 @@ public class GalleryComm2 extends GalleryComm implements GalleryComm2Consts,
* INSTANCE VARIABLES
*/

/**
* Flag to hold logged in status. Only need to log in once.
*/
protected boolean isLoggedIn = false;

/**
* The gallery this GalleryComm2 instance is attached to.
*/
Expand Down Expand Up @@ -164,12 +159,6 @@ public void newAlbum( StatusUpdate su, Album parentAlbum,
newAlbumTitle, newAlbumDesc ), async );
}

/**
* Causes the GalleryComm2 instance to fetch the album properties
* for the given Album.
*
* @param su an instance that implements the StatusUpdate interface.
*/
public void logOut() {
isLoggedIn = false;
}
Expand Down Expand Up @@ -471,6 +460,7 @@ void runTask() {
// load and validate the response
Properties p = requestResponse( form_data );
if ( p.getProperty( "status" ).equals(GR_STAT_SUCCESS) ) {
ArrayList mAlbumList = new ArrayList();

// parse and store the data
int albumCount = Integer.parseInt( p.getProperty( "album_count" ) );
Expand Down Expand Up @@ -499,7 +489,7 @@ void runTask() {
a.setTitle( p.getProperty( titleKey ) );

a.setGallery( g );
g.addAlbum( a );
mAlbumList.add( a );

// map album ref nums to albums
ref2album.put( "" + i, a );
Expand All @@ -526,6 +516,7 @@ void runTask() {

status(su, "Fetched albums");

g.setAlbumList(mAlbumList);
} else {
error(su, "Error: " + p.getProperty( "status_text" ));
}
Expand Down

0 comments on commit 349a580

Please sign in to comment.