[pan2: 164/268] - few cleanups - added "mark_thread_read" and "mark_thread_unread" on req



commit a6eb5d1e18317cb7a7cfccc6c9bc866dfef3c9c2
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date:   Tue Oct 4 07:44:40 2011 +0200

    - few cleanups
    - added "mark_thread_read" and "mark_thread_unread" on req

 configure.in                     |    4 +
 pan.cbp                          |    1 +
 pan/gui/Makefile.am              |    2 +-
 pan/gui/actions.cc               |   13 +++
 pan/gui/gui.cc                   |   20 ++++-
 pan/gui/gui.h                    |    2 +
 pan/gui/header-pane.cc           |   14 ++-
 pan/gui/header-pane.h            |    3 +-
 pan/gui/pan-ui.h                 |    2 +
 pan/gui/pan.cc                   |    2 +
 pan/gui/pan.ui.h                 |    6 +
 pan/gui/post-ui.cc               |   25 +-----
 pan/gui/post-ui.h                |    1 -
 pan/tasks/Makefile.am            |    6 +-
 pan/tasks/encoder.h              |    2 +-
 pan/tasks/socket-impl-openssl.cc |    2 +
 pan/tasks/task-multipost.cc      |  190 --------------------------------------
 pan/tasks/task-multipost.h       |  136 ---------------------------
 pan/tasks/upload-queue.h         |    1 -
 19 files changed, 67 insertions(+), 365 deletions(-)
---
diff --git a/configure.in b/configure.in
index 6a29f68..8de39d7 100644
--- a/configure.in
+++ b/configure.in
@@ -150,6 +150,10 @@ case $host_os in
 esac
 AM_CONDITIONAL([HAVE_WIN32],[test "$win32" = "yes"])
 
+CXXFLAGS="$CXXFLAGS -g"
+CPPFLAGS="$CPPFLAGS -g"
+CFLAGS="$CFLAGS -g"
+
 dnl build the output files
 AC_SUBST(panlocaledir)
 AC_CONFIG_FILES([Makefile
diff --git a/pan.cbp b/pan.cbp
index d9a0bbc..565221b 100644
--- a/pan.cbp
+++ b/pan.cbp
@@ -220,6 +220,7 @@
 		<Unit filename="pan/tasks/queue.h" />
 		<Unit filename="pan/tasks/socket-impl-gio.cc" />
 		<Unit filename="pan/tasks/socket-impl-gio.h" />
+		<Unit filename="pan/tasks/socket-impl-openssl.cc" />
 		<Unit filename="pan/tasks/socket-impl-openssl.h" />
 		<Unit filename="pan/tasks/socket-impl-scripted.cc" />
 		<Unit filename="pan/tasks/socket-impl-scripted.h" />
diff --git a/pan/gui/Makefile.am b/pan/gui/Makefile.am
index b50a5ff..4c22f1c 100644
--- a/pan/gui/Makefile.am
+++ b/pan/gui/Makefile.am
@@ -93,7 +93,7 @@ WINRCOBJ =
 endif
 
 pan_SOURCES = gui.cc pan.cc $(WINRC)
-pan_LDADD = ./libpangui.a $(WINRCOBJ) ../data-impl/libpandata.a ../tasks/libtasks.a ../data/libdata.a ../usenet-utils/libusenetutils.a ../general/libgeneralutils.a ../../uulib/libuu.a @GTKSPELL_LIBS@ @GTK_LIBS@ @GMIME_LIBS@ @GLIB_LIBS@
+pan_LDADD = ./libpangui.a $(WINRCOBJ) ../data-impl/libpandata.a ../tasks/libtasks.a ../data/libdata.a ../usenet-utils/libusenetutils.a ../general/libgeneralutils.a ../../uulib/libuu.a @GTKSPELL_LIBS@ @GTK_LIBS@ @GMIME_LIBS@ @GLIB_LIBS@ -lssl -lcrypto
 
 if HAVE_WIN32
 pan_LDFLAGS = -mwindows
diff --git a/pan/gui/actions.cc b/pan/gui/actions.cc
index eb00c95..187eb7f 100644
--- a/pan/gui/actions.cc
+++ b/pan/gui/actions.cc
@@ -152,6 +152,8 @@ namespace
   void do_clear_article_cache          (GtkAction*) { pan_ui->do_clear_article_cache(); }
   void do_mark_article_read            (GtkAction*) { pan_ui->do_mark_article_read(); }
   void do_mark_article_unread          (GtkAction*) { pan_ui->do_mark_article_unread(); }
+  void do_mark_thread_read             (GtkAction*) { pan_ui->do_mark_thread_read(); }
+  void do_mark_thread_unread           (GtkAction*) { pan_ui->do_mark_thread_unread(); }
   void do_post                         (GtkAction*) { pan_ui->do_post(); }
   void do_followup_to                  (GtkAction*) { pan_ui->do_followup_to(); }
   void do_reply_to                     (GtkAction*) { pan_ui->do_reply_to(); }
@@ -571,6 +573,17 @@ namespace
       NULL,
       G_CALLBACK(do_mark_article_unread) },
 
+    ///TODO create icons for the next two actions
+    { "mark-thread-read", "ICON_ARTICLE_READ",
+      N_("_Mark Thread as Read"), "<Shift>T",
+      NULL,
+      G_CALLBACK(do_mark_thread_read) },
+
+    { "mark-thread-unread", "ICON_ARTICLE_UNREAD",
+      N_("Mark Thread as _Unread"), "<control><Shift>T",
+      NULL,
+      G_CALLBACK(do_mark_thread_unread) },
+
     { "post", "ICON_COMPOSE_POST",
       N_("_Post to Newsgroup"), "P",
       N_("Post to Newsgroup"),
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 7037e3a..ccf49df 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -1278,7 +1278,7 @@ void GUI :: do_delete_article ()
 
   if (do_delete)
   {
-    const std::set<const Article*> articles (_header_pane->get_nested_selection());
+    const std::set<const Article*> articles (_header_pane->get_nested_selection(false));
     _data.delete_articles (articles);
 
     const Quark mid (_body_pane->get_message_id());
@@ -1296,14 +1296,28 @@ void GUI :: do_clear_article_cache ()
 
 void GUI :: do_mark_article_read ()
 {
-  const std::set<const Article*> article_set (_header_pane->get_nested_selection ());
+  const std::set<const Article*> article_set (_header_pane->get_nested_selection (false));
   const std::vector<const Article*> tmp (article_set.begin(), article_set.end());
   _data.mark_read ((const Article**)&tmp.front(), tmp.size());
 }
 
 void GUI :: do_mark_article_unread ()
 {
-  const std::set<const Article*> article_set (_header_pane->get_nested_selection ());
+  const std::set<const Article*> article_set (_header_pane->get_nested_selection (false));
+  const std::vector<const Article*> tmp (article_set.begin(), article_set.end());
+  _data.mark_read ((const Article**)&tmp.front(), tmp.size(), false);
+}
+
+void GUI :: do_mark_thread_read ()
+{
+  const std::set<const Article*> article_set (_header_pane->get_nested_selection (true));
+  const std::vector<const Article*> tmp (article_set.begin(), article_set.end());
+  _data.mark_read ((const Article**)&tmp.front(), tmp.size());
+}
+
+void GUI :: do_mark_thread_unread ()
+{
+  const std::set<const Article*> article_set (_header_pane->get_nested_selection (true));
   const std::vector<const Article*> tmp (article_set.begin(), article_set.end());
   _data.mark_read ((const Article**)&tmp.front(), tmp.size(), false);
 }
diff --git a/pan/gui/gui.h b/pan/gui/gui.h
index 292f79f..06f668c 100644
--- a/pan/gui/gui.h
+++ b/pan/gui/gui.h
@@ -128,6 +128,8 @@ namespace pan
       virtual void do_clear_article_cache ();
       virtual void do_mark_article_read ();
       virtual void do_mark_article_unread ();
+      virtual void do_mark_thread_read ();
+      virtual void do_mark_thread_unread ();
       virtual void do_post ();
       virtual void do_followup_to ();
       virtual void do_reply_to ();
diff --git a/pan/gui/header-pane.cc b/pan/gui/header-pane.cc
index 1a4943f..c8bd6ee 100644
--- a/pan/gui/header-pane.cc
+++ b/pan/gui/header-pane.cc
@@ -798,6 +798,7 @@ namespace {
   struct NestedData {
     const HeaderPane * pane;
     articles_t articles;
+    bool mark_all; /* for mark_article_(un)read and mark_thread_(un)read */
   };
 }
 
@@ -807,13 +808,15 @@ HeaderPane :: get_nested_foreach (GtkTreeModel  * model,
                                   GtkTreeIter   * iter,
                                   gpointer        data) const
 {
-  articles_t& articles (*static_cast<articles_t*>(data));
+  NestedData& ndata (*static_cast<NestedData*>(data));
+  articles_t& articles (ndata.articles);
   articles.insert (get_article (model, iter));
   const bool expanded (gtk_tree_view_row_expanded (GTK_TREE_VIEW(_tree_view), path));
   GtkTreeIter child;
-  if (!expanded && gtk_tree_model_iter_children(model,&child,iter))
+  if ((!expanded || ndata.mark_all) && gtk_tree_model_iter_children(model,&child,iter))
     walk_and_collect (model, &child, articles);
 }
+
 void
 HeaderPane :: get_nested_foreach_static (GtkTreeModel* model,
                                          GtkTreePath* path,
@@ -821,14 +824,15 @@ HeaderPane :: get_nested_foreach_static (GtkTreeModel* model,
                                          gpointer data)
 {
   NestedData& ndata (*static_cast<NestedData*>(data));
-  ndata.pane->get_nested_foreach (model, path, iter, &ndata.articles);
+  ndata.pane->get_nested_foreach (model, path, iter, &ndata);
 }
 
 articles_t
-HeaderPane :: get_nested_selection () const
+HeaderPane :: get_nested_selection (bool do_mark_all) const
 {
   NestedData data;
   data.pane = this;
+  data.mark_all = do_mark_all;
   GtkTreeSelection * selection (gtk_tree_view_get_selection (GTK_TREE_VIEW(_tree_view)));
   gtk_tree_selection_selected_foreach (selection, get_nested_foreach_static, &data);
   return data.articles;
@@ -1642,6 +1646,8 @@ HeaderPane :: on_selection_changed_idle (gpointer self_gpointer)
     "show-selected-article-info",
     "mark-article-read",
     "mark-article-unread",
+    "mark-thread-read",
+    "mark-thread-unread",
     "watch-thread",
     "ignore-thread",
     "plonk",
diff --git a/pan/gui/header-pane.h b/pan/gui/header-pane.h
index d0e0348..05aad77 100644
--- a/pan/gui/header-pane.h
+++ b/pan/gui/header-pane.h
@@ -113,7 +113,8 @@ namespace pan
       const Article* get_first_selected_article () const;
       std::set<const Article*> get_full_selection () const;
       std::vector<const Article*> get_full_selection_v () const;
-      std::set<const Article*> get_nested_selection () const;
+      /** Selects nested articles for marking/deletion. 'do_mark_all' specifies whether or not to mark all articles in the thread */
+      std::set<const Article*> get_nested_selection (bool do_mark_all) const;
       bool set_group (const Quark& group);
       const Quark& get_group () { return _group; }
 
diff --git a/pan/gui/pan-ui.h b/pan/gui/pan-ui.h
index 8c56d35..4f35574 100644
--- a/pan/gui/pan-ui.h
+++ b/pan/gui/pan-ui.h
@@ -72,6 +72,8 @@ namespace pan
     virtual void do_clear_article_cache () = 0;
     virtual void do_mark_article_read () = 0;
     virtual void do_mark_article_unread () = 0;
+    virtual void do_mark_thread_read () = 0;
+    virtual void do_mark_thread_unread () = 0;
     virtual void do_post () = 0;
     virtual void do_followup_to () = 0;
     virtual void do_reply_to () = 0;
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 3c2805d..73af3a0 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -34,6 +34,7 @@ extern "C" {
 #include <pan/general/file-util.h>
 #include <pan/general/worker-pool.h>
 #include <pan/tasks/socket-impl-gio.h>
+#include <pan/tasks/socket-impl-openssl.h>
 #include <pan/tasks/task-groups.h>
 #include <pan/tasks/task-xover.h>
 #include <pan/tasks/nzb.h>
@@ -332,6 +333,7 @@ main (int argc, char *argv[])
     WorkerPool worker_pool (4, true);
 
     GIOChannelSocket::Creator socket_creator;
+//    GIOChannelSocketSSL::Creator socket_creator;
 
     Queue queue (data, data, &socket_creator, worker_pool,
                  prefs.get_flag ("work-online", true),
diff --git a/pan/gui/pan.ui.h b/pan/gui/pan.ui.h
index b2da2b7..06891fa 100644
--- a/pan/gui/pan.ui.h
+++ b/pan/gui/pan.ui.h
@@ -125,6 +125,9 @@ const char * fallback_ui_file =
 "        <menuitem action='mark-article-read' />\n"
 "        <menuitem action='mark-article-unread' />\n"
 "        <separator />\n"
+"        <menuitem action='mark-thread-read' />\n"
+"        <menuitem action='mark-thread-unread' />\n"
+"        <separator />\n"
 "        <menuitem action='add-article-score' />\n"
 "        <menuitem action='watch-thread' />\n"
 "        <menuitem action='ignore-thread' />\n"
@@ -187,6 +190,9 @@ const char * fallback_ui_file =
 "    <menuitem action='mark-article-read' />\n"
 "    <menuitem action='mark-article-unread' />\n"
 "    <separator />\n"
+"    <menuitem action='mark-thread-read' />\n"
+"    <menuitem action='mark-thread-unread' />\n"
+"    <separator />\n"
 "    <menuitem action='add-article-score' />\n"
 "    <menuitem action='watch-thread' />\n"
 "    <menuitem action='ignore-thread' />\n"
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 953941d..3c6e174 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -164,11 +164,6 @@ PostUI:: update_filequeue_label (GtkTreeSelection *selection)
     {
       TaskUpload * task (dynamic_cast<TaskUpload*>(*it));
       if (task) kb += task->_bytes/1024;
-      else
-      {
-        TaskMultiPost * task (dynamic_cast<TaskMultiPost*>(*it));
-        if (task) kb += task->_bytes/1024;
-      }
     }
     g_snprintf(str,sizeof(str), _("Upload Queue : %ld Tasks, %ld KB (~ %.2f MB) total ."), tasks.size(), kb, kb/1024.0f);
     gtk_label_set_text (GTK_LABEL(_filequeue_label), str);
@@ -468,7 +463,7 @@ namespace
     { "always-run-editor", 0, N_("Always Run Editor"), 0, 0, G_CALLBACK(do_edit2), false },
     { "remember-charset", 0, N_("Remember Character Encoding for this Group"), 0, 0, G_CALLBACK(on_remember_charset_toggled), true },
 //    { "inline-or-bulk", 0, N_("Attachments are inlined with Message"), 0, 0, G_CALLBACK(on_inline_toggled), false },
-    { "master-reply", 0, N_("All Attachments are threaded replies to message"), 0, 0, G_CALLBACK(on_mr_toggled), true },
+    { "master-reply", 0, N_("Thread attached replies"), 0, 0, G_CALLBACK(on_mr_toggled), true },
     { "spellcheck", 0, N_("Check _Spelling"), 0, 0, G_CALLBACK(on_spellcheck_toggled), true }
   };
 
@@ -1134,24 +1129,6 @@ PostUI :: maybe_post_message (GMimeMessage * message)
         t->add_listener(this);
       }
     }
-    else    // attachments are all inlined in ONE big gmimemultipart
-    {
-      _running_uploads = 1;
-      quarks_t filenames;
-      GMimeMessage* msg(new_message_from_ui(UPLOADING));
-      GMimeMultipart * multi (g_mime_multipart_new_with_subtype("mixed"));
-      g_mime_multipart_insert(multi,0,GMIME_OBJECT(msg));
-
-      TaskMultiPost * mp = new TaskMultiPost(filenames, profile.posting_server, a, multi, this);
-      foreach (PostUI::tasks_t, tasks, it)
-      {
-        TaskUpload * t (dynamic_cast<TaskUpload*>(*it));
-        mp->_filenames.insert(Quark(t->_filename.c_str()));
-      }
-      mp->dbg();
-      _upload_queue.clear();
-    }
-
   }
 
   /**
diff --git a/pan/gui/post-ui.h b/pan/gui/post-ui.h
index a0309a4..94a96b6 100644
--- a/pan/gui/post-ui.h
+++ b/pan/gui/post-ui.h
@@ -25,7 +25,6 @@
 #include <pan/general/progress.h>
 #include <pan/tasks/queue.h>
 #include <pan/tasks/upload-queue.h>
-#include <pan/tasks/task-multipost.h>
 #include <pan/usenet-utils/text-massager.h>
 #include <pan/data/encode-cache.h>
 #include "group-prefs.h"
diff --git a/pan/tasks/Makefile.am b/pan/tasks/Makefile.am
index c6bec5d..32201a4 100644
--- a/pan/tasks/Makefile.am
+++ b/pan/tasks/Makefile.am
@@ -1,5 +1,5 @@
 AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@
-AM_LDFLAGS = ../../uulib/libuu.a -lz
+AM_LDFLAGS = ../../uulib/libuu.a -lz -lssl -lcrypto
 
 noinst_LIBRARIES = libtasks.a
 
@@ -12,12 +12,12 @@ libtasks_a_SOURCES = \
   task-post.cc \
   task-xover.cc \
   task-upload.cc \
-  task-multipost.cc \
   nntp.cc \
   nzb.cc \
   queue.cc \
   upload-queue.cc \
   socket.cc \
+  socket-impl-openssl.cc \
   socket-impl-gio.cc \
   socket-impl-scripted.cc \
   nntp-pool.cc
@@ -34,7 +34,6 @@ noinst_HEADERS = \
   task-groups.h \
   task-post.h \
   task-upload.h \
-  task-multipost.h \
   task-weak-ordering.h \
   task-xover.h \
   nntp.h  \
@@ -43,6 +42,7 @@ noinst_HEADERS = \
   upload-queue.h \
   socket.h \
   socket-impl-gio.h \
+  socket-impl-openssl.h \
   socket-impl-scripted.h \
   nntp-pool.h
 
diff --git a/pan/tasks/encoder.h b/pan/tasks/encoder.h
index a9e5f28..e41163a 100644
--- a/pan/tasks/encoder.h
+++ b/pan/tasks/encoder.h
@@ -41,7 +41,7 @@ extern "C" {
 namespace pan
 {
   /**
-   * Encodes attachments (yEnc, BASE64,MIME PT) for posting to usenet groups.
+   * Encodes attachments (yEnc, MIME PT) for posting to usenet groups.
    *
    * @author Heinrich Mueller <eddie_v gmx de>
    * @author Calin Culianu <calin ajvar org>
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index f6acdc1..af19eca 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -421,6 +421,8 @@ namespace
     X509 *cert;
     const char *errstr;
 
+    if (!handle || !chan->ssl) return -1;
+
     ret = SSL_connect(chan->ssl);
     if (ret <= 0) {
       err = SSL_get_error(chan->ssl, ret);
diff --git a/pan/tasks/upload-queue.h b/pan/tasks/upload-queue.h
index fe5da68..fe936a6 100644
--- a/pan/tasks/upload-queue.h
+++ b/pan/tasks/upload-queue.h
@@ -32,7 +32,6 @@
 #include <pan/tasks/socket.h>
 #include <pan/tasks/adaptable-set.h>
 #include <pan/tasks/task-upload.h>
-#include <pan/tasks/task-multipost.h>
 #include <pan/tasks/encoder.h>
 #include <pan/tasks/task-weak-ordering.h>
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]