← Back to team overview

linuxdcpp-team team mailing list archive

[Bug 464185] Re: impliment copy file name in search

 

I think the generalized approach in bug #473205 will resolve this.
However, keeping this open so we remember to activate the copy menu in
search tab as well.

** Changed in: linuxdcpp
   Importance: Undecided => Wishlist

** Changed in: linuxdcpp
       Status: New => Confirmed

** Tags added: copy search ui

-- 
You received this bug notification because you are a member of LinuxDC++
Team, which is subscribed to LinuxDC++.
https://bugs.launchpad.net/bugs/464185

Title:
  impliment copy file name in search

Status in Linux DC++:
  Confirmed

Bug description:
  can someone give me help on how to impliment the above mentioned item
  in the search please or impliment it in the client as can be useful to
  be able just copy filenames from the search window?

  am uncertain as how to complete this: ?

  glade/search.glade:

        <widget class="GtkMenuItem" id="copyFileName">
          <property name="visible">True</property>
          <property name="label" translatable="yes">_Copy FileName</property>
          <property name="use_underline">True</property>
        </widget>
      </child>


  linux/search.cc:

          g_signal_connect(getWidget("copyFileName"), "activate",
  G_CALLBACK(onCopyFileNameClicked_gui), (gpointer)this);


  void Search::oncopyFileNameClicked_gui(GtkMenuItem* item, gpointer data)
  {
  	Search *s = (Search *)data;

  	if (gtk_tree_selection_count_selected_rows(s->selection) > 0)
  	{
  		int64_t size;
  		string magnets, magnet, filename, tth;
  		GtkTreeIter iter;
  		GtkTreePath *path;
  		GList *list = gtk_tree_selection_get_selected_rows(s->selection, NULL);

  		for (GList *i = list; i; i = i->next)
  		{
  			path = (GtkTreePath *)i->data;
  			if (gtk_tree_model_get_iter(s->sortedFilterModel, &iter, path))
  			{
  				bool parent = gtk_tree_model_iter_has_child(s->sortedFilterModel, &iter);

  				do
  				{
  					filename = s->resultView.getString(&iter, "Filename");
  					size = s->resultView.getValue<int64_t>(&iter, "Real Size");
  					tth = s->resultView.getString(&iter, "TTH");
  					magnet = WulforUtil::makeMagnet(filename, size, tth);

  					if (!magnet.empty())
  					{
  						if (!magnets.empty())
  							magnets += '\n';
  						magnets += magnet;
  					}
  				}
  				while (parent && WulforUtil::getNextIter_gui(s->sortedFilterModel, &iter, TRUE, FALSE));
  			}
  			gtk_tree_path_free(path);
  		}
  		g_list_free(list);

  		if (!magnets.empty())
  			gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), magnets.c_str(), magnets.length());
  	}
  }



  linux/search.hh:

                  static void onCopyFileNameClicked_gui(GtkMenuItem
  *item, gpointer data);



References