* Addition of new Feeds (PeersFeed / TransferFeed / MsgFeed)

* Addition of new FeedItems (MsgItem / ChanNewItem )
 * Removed CheckBoxes at the top of NewsFeed (should be in config)
 * Enabled subscribe/unsubscribeButtons in ChannelFeed.
 * Enabled ChanNewItem and MsgItem in NewsFeeds.
 * Remove Goto Section Button from FeedItems.
 * Disabled PlayMedia button - if no attachments.
 * Enabled Drag from Search Window (with new class SearchTreeWidget)
 * Enabled Drag from SharedFiles Dialog (mods to RemoteDirModel).
 * Enabled Drop in GeneralMsgDialog from Search/SharedFiles.
 * Updated Rs Interface (64 bits for filesize)
 * Other bits and bobs.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@635 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-07-04 14:41:24 +00:00
parent 56639fd1ba
commit 1f01c08de4
41 changed files with 3362 additions and 521 deletions

View file

@ -2,13 +2,21 @@
#include "RemoteDirModel.h"
#include "rsfiles.h"
#include <QPalette>
#include <QtGui>
#include <iostream>
#include <sstream>
#include <math.h>
RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
: QAbstractItemModel(parent),
RemoteMode(mode), nIndex(1), indexSet(1) /* ass zero index cant be used */
{
setSupportedDragActions(Qt::CopyAction);
}
bool RemoteDirModel::hasChildren(const QModelIndex &parent) const
{
@ -518,9 +526,9 @@
else // (details.type == DIR_TYPE_FILE)
{
return ( Qt::ItemIsSelectable |
Qt::ItemIsDragEnabled |
Qt::ItemIsEnabled);
// Qt::ItemIsDragEnabled |
}
}
@ -753,4 +761,100 @@ void RemoteDirModel::getFilePaths(QModelIndexList list, std::list<std::string> &
std::cerr << "::::::::::::Done getFilePaths" << std::endl;
}
/* Drag and Drop Functionality */
QMimeData * RemoteDirModel::mimeData ( const QModelIndexList & indexes ) const
{
/* extract from each the member text */
std::string text;
QModelIndexList::const_iterator it;
std::map<std::string, uint64_t> drags;
std::map<std::string, uint64_t>::iterator dit;
for(it = indexes.begin(); it != indexes.end(); it++)
{
void *ref = it -> internalPointer();
DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS;
if (RemoteMode)
{
flags |= DIR_FLAGS_REMOTE;
}
else
{
flags |= DIR_FLAGS_LOCAL;
}
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
continue;
}
std::cerr << "::::::::::::FileDrag:::: " << std::endl;
std::cerr << "Name: " << details.name << std::endl;
std::cerr << "Hash: " << details.hash << std::endl;
std::cerr << "Size: " << details.count << std::endl;
std::cerr << "Path: " << details.path << std::endl;
if (details.type != DIR_TYPE_FILE)
{
std::cerr << "RemoteDirModel::mimeData() Not File" << std::endl;
continue; /* not file! */
}
if (drags.end() != (dit = drags.find(details.hash)))
{
std::cerr << "RemoteDirModel::mimeData() Duplicate" << std::endl;
continue; /* duplicate */
}
drags[details.hash] = details.count;
std::string line = details.name;
line += "/";
line += details.hash;
line += "/";
{
std::ostringstream out;
out << details.count;
line += out.str();
line += "/";
}
if (RemoteMode)
{
line += "Remote";
}
else
{
line += "Local";
}
line += "/\n";
text += line;
}
std::cerr << "Created MimeData:";
std::cerr << std::endl;
std::cerr << text;
std::cerr << std::endl;
QMimeData *data = new QMimeData();
data->setData("application/x-rsfilelist", QByteArray(text.c_str()));
return data;
}
QStringList RemoteDirModel::mimeTypes () const
{
QStringList list;
list.push_back("application/x-rsfilelist");
return list;
}