Skip to content

Commit

Permalink
Adding mail.StartingLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Nov 23, 2022
1 parent 4f423d7 commit ef0e67e
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/org/luwrain/app/mail/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public final class App extends AppBase<Strings> implements MonoApp
private MailStoring storing = null;
private Conv conv = null;
private MainLayout mainLayout = null;
private StartingLayout startingLayout = null;

public App()
{
Expand All @@ -42,13 +43,16 @@ public App()
@Override protected AreaLayout onAppInit()
{
this.hooks = new Hooks(getLuwrain());
/*
this.storing = org.luwrain.pim.Connections.getMailStoring(getLuwrain(), true);
if (storing == null)
return null;
*/
this.conv = new Conv(this);
this.mainLayout = new MainLayout(this);
// this.mainLayout = new MainLayout(this);
this.startingLayout = new StartingLayout(this);
setAppName(getStrings().appName());
return mainLayout.getAreaLayout();
return startingLayout.getAreaLayout();
}

boolean fetchIncomingBkg()
Expand Down
67 changes: 67 additions & 0 deletions src/main/java/org/luwrain/app/mail/StartingLayout.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2012-2021 Michael Pozhidaev <[email protected]>
Copyright 2015-2016 Roman Volovodov <[email protected]>
This file is part of LUWRAIN.
LUWRAIN is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
LUWRAIN is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/

package org.luwrain.app.mail;

import java.util.*;
import java.io.*;

import org.luwrain.core.*;
import org.luwrain.core.events.*;
import org.luwrain.controls.*;
import org.luwrain.app.base.*;

import org.luwrain.controls.WizardArea.Frame;
import org.luwrain.controls.WizardArea.WizardValues;

final class StartingLayout extends LayoutBase
{
final App app;
final WizardArea wizardArea;
final Frame introFrame;

private String mail = "", passwd = "";

StartingLayout(App app)
{
super(app);
this.app = app;
this.wizardArea = new WizardArea(getControlContext()) ;
this.introFrame = wizardArea.newFrame()
.addText(app.getStrings().wizardIntro())
.addInput(app.getStrings().wizardMailAddr(), "")
.addClickable(app.getStrings().wizardContinue(), this::onContinue);
wizardArea.show(introFrame);
setAreaLayout(wizardArea, null);
}

private boolean onContinue(WizardValues values)
{
final String mail = values.getText(0).trim();
if (mail.isEmpty())
{
app.message(app.getStrings().wizardMailAddrIsEmpty(), Luwrain.MessageType.ERROR);
return true;
}
if (!mail.matches(".*@.*\\..*"))
{
app.message(app.getStrings().wizardMailAddrIsInvalid(), Luwrain.MessageType.ERROR);
return true;
}
return false;
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/luwrain/app/mail/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ public interface Strings
String messageAreaTo();
String summaryAreaName();
String actionFetchIncomingBkg();

String wizardIntro();
String wizardMailAddr();
String wizardMailAddrIsEmpty();
String wizardMailAddrIsInvalid();
String wizardContinue();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ MessageAreaName = Сообщение
MessageAreaSubject = Тема:
MessageAreaTo = Кому:
SummaryAreaName = Сообщения

WizardIntro = Необходимо произвести подключение к учётной записи вашей электронной почты. Укажите ваш адрес электронной почты в поле ниже и нажмите кнопку "Продолжить".
WizardMailAddr = Адрес электронной почты:
WizardMailAddrIsEmpty = Адрес электронной почты не может быть пустым
WizardMailAddrIsInvalid = Указанное значение не является допустимым адресом электронной почты
WizardContinue = Продолжить

0 comments on commit ef0e67e

Please sign in to comment.