aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java39
-rw-r--r--src/main/res/menu/muc_details.xml10
-rw-r--r--src/main/res/values-de/strings.xml2
3 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index 47a11e01..27aa6976 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -27,6 +27,8 @@ import java.util.List;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
+import eu.siacs.conversations.entities.Account;
+import eu.siacs.conversations.entities.Bookmark;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.MucOptions.User;
@@ -161,6 +163,12 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
});
}
break;
+ case R.id.action_save_as_bookmark:
+ saveAsBookmark();
+ break;
+ case R.id.action_delete_bookmark:
+ deleteBookmark();
+ break;
}
return super.onOptionsItemSelected(menuItem);
}
@@ -188,6 +196,21 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
@Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark);
+ MenuItem menuItemDeleteBookmark = menu.findItem(R.id.action_delete_bookmark);
+ Account account = mConversation.getAccount();
+ if (account.hasBookmarkFor(mConversation.getContactJid().toBareJid())) {
+ menuItemSaveBookmark.setVisible(false);
+ menuItemDeleteBookmark.setVisible(true);
+ } else {
+ menuItemDeleteBookmark.setVisible(false);
+ menuItemSaveBookmark.setVisible(true);
+ }
+ return true;
+ }
+
+ @Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.muc_details, menu);
return true;
@@ -236,6 +259,22 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
}
+ protected void saveAsBookmark() {
+ Account account = mConversation.getAccount();
+ Bookmark bookmark = new Bookmark(account, mConversation.getContactJid().toBareJid());
+ account.getBookmarks().add(bookmark);
+ xmppConnectionService.pushBookmarks(account);
+ mConversation.setBookmark(bookmark);
+ }
+
+ protected void deleteBookmark() {
+ Account account = mConversation.getAccount();
+ Bookmark bookmark = mConversation.getBookmark();
+ bookmark.unregisterConversation();
+ account.getBookmarks().remove(bookmark);
+ xmppConnectionService.pushBookmarks(account);
+ }
+
@Override
void onBackendConnected() {
if (getIntent().getAction().equals(ACTION_VIEW_MUC)) {
diff --git a/src/main/res/menu/muc_details.xml b/src/main/res/menu/muc_details.xml
index 84b90e17..341d438a 100644
--- a/src/main/res/menu/muc_details.xml
+++ b/src/main/res/menu/muc_details.xml
@@ -12,6 +12,16 @@
android:title="@string/show_qr_code"
android:showAsAction="never" />
<item
+ android:id="@+id/action_save_as_bookmark"
+ android:title="@string/save_as_bookmark"
+ android:orderInCategory="80"
+ android:showAsAction="never" />
+ <item
+ android:id="@+id/action_delete_bookmark"
+ android:title="@string/delete_bookmark"
+ android:orderInCategory="80"
+ android:showAsAction="never" />
+ <item
android:id="@+id/action_accounts"
android:orderInCategory="90"
android:showAsAction="never"
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 91a2030d..7791b2c3 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -332,4 +332,6 @@
<string name="no_conference_server_found">Konferenz-Server kann nicht gefunden werden</string>
<string name="conference_creation_failed">Starten der Konferenz fehlgeschlagen!</string>
<string name="conference_created">Konferenz erstellt!</string>
+ <string name="secret_accepted">Schlüssel akzeptiert!</string>
+ <string name="reset">Zurücksetzen</string>
</resources>