mira-dev team mailing list archive
-
mira-dev team
-
Mailing list archive
-
Message #00036
[Branch ~mira-dev/mira/trunk] Rev 197: Don't send a request transfer for upload when a file with the same name already exist
------------------------------------------------------------
revno: 197
fixes bug(s): https://launchpad.net/bugs/570492
committer: Alan Alvarez <aalvarez@xxxxxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-04-29 12:08:26 -0400
message:
Don't send a request transfer for upload when a file with the same name already exist
modified:
mira-client/src/utilities/files/WorkplaceFilesWidget.cpp
--
lp:mira
https://code.launchpad.net/~mira-dev/mira/trunk
Your team Mira Core Development Team is subscribed to branch lp:mira.
To unsubscribe from this branch go to https://code.launchpad.net/~mira-dev/mira/trunk/+edit-subscription
=== modified file 'mira-client/src/utilities/files/WorkplaceFilesWidget.cpp'
--- mira-client/src/utilities/files/WorkplaceFilesWidget.cpp 2010-04-14 04:34:09 +0000
+++ mira-client/src/utilities/files/WorkplaceFilesWidget.cpp 2010-04-29 16:08:26 +0000
@@ -187,6 +187,20 @@
}
std::cout << "Filename to upload " << filename << std::endl;
+ // Make sure file doesn't already exist. If there is, just return.
+ // TODO (?): Should we show a dialog notifying the user of this error?
+ for (boost::property_tree::ptree::iterator Iter = m_current_folder->m_ptree->begin(); Iter != m_current_folder->m_ptree->end(); ++Iter)
+ {
+ if (Iter->first == "file" && Iter->second.data() == filename)
+ {
+ return;
+ }
+ else if (Iter->first == "folder" && Iter->second.get_child("<xmlattr>").get_child("name").data() == filename)
+ {
+ return;
+ }
+ }
+
path_type current_path = get_current_path();
if (current_path.empty() == false)
filename.insert(0, current_path.dump() + '/');
@@ -259,7 +273,6 @@
std::string message = "C \"";
message += current_path.dump() + '\"';
MiraUtility::send_message("Files", m_parent->m_workplace, message);
- std::cout << message << std::endl;
remove_form_widgets();
}