← Back to team overview

linuxdcpp-team team mailing list archive

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

 

obv it doesnt need the magnet stuff just used that as uncertain as to
which bits to call to just call the actual filename itself, oh and i
missed the opening <child> in the glad bit but only in this report, not
in my notes.

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

Status in Linux DC++: New

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);



Follow ups

References