linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #02147
[Branch ~linuxdcpp-team/linuxdcpp/trunk] Rev 397: Added file path (fileFN) and magnet (fileMN) variables to user commands
------------------------------------------------------------
revno: 397
fixes bug(s): https://launchpad.net/bugs/654015
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-10-13 22:51:12 -0500
message:
Added file path (fileFN) and magnet (fileMN) variables to user commands
modified:
Changelog.txt
Credits.txt
glade/mainwindow.glade
linux/UserCommandMenu.cc
linux/UserCommandMenu.hh
linux/search.cc
linux/sharebrowser.cc
--
lp:linuxdcpp
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk
Your team LinuxDC++ Team is subscribed to branch lp:linuxdcpp.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk/+edit-subscription
=== modified file 'Changelog.txt'
--- Changelog.txt 2010-09-10 01:26:40 +0000
+++ Changelog.txt 2010-10-14 03:51:12 +0000
@@ -61,6 +61,7 @@
[2010-09-05] lp#308683: Fixed downloading files multiple times when grouping by TTH. (Steven)
[2010-09-07] Added icons to the notebook tab labels. (Steven)
[2010-09-09] PM tab label now shows when user's nick, hub or online status changes. (Steven)
+[2010-10-13] Added file path (fileFN) and magnet (fileMN) variables to user commands. (thanks DjSlash)
*** 1.0.3 2009-02-01 ***
[2008-08-10] lp#256236: Fixed a crash on startup when using auto-open options.
=== modified file 'Credits.txt'
--- Credits.txt 2010-04-18 04:11:04 +0000
+++ Credits.txt 2010-10-14 03:51:12 +0000
@@ -46,6 +46,7 @@
mark
Jakh Daven
Andrew Browne
+DjSlash
DC++:
-----
=== modified file 'glade/mainwindow.glade'
--- glade/mainwindow.glade 2010-07-27 04:26:37 +0000
+++ glade/mainwindow.glade 2010-10-14 03:51:12 +0000
@@ -899,6 +899,7 @@
mark
Jakh Daven
Andrew Browne
+ DjSlash
</property>
<property name="artists">Johannes Sjölund</property>
<property name="wrap_license">True</property>
=== modified file 'linux/UserCommandMenu.cc'
--- linux/UserCommandMenu.cc 2009-04-02 02:40:10 +0000
+++ linux/UserCommandMenu.cc 2010-10-14 03:51:12 +0000
@@ -53,12 +53,13 @@
ucParams.push_back(u);
}
-void UserCommandMenu::addFile(const std::string &cid, const std::string &name,
+void UserCommandMenu::addFile(const std::string &cid, const std::string &name, const std::string &path,
const int64_t &size, const std::string &tth)
{
UCParam u;
u.cid = cid;
u.name = name;
+ u.path = path;
u.size = size;
u.tth = tth;
if (u.tth.empty())
@@ -168,10 +169,11 @@
if (!i->name.empty() && !i->type.empty())
{
params["type"] = i->type;
- params["fileFN"] = i->name;
+ params["fileFN"] = i->path + i->name;
params["fileSI"] = Util::toString(i->size);
params["fileSIshort"] = Util::formatBytes(i->size);
params["fileTR"] = i->tth;
+ params["fileMN"] = WulforUtil::makeMagnet(i->name, i->size, i->tth);
params["file"] = params["fileFN"];
params["filesize"] = params["fileSI"];
params["filesizeshort"] = params["fileSIshort"];
=== modified file 'linux/UserCommandMenu.hh'
--- linux/UserCommandMenu.hh 2009-04-02 02:40:10 +0000
+++ linux/UserCommandMenu.hh 2010-10-14 03:51:12 +0000
@@ -37,8 +37,8 @@
void addHub(const std::string &hub);
void addHub(const dcpp::StringList &hubs2);
void addUser(const std::string &cid);
- void addFile(const std::string &cid, const std::string &name,
- const int64_t &size, const std::string &tth);
+ void addFile(const std::string &cid, const std::string &name, const std::string &path,
+ const int64_t &size = 0, const std::string &tth = "");
void cleanMenu_gui();
void buildMenu_gui();
@@ -59,6 +59,7 @@
{
std::string cid;
std::string name;
+ std::string path;
int64_t size;
std::string tth;
std::string type;
=== modified file 'linux/search.cc'
--- linux/search.cc 2010-09-08 02:51:30 +0000
+++ linux/search.cc 2010-10-14 03:51:12 +0000
@@ -311,6 +311,7 @@
userCommandMenu->addHub(resultView.getString(&iter, "Hub URL"));
userCommandMenu->addFile(resultView.getString(&iter, "CID"),
resultView.getString(&iter, "Filename"),
+ resultView.getString(&iter, "Path"),
resultView.getValue<int64_t>(&iter, "Real Size"),
resultView.getString(&iter, "TTH"));
=== modified file 'linux/sharebrowser.cc'
--- linux/sharebrowser.cc 2009-08-15 04:40:26 +0000
+++ linux/sharebrowser.cc 2010-10-14 03:51:12 +0000
@@ -480,8 +480,24 @@
GtkTreePath *path = (GtkTreePath *)i->data;
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(fileStore), &iter, path))
{
+ string filepath;
+ string fileOrder = fileView.getString(&iter, "File Order");
+ gpointer ptr = fileView.getValue<gpointer>(&iter, "DL File");
+
+ if (fileOrder[0] == 'd')
+ {
+ DirectoryListing::Directory *dir = (DirectoryListing::Directory *)ptr;
+ filepath = listing.getPath(dir->getParent());
+ }
+ else
+ {
+ DirectoryListing::File *file = (DirectoryListing::File *)ptr;
+ filepath = listing.getPath(file);
+ }
+
fileUserCommandMenu->addFile(cid,
fileView.getString(&iter, "Filename"),
+ filepath,
fileView.getValue<int64_t>(&iter, "Size Order"),
fileView.getString(&iter, "TTH"));
}
@@ -521,23 +537,25 @@
gtk_menu_shell_append(GTK_MENU_SHELL(getWidget("dirDownloadMenu")), menuItem);
// Add user commands.
- StringList hubs = WulforUtil::getHubAddress(listing.getUser()->getCID());
- dirUserCommandMenu->addHub(hubs);
GtkTreeIter iter;
- GList *list = gtk_tree_selection_get_selected_rows(dirSelection, NULL);
- string cid = listing.getUser()->getCID().toBase32();
-
- for (GList *i = list; i; i = i->next)
+ if (gtk_tree_selection_get_selected(dirSelection, NULL, &iter))
{
- GtkTreePath *path = (GtkTreePath *)i->data;
- if (gtk_tree_model_get_iter(GTK_TREE_MODEL(dirStore), &iter, path))
+ string filename;
+ string filepath;
+ string cid = listing.getUser()->getCID().toBase32();
+ StringList hubs = WulforUtil::getHubAddress(listing.getUser()->getCID());
+ DirectoryListing::Directory *dir = dirView.getValue<DirectoryListing::Directory *>(&iter, "DL Dir");
+
+ if (dir != listing.getRoot())
{
- dirUserCommandMenu->addFile(cid, dirView.getString(&iter, "Dir"), 0, "");
+ filename = dirView.getString(&iter, "Dir");
+ filepath = listing.getPath(dir->getParent());
}
- gtk_tree_path_free(path);
+
+ dirUserCommandMenu->addFile(cid, filename, filepath);
+ dirUserCommandMenu->addHub(hubs);
+ dirUserCommandMenu->buildMenu_gui();
}
- g_list_free(list);
- dirUserCommandMenu->buildMenu_gui();
gtk_menu_popup(GTK_MENU(getWidget("dirMenu")), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
gtk_widget_show_all(getWidget("dirMenu"));