make shortcuts honour the account setting for the startup folder even if changed after shortcut creation, based on cketti's patch, refs issue 1025

This commit is contained in:
Thialfihar 2010-07-07 18:31:16 +00:00
parent 00a8f948eb
commit 76df04e949
3 changed files with 20 additions and 16 deletions

View File

@ -151,10 +151,6 @@
<activity
android:name="com.fsck.k9.activity.MessageList"
android:launchMode="singleTask">
<intent-filter>
<!-- This action is only to allow an entry point for launcher shortcuts -->
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="com.fsck.k9.activity.MessageView"

View File

@ -51,6 +51,7 @@ public class FolderList extends K9ListActivity
private static final String EXTRA_INITIAL_FOLDER = "initialFolder";
private static final String EXTRA_FROM_NOTIFICATION = "fromNotification";
private static final String EXTRA_FROM_SHORTCUT = "fromShortcut";
private static final boolean REFRESH_REMOTE = true;
@ -210,10 +211,15 @@ public class FolderList extends K9ListActivity
public static Intent actionHandleAccountIntent(Context context, Account account)
{
return actionHandleAccountIntent(context, account, null);
return actionHandleAccountIntent(context, account, null, false);
}
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder)
{
return actionHandleAccountIntent(context, account, initialFolder, false);
}
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder, boolean fromShortcut)
{
Intent intent = new Intent(context, FolderList.class);
intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
@ -222,6 +228,12 @@ public class FolderList extends K9ListActivity
{
intent.putExtra(EXTRA_INITIAL_FOLDER, initialFolder);
}
if (fromShortcut)
{
intent.putExtra(EXTRA_FROM_SHORTCUT, true);
}
return intent;
}
@ -306,6 +318,12 @@ public class FolderList extends K9ListActivity
onOpenFolder(initialFolder);
finish();
}
else if (intent.getBooleanExtra(EXTRA_FROM_SHORTCUT, false) &&
!K9.FOLDER_NONE.equals(mAccount.getAutoExpandFolderName()))
{
onOpenFolder(mAccount.getAutoExpandFolderName());
finish();
}
else
{

View File

@ -57,17 +57,7 @@ public class LauncherShortcuts extends K9ListActivity implements OnItemClickList
private void setupShortcut(Account account)
{
Intent shortcutIntent = null;
if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName()))
{
shortcutIntent = FolderList.actionHandleAccountIntent(this, account);
}
else
{
shortcutIntent =
MessageList.actionHandleFolderIntent(this, account,
account.getAutoExpandFolderName());
}
final Intent shortcutIntent = FolderList.actionHandleAccountIntent(this, account, null, true);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);