Configuration oldConfiguration;
Configuration newConfiguration = null;
boolean firstStart = !new File("sone.properties").exists();
+ boolean newConfig = false;
try {
oldConfiguration = new Configuration(new MapConfigurationBackend(new File("sone.properties"), false));
newConfiguration = oldConfiguration;
} catch (ConfigurationException ce1) {
+ newConfig = true;
logger.log(Level.INFO, "Could not load configuration file, trying plugin store…", ce1);
try {
newConfiguration = new Configuration(new MapConfigurationBackend(new File("sone.properties"), true));
/* create the web interface. */
webInterface = new WebInterface(this);
webInterface.setFirstStart(firstStart);
+ webInterface.setNewConfig(newConfig);
core.addCoreListener(webInterface);
/* create the identity manager. */
}
}
+ /**
+ * Sets whether Sone was started with a fresh configuration file.
+ *
+ * @param newConfig
+ * {@code true} if Sone was started with a fresh configuration,
+ * {@code false} if the existing configuration could be read
+ */
+ public void setNewConfig(boolean newConfig) {
+ if (newConfig && (notificationManager.getNotification("first-start-notification") == null)) {
+ Template configNotReadNotificationTemplate = new Template(createReader("/templates/notify/configNotReadNotification.html"));
+ Notification configNotReadNotification = new TemplateNotification("config-not-read-notification", configNotReadNotificationTemplate);
+ notificationManager.addNotification(configNotReadNotification);
+ }
+ }
+
//
// ACTIONS
//
Notification.FirstStart.Text=This seems to be the first time you start Sone. To start, create a new Sone from a web of trust identity and start following other Sones.
Notification.Startup.Text=Sone is currently starting up. It may take a while to retrieve all identities and Sones from the web of trust. If you are missing some elements, please be patient, they will probably reappear very soon.
+Notification.ConfigNotRead.Text=The configuration file “sone.properties” could not be read, probably because it was not saved correctly. This can happen on versions prior to Sone 0.3.3 and there is nothing you can do about it.
Notification.Button.Dismiss=Dismiss
Notification.NewSone.Text=New Sones have been discovered:
Notification.NewPost.Text=New posts have been discovered by the following Sones:
--- /dev/null
+<div class="text"><%= Notification.ConfigNotRead.Text|l10n|html></div>