enable storing of GnuPG passphrase
[claws.git] / src / prefs_common.c
index 0dd45cc0f0178241eebce0c76a4109559a8b0acc..1c06e38e46a505353be4413860c7d81bf1828ce0 100644 (file)
@@ -125,6 +125,7 @@ static struct Compose {
 
        GtkWidget *checkbtn_quote;
        GtkWidget *checkbtn_forward_as_attachment;
+       GtkWidget *checkbtn_bounce_keep_from;
        GtkWidget *checkbtn_smart_wrapping;
        GtkWidget *checkbtn_block_cursor;
        GtkWidget *checkbtn_reply_with_quote;
@@ -193,6 +194,9 @@ static struct Message {
 static struct Privacy {
        GtkWidget *checkbtn_auto_check_signatures;
        GtkWidget *checkbtn_gpg_signature_popup;
+       GtkWidget *checkbtn_store_passphrase;
+       GtkWidget *spinbtn_store_passphrase;
+       GtkObject *spinbtn_store_passphrase_adj;
        GtkWidget *checkbtn_passphrase_grab;
        GtkWidget *checkbtn_gpg_warning;
        GtkWidget *optmenu_default_signkey;
@@ -347,10 +351,19 @@ static PrefParam param[] = {
        {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL,
         &compose.checkbtn_autoextedit,
         prefs_set_data_from_toggle, prefs_set_toggle},
-
+       {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment,
+        P_BOOL, &compose.checkbtn_forward_as_attachment,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"bounce_keep_from", "FALSE",
+        &prefs_common.bounce_keep_from, P_BOOL,
+        &compose.checkbtn_bounce_keep_from,
+        prefs_set_data_from_toggle, prefs_set_toggle},
        {"undo_level", "50", &prefs_common.undolevels, P_INT,
         &compose.spinbtn_undolevel,
         prefs_set_data_from_spinbtn, prefs_set_spinbtn},
+       {"block_cursor", "FALSE", &prefs_common.block_cursor,
+        P_BOOL, &compose.checkbtn_block_cursor,
+        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
         &compose.spinbtn_linewrap,
@@ -362,15 +375,9 @@ static PrefParam param[] = {
         &prefs_common.linewrap_at_send, P_BOOL,
         &compose.checkbtn_wrapatsend,
         prefs_set_data_from_toggle, prefs_set_toggle},
-       {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment,
-        P_BOOL, &compose.checkbtn_forward_as_attachment,
-        prefs_set_data_from_toggle, prefs_set_toggle},
         {"smart_wrapping", "TRUE", &prefs_common.smart_wrapping,
         P_BOOL, &compose.checkbtn_smart_wrapping,
         prefs_set_data_from_toggle, prefs_set_toggle},
-       {"block_cursor", "FALSE", &prefs_common.block_cursor,
-        P_BOOL, &compose.checkbtn_block_cursor,
-        prefs_set_data_from_toggle, prefs_set_toggle},
 #if USE_PSPELL
        {"enable_pspell", "TRUE", &prefs_common.enable_pspell,
         P_BOOL, &spelling.checkbtn_enable_pspell,
@@ -663,6 +670,12 @@ static PrefParam param[] = {
         &prefs_common.gpg_signature_popup, P_BOOL,
         &privacy.checkbtn_gpg_signature_popup,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL,
+        &privacy.checkbtn_store_passphrase,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"store_passphrase_timeout", "0", &prefs_common.store_passphrase_timeout,
+        P_INT, &privacy.spinbtn_store_passphrase, 
+        prefs_set_data_from_spinbtn, prefs_set_spinbtn},
 #ifndef __MINGW32__
        {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL,
         &privacy.checkbtn_passphrase_grab,
@@ -1681,8 +1694,10 @@ static void prefs_compose_create(void)
        GtkWidget *frame_reply;
        GtkWidget *checkbtn_quote;
        GtkWidget *checkbtn_forward_as_attachment;
+       GtkWidget *checkbtn_bounce_keep_from;
        GtkWidget *checkbtn_smart_wrapping;
        GtkWidget *checkbtn_block_cursor;
+       GtkWidget *frame_msgwrap;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -1727,7 +1742,7 @@ static void prefs_compose_create(void)
        gtk_widget_set_usize (entry_sigsep, 64, -1);
 
         /* Account autoselection */
-       PACK_FRAME(vbox1, frame_autosel, _("Automatic Account Selection"));
+       PACK_FRAME(vbox1, frame_autosel, _("Automatic account selection"));
 
        hbox_autosel = gtk_hbox_new (FALSE, VSPACING_NARROW);
        gtk_widget_show (hbox_autosel);
@@ -1750,9 +1765,45 @@ static void prefs_compose_create(void)
 
        PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2);
 
+       hbox5 = gtk_hbox_new (FALSE, 32);
+       gtk_widget_show (hbox5);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox5, FALSE, FALSE, 0);
+
+       PACK_CHECK_BUTTON (hbox5, checkbtn_forward_as_attachment,
+                          _("Forward as attachment"));
+
+       PACK_CHECK_BUTTON (hbox5, checkbtn_block_cursor,
+                         _("Block cursor"));
+
+       PACK_CHECK_BUTTON (vbox2, checkbtn_bounce_keep_from,
+                          _("Keep the original 'From' header when bouncing"));
+
+       hbox_undolevel = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox_undolevel);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox_undolevel, FALSE, FALSE, 0);
+
+       label_undolevel = gtk_label_new (_("Undo level"));
+       gtk_widget_show (label_undolevel);
+       gtk_box_pack_start (GTK_BOX (hbox_undolevel), label_undolevel, FALSE, FALSE, 0);
+
+       spinbtn_undolevel_adj = gtk_adjustment_new (50, 0, 100, 1, 10, 10);
+       spinbtn_undolevel = gtk_spin_button_new
+               (GTK_ADJUSTMENT (spinbtn_undolevel_adj), 1, 0);
+       gtk_widget_show (spinbtn_undolevel);
+       gtk_box_pack_start (GTK_BOX (hbox_undolevel), spinbtn_undolevel, FALSE, FALSE, 0);
+       gtk_widget_set_usize (spinbtn_undolevel, 64, -1);
+       gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE);
+
+       PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2);
+
         /* line-wrapping */
+       PACK_FRAME(vbox1, frame_msgwrap, _("Message wrapping"));
+
        vbox_linewrap = gtk_vbox_new (FALSE, VSPACING_NARROW);
        gtk_widget_show (vbox_linewrap);
+       gtk_container_add (GTK_CONTAINER (frame_msgwrap), vbox_linewrap);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox_linewrap), 8);
+
        gtk_box_pack_start (GTK_BOX (vbox1), vbox_linewrap, FALSE, FALSE, 0);
 
        hbox3 = gtk_hbox_new (FALSE, 8);
@@ -1786,33 +1837,9 @@ static void prefs_compose_create(void)
        PACK_CHECK_BUTTON
                (hbox4, checkbtn_wrapatsend, _("Wrap before sending"));
 
-       PACK_CHECK_BUTTON (vbox1, checkbtn_forward_as_attachment,
-                          _("Forward as attachment"));
-
-       PACK_CHECK_BUTTON (vbox1, checkbtn_smart_wrapping,
+       PACK_CHECK_BUTTON (vbox_linewrap, checkbtn_smart_wrapping,
                           _("Smart wrapping (EXPERIMENTAL)"));
        
-       PACK_CHECK_BUTTON (vbox1, checkbtn_block_cursor,
-                         _("Block cursor"));
-
-       PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2);
-
-       hbox_undolevel = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox3);
-       gtk_box_pack_start (GTK_BOX (vbox1), hbox_undolevel, FALSE, FALSE, 0);
-
-       label_undolevel = gtk_label_new (_("Undo level"));
-       gtk_widget_show (label_undolevel);
-       gtk_box_pack_start (GTK_BOX (hbox_undolevel), label_undolevel, FALSE, FALSE, 0);
-
-       spinbtn_undolevel_adj = gtk_adjustment_new (50, 0, 100, 1, 10, 10);
-       spinbtn_undolevel = gtk_spin_button_new
-               (GTK_ADJUSTMENT (spinbtn_undolevel_adj), 1, 0);
-       gtk_widget_show (spinbtn_undolevel);
-       gtk_box_pack_start (GTK_BOX (hbox_undolevel), spinbtn_undolevel, FALSE, FALSE, 0);
-       gtk_widget_set_usize (spinbtn_undolevel, 64, -1);
-       gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE);
-
        /*
        compose.checkbtn_quote   = checkbtn_quote;
        compose.entry_quotemark  = entry_quotemark;
@@ -1837,6 +1864,8 @@ static void prefs_compose_create(void)
 
        compose.checkbtn_forward_as_attachment =
                checkbtn_forward_as_attachment;
+       compose.checkbtn_bounce_keep_from =
+               checkbtn_bounce_keep_from;
        compose.checkbtn_smart_wrapping = 
                checkbtn_smart_wrapping;
        compose.checkbtn_block_cursor   =
@@ -2336,6 +2365,14 @@ static void prefs_privacy_create(void)
        GtkWidget *hbox1;
        GtkWidget *checkbtn_auto_check_signatures;
        GtkWidget *checkbtn_gpg_signature_popup;
+       GtkWidget *hbox_stpass;
+       GtkWidget *checkbtn_store_passphrase;
+       GtkWidget *label_stpass1;
+       GtkObject *spinbtn_store_passphrase_adj;
+       GtkWidget *spinbtn_store_passphrase;
+       GtkWidget *label_stpass2;
+       GtkWidget *hbox_stpassinfo;
+       GtkWidget *label_stpassinfo;
        GtkWidget *checkbtn_passphrase_grab;
        GtkWidget *checkbtn_gpg_warning;
        GtkWidget *label;
@@ -2358,6 +2395,43 @@ static void prefs_privacy_create(void)
        PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_signature_popup,
                           _("Show signature check result in a popup window"));
 
+       hbox_stpass = gtk_hbox_new(FALSE, 8);
+       gtk_box_pack_start(GTK_BOX(vbox2), hbox_stpass, FALSE, FALSE, 0);
+
+       PACK_CHECK_BUTTON (hbox_stpass, checkbtn_store_passphrase,
+                          _("Store passphrase temporarily"));
+
+       label_stpass1 = gtk_label_new(_("- remove after"));
+       gtk_box_pack_start(GTK_BOX(hbox_stpass), label_stpass1, FALSE, FALSE, 0);
+
+       spinbtn_store_passphrase_adj = gtk_adjustment_new(0, 0, 1440, 1, 5, 5);
+       spinbtn_store_passphrase = gtk_spin_button_new(
+                       GTK_ADJUSTMENT(spinbtn_store_passphrase_adj), 1, 0);
+       gtk_box_pack_start(GTK_BOX(hbox_stpass), spinbtn_store_passphrase, FALSE, 
+                          FALSE, 0);
+       gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinbtn_store_passphrase), 
+                                   TRUE);
+       gtk_widget_set_usize(spinbtn_store_passphrase, 50, -1);
+    
+       label_stpass2 = gtk_label_new(_("minute(s)"));
+       gtk_box_pack_start(GTK_BOX(hbox_stpass), label_stpass2, FALSE, FALSE, 0);
+       gtk_widget_show_all(hbox_stpass);
+
+       hbox_stpassinfo = gtk_hbox_new(FALSE, 8);
+       gtk_box_pack_start(GTK_BOX(vbox2), hbox_stpassinfo, FALSE, FALSE, 0);
+
+       label_stpassinfo = gtk_label_new
+               (_("(A setting of '0' will store the passphrase\n"
+                  " for the whole session)"));
+       gtk_box_pack_start (GTK_BOX (hbox_stpassinfo), label_stpassinfo, FALSE, FALSE, 0);
+       gtk_label_set_justify (GTK_LABEL (label_stpassinfo), GTK_JUSTIFY_LEFT);
+       gtk_widget_show_all(hbox_stpassinfo);
+
+       SET_TOGGLE_SENSITIVITY(checkbtn_store_passphrase, label_stpass1);
+       SET_TOGGLE_SENSITIVITY(checkbtn_store_passphrase, spinbtn_store_passphrase); 
+       SET_TOGGLE_SENSITIVITY(checkbtn_store_passphrase, label_stpass2);
+       SET_TOGGLE_SENSITIVITY(checkbtn_store_passphrase, label_stpassinfo);
+
 #ifndef __MINGW32__
        PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
                           _("Grab input while entering a passphrase"));
@@ -2390,6 +2464,9 @@ static void prefs_privacy_create(void)
                                         = checkbtn_auto_check_signatures;
        privacy.checkbtn_gpg_signature_popup
                                         = checkbtn_gpg_signature_popup;
+       privacy.checkbtn_store_passphrase    = checkbtn_store_passphrase;
+       privacy.spinbtn_store_passphrase     = spinbtn_store_passphrase;
+       privacy.spinbtn_store_passphrase_adj = spinbtn_store_passphrase_adj;
        privacy.checkbtn_passphrase_grab = checkbtn_passphrase_grab;
        privacy.checkbtn_gpg_warning     = checkbtn_gpg_warning;
        privacy.optmenu_default_signkey  = optmenu;
@@ -2689,7 +2766,7 @@ static void prefs_other_create(void)
                               "netscape -remote 'openURL(%s,raise)'",
                               "netscape '%s'",
                               "gnome-moz-remote --raise --newwin '%s'",
-                              "kfmclient openProfile webbrowsing '%s'",
+                              "kfmclient openURL '%s'",
                               "opera -newwindow '%s'",        
                               "kterm -e w3m '%s'",
                               "kterm -e lynx '%s'",
@@ -3576,9 +3653,9 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
                "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
 
-               "(menu-path \"<Main>/Tool/Address book\" \"<shift><control>A\")\n"
-               "(menu-path \"<Main>/Tool/Execute\" \"X\")\n"
-               "(menu-path \"<Main>/Tool/Log window\" \"<control>L\")\n"
+               "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
+               "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
+               "(menu-path \"<Main>/Tools/Log window\" \"<control>L\")\n"
 
                "(menu-path \"<Compose>/File/Close\" \"<control>W\")\n"
                "(menu-path \"<Compose>/Edit/Select all\" \"<control>A\")\n"
@@ -3628,9 +3705,9 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
                "(menu-path \"<Main>/Message/Mark/Mark as read\" \"<shift>R\")\n"
 
-               "(menu-path \"<Main>/Tool/Address book\" \"<shift><control>A\")\n"
-               "(menu-path \"<Main>/Tool/Execute\" \"X\")\n"
-               "(menu-path \"<Main>/Tool/Log window\" \"<control>L\")\n"
+               "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
+               "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
+               "(menu-path \"<Main>/Tools/Log window\" \"<control>L\")\n"
 
                "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
                "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
@@ -3679,9 +3756,9 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>N\")\n"
                "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
 
-               "(menu-path \"<Main>/Tool/Address book\" \"<shift><control>A\")\n"
-               "(menu-path \"<Main>/Tool/Execute\" \"X\")\n"
-               "(menu-path \"<Main>/Tool/Log window\" \"<control>L\")\n"
+               "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
+               "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
+               "(menu-path \"<Main>/Tools/Log window\" \"<control>L\")\n"
 
                "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
                "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
@@ -3731,9 +3808,9 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
                "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
 
-               "(menu-path \"<Main>/Tool/Address book\" \"<alt>A\")\n"
-               "(menu-path \"<Main>/Tool/Execute\" \"<alt>X\")\n"
-               "(menu-path \"<Main>/Tool/Log window\" \"<alt>L\")\n"
+               "(menu-path \"<Main>/Tools/Address book\" \"<alt>A\")\n"
+               "(menu-path \"<Main>/Tools/Execute\" \"<alt>X\")\n"
+               "(menu-path \"<Main>/Tools/Log window\" \"<alt>L\")\n"
 
                "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
                "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
@@ -3783,9 +3860,9 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"\")\n"
                "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
 
-               "(menu-path \"<Main>/Tool/Address book\" \"\")\n"
-               "(menu-path \"<Main>/Tool/Execute\" \"\")\n"
-               "(menu-path \"<Main>/Tool/Log window\" \"\")\n"
+               "(menu-path \"<Main>/Tools/Address book\" \"\")\n"
+               "(menu-path \"<Main>/Tools/Execute\" \"\")\n"
+               "(menu-path \"<Main>/Tools/Log window\" \"\")\n"
 
                "(menu-path \"<Compose>/File/Close\" \"\")\n"
                "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
@@ -3973,7 +4050,6 @@ static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam)
        case NEXTUNREADMSGDIALOG_ASSUME_NO:
                gtk_option_menu_set_history(optmenu, 2);
                break;
-       default:
        }
 
        menu = gtk_option_menu_get_menu(optmenu);