Code refactoring

This commit is contained in:
RainLoop Team 2014-08-26 19:24:47 +04:00
parent 4a95dd6195
commit 36329110e5
81 changed files with 3474 additions and 2124 deletions

View file

@ -25,7 +25,7 @@
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAddAccount');
var RL = require('../../Boots/RainLoopApp.js');
var App = require('../../Apps/RainLoopApp.js');
this.email = ko.observable('');
this.password = ko.observable('');
@ -65,7 +65,7 @@
{
if (oData.Result)
{
RL.accountsAndIdentities();
App.accountsAndIdentities();
this.cancelCommand();
}
else if (oData.ErrorCode)

View file

@ -23,7 +23,7 @@
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAddOpenPgpKey');
var RL = require('../../Boots/RainLoopApp.js');
var App = require('../../Apps/RainLoopApp.js');
this.key = ko.observable('');
this.key.error = ko.observable(false);
@ -79,7 +79,7 @@
oOpenpgpKeyring.store();
RL.reloadOpenPgpKeys();
App.reloadOpenPgpKeys();
Utils.delegateRun(this, 'cancelCommand');
return true;

View file

@ -45,7 +45,7 @@
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsCompose');
var RL = require('../../Boots/RainLoopApp.js');
var App = require('../../Apps/RainLoopApp.js');
this.oEditor = null;
this.aDraftInfo = null;
@ -219,7 +219,7 @@
this.deleteCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
App.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
kn.hideScreenPopup(PopupsComposeViewModel);
}, function () {
@ -278,7 +278,7 @@
}
Cache.setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], aFlagsCache);
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
App.reloadFlagsCurrentMessageListAndMessageFromCache();
Cache.setFolderHash(this.aDraftInfo[2], '');
}
}
@ -415,8 +415,8 @@
PopupsComposeViewModel.prototype.emailsSource = function (oData, fResponse)
{
var RL = require('../../Boots/RainLoopApp.js');
RL.getAutocomplete(oData.term, function (aData) {
var App = require('../../Apps/RainLoopApp.js');
App.getAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oEmailItem) {
return oEmailItem.toLine(false);
}));
@ -446,7 +446,7 @@
PopupsComposeViewModel.prototype.reloadDraftFolder = function ()
{
var
RL = require('../../Boots/RainLoopApp.js'),
App = require('../../Apps/RainLoopApp.js'),
sDraftFolder = Data.draftFolder()
;
@ -455,11 +455,11 @@
Cache.setFolderHash(sDraftFolder, '');
if (Data.currentFolderFullNameRaw() === sDraftFolder)
{
RL.reloadMessageList(true);
App.reloadMessageList(true);
}
else
{
RL.folderInformation(sDraftFolder);
App.folderInformation(sDraftFolder);
}
}
};

View file

@ -353,10 +353,10 @@
var
self = this,
RL = require('../../Boots/RainLoopApp.js')
App = require('../../Apps/RainLoopApp.js')
;
RL.contactsSync(function (sResult, oData) {
App.contactsSync(function (sResult, oData) {
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
window.alert(Utils.getNotification(
@ -401,8 +401,8 @@
PopupsContactsViewModel.prototype.contactTagsSource = function (oData, fResponse)
{
var RL = require('../../Boots/RainLoopApp.js');
RL.getContactTagsAutocomplete(oData.term, function (aData) {
var App = require('../../Apps/RainLoopApp.js');
App.getContactTagsAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oTagItem) {
return oTagItem.toLine(false);
}));
@ -487,14 +487,14 @@
PopupsContactsViewModel.prototype.exportVcf = function ()
{
var RL = require('../../Boots/RainLoopApp.js');
RL.download(LinkBuilder.exportContactsVcf());
var App = require('../../Apps/RainLoopApp.js');
App.download(LinkBuilder.exportContactsVcf());
};
PopupsContactsViewModel.prototype.exportCsv = function ()
{
var RL = require('../../Boots/RainLoopApp.js');
RL.download(LinkBuilder.exportContactsCsv());
var App = require('../../Apps/RainLoopApp.js');
App.download(LinkBuilder.exportContactsCsv());
};
PopupsContactsViewModel.prototype.initUploader = function ()

View file

@ -235,8 +235,8 @@
{
if (oData.Result)
{
var RL = require('../../Boots/AdminApp.js');
RL.reloadDomainList();
var App = require('../../Apps/AdminApp.js');
App.reloadDomainList();
this.closeCommand();
}

View file

@ -26,7 +26,7 @@
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsFolderClear');
var RL = require('../../Boots/RainLoopApp.js');
var App = require('../../Apps/RainLoopApp.js');
this.selectedFolder = ko.observable(null);
this.clearingProcess = ko.observable(false);
@ -62,13 +62,17 @@
this.clearingProcess(true);
oFolderToClear.messageCountAll(0);
oFolderToClear.messageCountUnread(0);
Cache.setFolderHash(oFolderToClear.fullNameRaw, '');
Remote.folderClear(function (sResult, oData) {
self.clearingProcess(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
RL.reloadMessageList(true);
App.reloadMessageList(true);
self.cancelCommand();
}
else

View file

@ -65,7 +65,7 @@
this.createFolder = Utils.createCommand(this, function () {
var
RL = require('../../Boots/RainLoopApp.js'),
App = require('../../Apps/RainLoopApp.js'),
sParentFolderName = this.selectedParentValue()
;
@ -80,7 +80,7 @@
Data.foldersCreating(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
RL.folders();
App.folders();
}
else
{

View file

@ -25,7 +25,7 @@
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsGenerateNewOpenPgpKey');
var RL = require('../../Boots/RainLoopApp.js');
var App = require('../../Apps/RainLoopApp.js');
this.email = ko.observable('');
this.email.focus = ko.observable('');
@ -78,7 +78,7 @@
oOpenpgpKeyring.publicKeys.importKey(mKeyPair.publicKeyArmored);
oOpenpgpKeyring.store();
RL.reloadOpenPgpKeys();
App.reloadOpenPgpKeys();
Utils.delegateRun(self, 'cancelCommand');
}

View file

@ -25,7 +25,7 @@
{
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsIdentity');
var RL = require('../../Boots/RainLoopApp.js');
var App = require('../../Apps/RainLoopApp.js');
this.id = '';
this.edit = ko.observable(false);
@ -85,7 +85,7 @@
{
if (oData.Result)
{
RL.accountsAndIdentities();
App.accountsAndIdentities();
this.cancelCommand();
}
else if (oData.ErrorCode)