Skip to content

Commit

Permalink
Save issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ramvibhakar committed Jul 27, 2015
1 parent 69f0ae0 commit 49830d4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import sg.edu.smu.ksketch2.canvas.KSketch_LoginView;
import sg.edu.smu.ksketch2.canvas.components.view.KSketch_CanvasView;
import sg.edu.smu.ksketch2.canvas.components.view.KSketch_HomeView;
import sg.edu.smu.ksketch2.canvas.controls.KFileControl;
import sg.edu.smu.ksketch2.canvas.controls.KSketch_CacheControl;
import sg.edu.smu.ksketch2.utils.KWebData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
private var itemRender:IFactory = new ClassFactory(KSketch_HomeView_IconItemRenderer);
private function init(isMobile:Boolean):void {
KSketchStyles.setView();
//Check for mobile version. Set false to export for Desktop version
if (isMobile) {
mainButtons.removeElementAt(2);
Expand Down Expand Up @@ -211,7 +211,9 @@
_loginView = dataProxy.loginView;
if (userData.userObject.id != "n.a") {
dataProxy.userObject.token = dataProxy.token;
if (dataProxy.token) {
dataProxy.userObject.token = dataProxy.token;
}
_cacheControl.user = dataProxy.userObject;
loginButton.label = "Logout, " + userData.userObject.u_realname;
refreshButton.label = "Refresh";
Expand All @@ -227,7 +229,7 @@
refreshButton.visible = false;
}
_failedLogin = false;
refresh();
//refresh();
}
userData.homeView = this;
userData.cacheControl = _cacheControl;
Expand Down Expand Up @@ -304,7 +306,7 @@
arr.addItem(sortedArr.itemAt(i));
}
var sort:Sort = new Sort();
sort.fields = [new SortField("fileName",true)];
sort.fields = [new SortField("fileName", true)];
arr.sort = sort;
arr.refresh();
arrDG = arr;
Expand Down Expand Up @@ -383,15 +385,13 @@
//if this is a logout button, then reset view & delete cache
if (loginButton.label.indexOf("Login") == -1) {
logout();
if(!_cacheControl.unsavedSketchExist())
{
logout();
}
else
{
_logoffNotice.open(this,true);
PopUpManager.centerPopUp(_logoffNotice);
}
if (!_cacheControl.unsavedSketchExist()) {
logout();
}
else {
_logoffNotice.open(this, true);
PopUpManager.centerPopUp(_logoffNotice);
}
}
else {
navigator.pushView(KSketch_LoginView);
Expand All @@ -408,7 +408,7 @@
var sketchName:String = KSketch_HomeView_IconItemRenderer.selectedSketchName;
var sketchId:String = KSketch_HomeView_IconItemRenderer.selectedSketchId;
var sketchVersion:String = KSketch_HomeView_IconItemRenderer.selectedVersion;
_cacheControl.deleteSketch(sketchId,int(sketchVersion),sketchName);
_cacheControl.deleteSketch(sketchId, int(sketchVersion), sketchName);
}
protected function listSketches_logSketchHandler(event:KSwipeEvent):void {
Expand Down Expand Up @@ -474,7 +474,7 @@
//if action bar is displayed and there is a delete sketch flag
if (KSketch_HomeView_IconItemRenderer.openActionBar && _deleteSketchFlag)
_cacheControl.deleteSketch(sketchId,int(sketchVersion),sketchName);
_cacheControl.deleteSketch(sketchId, int(sketchVersion), sketchName);
_isSwipe = false;
}
Expand All @@ -491,7 +491,7 @@
return itemRender;
}
public function handleExpiredSession(){
public function handleExpiredSession() {
_canvasNotice._parent = KSketch_CanvasNotice.CANVASNOTICE_EXPIRED_SESSION;
_canvasNotice.open(this, true);
PopUpManager.centerPopUp(_canvasNotice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ import flash.net.SharedObject;
var list:SortedList = cachedList;
var obj:KSketch_ListItem = new KSketch_ListItem();
obj.fromCache(sketchObj);
obj.isSaved = false;
obj.uniqueId = sketchObj.uniqueId;
list.add(obj);
cachedList = list;
}
Expand All @@ -368,6 +370,15 @@ import flash.net.SharedObject;
}
}
cachedDocuments = arr;
var list:SortedList = cachedList;
for(var i:int=0;i<list.size;i++) {
if(list.itemAt(i).uniqueId == uniqueId){
list.itemAt(i).sketchId = sketchId;
list.itemAt(i).isSaved = true;
break;
}
}
cachedDocuments = arr;
}

public function isLoggedIn():Boolean
Expand Down

0 comments on commit 49830d4

Please sign in to comment.