From 683e75aeefd2e998606a4def80183d8a4b207b3b Mon Sep 17 00:00:00 2001 From: drbob Date: Sat, 7 Sep 2013 04:21:48 +0000 Subject: [PATCH] Removed Forums / Channels / Blogs stuff. and made GUI recompile. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6702 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ChannelFeed.cpp | 927 -------- retroshare-gui/src/gui/ChannelFeed.h | 139 -- retroshare-gui/src/gui/ChannelFeed.ui | 314 --- .../src/gui/FileTransfer/DLListDelegate.cpp | 2 +- .../src/gui/FileTransfer/TransfersDialog.cpp | 2 +- retroshare-gui/src/gui/ForumsDialog.cpp | 2113 ----------------- retroshare-gui/src/gui/ForumsDialog.h | 214 -- retroshare-gui/src/gui/ForumsDialog.ui | 591 ----- retroshare-gui/src/gui/MainWindow.cpp | 18 +- retroshare-gui/src/gui/MainWindow.h | 12 +- retroshare-gui/src/gui/NewsFeed.cpp | 18 +- retroshare-gui/src/gui/NewsFeed.h | 3 + retroshare-gui/src/gui/RetroShareLink.cpp | 14 +- .../src/gui/channels/ChannelDetails.cpp | 117 - .../src/gui/channels/ChannelDetails.h | 57 - .../src/gui/channels/ChannelDetails.ui | 148 -- .../src/gui/channels/ChannelUserNotify.cpp | 106 - .../src/gui/channels/ChannelUserNotify.h | 47 - .../src/gui/channels/CreateChannel.cpp | 151 -- .../src/gui/channels/CreateChannel.h | 51 - .../src/gui/channels/CreateChannel.ui | 371 --- .../src/gui/channels/CreateChannelMsg.cpp | 648 ----- .../src/gui/channels/CreateChannelMsg.h | 91 - .../src/gui/channels/CreateChannelMsg.ui | 365 --- .../src/gui/channels/EditChanDetails.cpp | 118 - .../src/gui/channels/EditChanDetails.h | 55 - .../src/gui/channels/EditChanDetails.ui | 143 -- retroshare-gui/src/gui/channels/ShareKey.cpp | 6 +- retroshare-gui/src/gui/common/StatusDefs.cpp | 6 - retroshare-gui/src/gui/feeds/BlogMsgItem.cpp | 189 -- retroshare-gui/src/gui/feeds/BlogMsgItem.h | 65 - retroshare-gui/src/gui/feeds/BlogMsgItem.ui | 242 -- retroshare-gui/src/gui/feeds/BlogNewItem.cpp | 219 -- retroshare-gui/src/gui/feeds/BlogNewItem.h | 62 - retroshare-gui/src/gui/feeds/BlogNewItem.ui | 260 -- retroshare-gui/src/gui/feeds/ChanMsgItem.cpp | 466 ---- retroshare-gui/src/gui/feeds/ChanMsgItem.h | 74 - retroshare-gui/src/gui/feeds/ChanMsgItem.ui | 481 ---- retroshare-gui/src/gui/feeds/ChanNewItem.cpp | 205 -- retroshare-gui/src/gui/feeds/ChanNewItem.h | 60 - retroshare-gui/src/gui/feeds/ChanNewItem.ui | 284 --- retroshare-gui/src/gui/feeds/ForumMsgItem.cpp | 436 ---- retroshare-gui/src/gui/feeds/ForumMsgItem.h | 69 - retroshare-gui/src/gui/feeds/ForumMsgItem.ui | 664 ------ retroshare-gui/src/gui/feeds/ForumNewItem.cpp | 206 -- retroshare-gui/src/gui/feeds/ForumNewItem.h | 61 - retroshare-gui/src/gui/feeds/ForumNewItem.ui | 325 --- retroshare-gui/src/gui/forums/CreateForum.cpp | 134 -- retroshare-gui/src/gui/forums/CreateForum.h | 54 - retroshare-gui/src/gui/forums/CreateForum.ui | 314 --- .../src/gui/forums/CreateForumMsg.cpp | 259 -- .../src/gui/forums/CreateForumMsg.h | 64 - .../src/gui/forums/CreateForumMsg.ui | 282 --- .../src/gui/forums/EditForumDetails.cpp | 82 - .../src/gui/forums/EditForumDetails.h | 53 - .../src/gui/forums/EditForumDetails.ui | 87 - .../src/gui/forums/ForumDetails.cpp | 112 - retroshare-gui/src/gui/forums/ForumDetails.h | 57 - retroshare-gui/src/gui/forums/ForumDetails.ui | 175 -- .../src/gui/forums/ForumUserNotify.cpp | 106 - .../src/gui/forums/ForumUserNotify.h | 47 - retroshare-gui/src/gui/settings/ForumPage.cpp | 58 - retroshare-gui/src/gui/settings/ForumPage.h | 49 - retroshare-gui/src/gui/settings/ForumPage.ui | 70 - .../src/gui/settings/NotifyPage.cpp | 4 + .../src/gui/settings/ServerPage.cpp | 2 +- .../src/gui/settings/rsettingswin.cpp | 4 +- .../src/gui/settings/rsharesettings.cpp | 4 +- .../src/gui/unfinished/blogs/BlogDetails.cpp | 147 -- .../src/gui/unfinished/blogs/BlogDetails.h | 68 - .../src/gui/unfinished/blogs/BlogDetails.ui | 151 -- .../src/gui/unfinished/blogs/BlogsDialog.cpp | 588 ----- .../src/gui/unfinished/blogs/BlogsDialog.h | 107 - .../src/gui/unfinished/blogs/BlogsDialog.ui | 568 ----- .../src/gui/unfinished/blogs/BlogsMsgItem.cpp | 192 -- .../src/gui/unfinished/blogs/BlogsMsgItem.h | 71 - .../src/gui/unfinished/blogs/BlogsMsgItem.ui | 274 --- .../src/gui/unfinished/blogs/CreateBlog.cpp | 173 -- .../src/gui/unfinished/blogs/CreateBlog.h | 60 - .../src/gui/unfinished/blogs/CreateBlog.ui | 329 --- .../gui/unfinished/blogs/CreateBlogMsg.cpp | 923 ------- .../src/gui/unfinished/blogs/CreateBlogMsg.h | 161 -- .../src/gui/unfinished/blogs/CreateBlogMsg.ui | 343 --- retroshare-gui/src/retroshare-gui.pro | 192 +- 84 files changed, 160 insertions(+), 17419 deletions(-) delete mode 100644 retroshare-gui/src/gui/ChannelFeed.cpp delete mode 100644 retroshare-gui/src/gui/ChannelFeed.h delete mode 100644 retroshare-gui/src/gui/ChannelFeed.ui delete mode 100644 retroshare-gui/src/gui/ForumsDialog.cpp delete mode 100644 retroshare-gui/src/gui/ForumsDialog.h delete mode 100644 retroshare-gui/src/gui/ForumsDialog.ui delete mode 100644 retroshare-gui/src/gui/channels/ChannelDetails.cpp delete mode 100644 retroshare-gui/src/gui/channels/ChannelDetails.h delete mode 100644 retroshare-gui/src/gui/channels/ChannelDetails.ui delete mode 100644 retroshare-gui/src/gui/channels/ChannelUserNotify.cpp delete mode 100644 retroshare-gui/src/gui/channels/ChannelUserNotify.h delete mode 100644 retroshare-gui/src/gui/channels/CreateChannel.cpp delete mode 100644 retroshare-gui/src/gui/channels/CreateChannel.h delete mode 100644 retroshare-gui/src/gui/channels/CreateChannel.ui delete mode 100644 retroshare-gui/src/gui/channels/CreateChannelMsg.cpp delete mode 100644 retroshare-gui/src/gui/channels/CreateChannelMsg.h delete mode 100644 retroshare-gui/src/gui/channels/CreateChannelMsg.ui delete mode 100644 retroshare-gui/src/gui/channels/EditChanDetails.cpp delete mode 100644 retroshare-gui/src/gui/channels/EditChanDetails.h delete mode 100644 retroshare-gui/src/gui/channels/EditChanDetails.ui delete mode 100644 retroshare-gui/src/gui/feeds/BlogMsgItem.cpp delete mode 100644 retroshare-gui/src/gui/feeds/BlogMsgItem.h delete mode 100644 retroshare-gui/src/gui/feeds/BlogMsgItem.ui delete mode 100644 retroshare-gui/src/gui/feeds/BlogNewItem.cpp delete mode 100644 retroshare-gui/src/gui/feeds/BlogNewItem.h delete mode 100644 retroshare-gui/src/gui/feeds/BlogNewItem.ui delete mode 100644 retroshare-gui/src/gui/feeds/ChanMsgItem.cpp delete mode 100644 retroshare-gui/src/gui/feeds/ChanMsgItem.h delete mode 100644 retroshare-gui/src/gui/feeds/ChanMsgItem.ui delete mode 100644 retroshare-gui/src/gui/feeds/ChanNewItem.cpp delete mode 100644 retroshare-gui/src/gui/feeds/ChanNewItem.h delete mode 100644 retroshare-gui/src/gui/feeds/ChanNewItem.ui delete mode 100644 retroshare-gui/src/gui/feeds/ForumMsgItem.cpp delete mode 100644 retroshare-gui/src/gui/feeds/ForumMsgItem.h delete mode 100644 retroshare-gui/src/gui/feeds/ForumMsgItem.ui delete mode 100644 retroshare-gui/src/gui/feeds/ForumNewItem.cpp delete mode 100644 retroshare-gui/src/gui/feeds/ForumNewItem.h delete mode 100644 retroshare-gui/src/gui/feeds/ForumNewItem.ui delete mode 100644 retroshare-gui/src/gui/forums/CreateForum.cpp delete mode 100644 retroshare-gui/src/gui/forums/CreateForum.h delete mode 100644 retroshare-gui/src/gui/forums/CreateForum.ui delete mode 100644 retroshare-gui/src/gui/forums/CreateForumMsg.cpp delete mode 100644 retroshare-gui/src/gui/forums/CreateForumMsg.h delete mode 100644 retroshare-gui/src/gui/forums/CreateForumMsg.ui delete mode 100644 retroshare-gui/src/gui/forums/EditForumDetails.cpp delete mode 100644 retroshare-gui/src/gui/forums/EditForumDetails.h delete mode 100644 retroshare-gui/src/gui/forums/EditForumDetails.ui delete mode 100644 retroshare-gui/src/gui/forums/ForumDetails.cpp delete mode 100644 retroshare-gui/src/gui/forums/ForumDetails.h delete mode 100644 retroshare-gui/src/gui/forums/ForumDetails.ui delete mode 100644 retroshare-gui/src/gui/forums/ForumUserNotify.cpp delete mode 100644 retroshare-gui/src/gui/forums/ForumUserNotify.h delete mode 100644 retroshare-gui/src/gui/settings/ForumPage.cpp delete mode 100644 retroshare-gui/src/gui/settings/ForumPage.h delete mode 100644 retroshare-gui/src/gui/settings/ForumPage.ui delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogDetails.cpp delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogDetails.h delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogDetails.ui delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.cpp delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.h delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.ui delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.cpp delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.h delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.ui delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.cpp delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h delete mode 100644 retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.ui diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp deleted file mode 100644 index 7d3ba46ea..000000000 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ /dev/null @@ -1,927 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "ChannelFeed.h" - -#include "feeds/ChanMsgItem.h" -#include "common/PopularityDefs.h" -#include "settings/rsharesettings.h" - -#include "channels/CreateChannel.h" -#include "channels/ChannelDetails.h" -#include "channels/CreateChannelMsg.h" -#include "channels/EditChanDetails.h" -#include "channels/ShareKey.h" -#include "channels/ChannelUserNotify.h" -#include "notifyqt.h" -#include "RetroShareLink.h" - -#define CHAN_DEFAULT_IMAGE ":/images/channels.png" - -#define WARNING_LIMIT 3600*24*2 - -/* Images for TreeWidget */ -#define IMAGE_CHANNELBLUE ":/images/channelsblue.png" -#define IMAGE_CHANNELGREEN ":/images/channelsgreen.png" -#define IMAGE_CHANNELRED ":/images/channelsred.png" -#define IMAGE_CHANNELYELLOW ":/images/channelsyellow.png" - -/**** - * #define CHAN_DEBUG - ***/ - -#define USE_THREAD - -/** Constructor */ -ChannelFeed::ChannelFeed(QWidget *parent) -: RsAutoUpdatePage(1000,parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg())); - connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int))); - - /*************** Setup Left Hand Side (List of Channels) ****************/ - - connect(treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT( channelListCustomPopupMenu( QPoint ) ) ); - connect(treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString))); - - mChannelId.clear(); - - /* Set initial size the splitter */ - QList sizes; - sizes << 300 << width(); // Qt calculates the right sizes - splitter->setSizes(sizes); - - /* Initialize group tree */ - QToolButton *newChannelButton = new QToolButton(this); - newChannelButton->setIcon(QIcon(":/images/add_channel24.png")); - newChannelButton->setToolTip(tr("Create Channel")); - connect(newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel())); - treeWidget->addToolButton(newChannelButton); - - ownChannels = treeWidget->addCategoryItem(tr("My Channels"), QIcon(IMAGE_CHANNELBLUE), true); - subcribedChannels = treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(IMAGE_CHANNELRED), true); - popularChannels = treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN ), false); - otherChannels = treeWidget->addCategoryItem(tr("Other Channels"), QIcon(IMAGE_CHANNELYELLOW), false); - - progressLabel->hide(); - progressBar->hide(); - - fillThread = NULL; - - //added from ahead - updateChannelList(); - - nameLabel->setMinimumWidth(20); - - /* load settings */ - processSettings(true); - - updateChannelMsgs(); - - QString help_str = tr( - "

  Channels

\ -

Channels allow you to post data (e.g. movies, music) that will spread in the network \ - among people who subscribed your channel. If you activate auto-download on a channel, files attached to each post will start \ - downloading automatically when the post is received.

\ -

You see channels your friends are subscribed to, and forward subscribed channels to \ - your friends. This promotes good channels in the network. \ - When you first connect to a new friend, it's likely \ - you will receive many such cache files, and new channels will appear. \ -

\ -

Only the channel's creator can post on that channel. Other peers \ - in the network can only read from it, unless the channel is private. You can however share the posting rights or the reading rights \ - with your friends.

\ - ") ; - - - registerHelpButton(helpButton,help_str) ; -} - -ChannelFeed::~ChannelFeed() -{ - if (fillThread) { - fillThread->stop(); - delete(fillThread); - fillThread = NULL; - } - - // save settings - processSettings(false); -} - -UserNotify *ChannelFeed::getUserNotify(QObject *parent) -{ - return new ChannelUserNotify(parent); -} - -void ChannelFeed::processSettings(bool load) -{ - Settings->beginGroup(QString("ChannelFeed")); - - if (load) { - // load settings - - // state of splitter - splitter->restoreState(Settings->value("Splitter").toByteArray()); - } else { - // save settings - - // state of splitter - Settings->setValue("Splitter", splitter->saveState()); - } - - treeWidget->processSettings(Settings, load); - - Settings->endGroup(); -} - -void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ ) -{ - ChannelInfo ci; - if (!rsChannels->getChannelInfo(mChannelId, ci)) { - return; - } - - QMenu contextMnu(this); - - QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), &contextMnu); - connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) ); - - QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu); - connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) ); - - QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu); - connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) ); - - QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu); - connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) ); - - bool autoDl = false; - rsChannels->channelGetAutoDl(mChannelId, autoDl); - - QAction *autochannelAct = autoDl? (new QAction(QIcon(":/images/redled.png"), tr( "Disable Auto-Download" ), &contextMnu)) - : (new QAction(QIcon(":/images/start.png"),tr( "Enable Auto-Download" ), &contextMnu)) ; - - connect( autochannelAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) ); - - QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu); - connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) ); - - QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), &contextMnu); - connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) ); - - QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu); - connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) ); - - QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Channel"), &contextMnu); - connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); - - if((ci.channelFlags & RS_DISTRIB_ADMIN) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) - contextMnu.addAction( editChannelDetailAct); - else - contextMnu.addAction( channeldetailsAct ); - - if((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)) - { - contextMnu.addAction( postchannelAct ); - contextMnu.addAction( shareKeyAct ); - } - - if(ci.channelFlags & RS_DISTRIB_SUBSCRIBED) - { - QMenu *directoryMenu = contextMnu.addMenu(QIcon(":/images/folderopen.png"),tr("Set destination directory")) ; - - QAction *specifyDestinationDirectoryAct = new QAction(QIcon(":/images/filefind.png"), tr("Other..."), &contextMnu); - directoryMenu->addAction(specifyDestinationDirectoryAct); - connect(specifyDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(chooseDestinationDirectory())) ; - - // Now get the list of existing directories. - - std::list dirs ; - rsFiles->getSharedDirectories(dirs) ; - bool found = false ; - - for(std::list::const_iterator it(dirs.begin());it!=dirs.end();++it) - { - // check for existence of directory name - QFile directory(QString::fromUtf8((*it).filename.c_str())) ; - - if(!directory.exists()) continue ; - if(!(directory.permissions() & QFile::WriteOwner)) continue ; - - QAction *act ; - - if(ci.destination_directory == (*it).filename) - { - act = new QAction(QIcon(":/images/start.png"),QString::fromUtf8((*it).virtualname.c_str()),directoryMenu) ; - found = true ; - } - else - act = new QAction(QString::fromUtf8((*it).virtualname.c_str()),directoryMenu) ; - - act->setData(QString::fromUtf8((*it).filename.c_str())) ; - connect(act,SIGNAL(triggered()),this,SLOT(setDestinationDirectory())) ; - directoryMenu->addAction(act) ; - } - QAction *defaultDestinationDirectoryAct = new QAction(tr("[Default]"), &contextMnu); - defaultDestinationDirectoryAct->setData(QString()) ; - connect(defaultDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(setDestinationDirectory())) ; - - directoryMenu->addAction(defaultDestinationDirectoryAct); - - if(ci.destination_directory.empty()) - defaultDestinationDirectoryAct->setIcon(QIcon(":/images/start.png")) ; - else if(!found) - specifyDestinationDirectoryAct->setIcon(QIcon(":/images/start.png")) ; - } - - if(ci.channelFlags & RS_DISTRIB_SUBSCRIBED) - { - contextMnu.addAction( unsubscribechannelAct ); - contextMnu.addAction( restoreKeysAct ); - contextMnu.addSeparator(); - contextMnu.addAction( autochannelAct ); - contextMnu.addAction( setallasreadchannelAct ); - } - else - contextMnu.addAction( subscribechannelAct ); - - contextMnu.addSeparator(); - QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); - action->setEnabled(!mChannelId.empty()); - -#ifdef CHAN_DEBUG - contextMnu.addSeparator(); - action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData())); - action->setEnabled (!mChannelId.empty() && (ci.channelFlags & RS_DISTRIB_PUBLISH)); -#endif - - contextMnu.exec(QCursor::pos()); -} -void ChannelFeed::setDestinationDirectory() -{ - ChannelInfo ci; - if (!rsChannels->getChannelInfo(mChannelId, ci)) - return; - - std::string dest_dir(qobject_cast(sender())->data().toString().toUtf8().data()) ; - - std::cerr << "Setting new directory " << dest_dir << " to channel " << mChannelId << std::endl; - rsChannels->channelSetDestinationDirectory(mChannelId,dest_dir) ; -} -void ChannelFeed::chooseDestinationDirectory() -{ - ChannelInfo ci; - if (!rsChannels->getChannelInfo(mChannelId, ci)) - return; - - QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Select channel destination directory"),QString::fromStdString(ci.destination_directory),QFileDialog::ShowDirsOnly) ; - - if(dirname.isNull()) - return ; - - std::cerr << "Setting new directory " << dirname.toStdString() << " to channel " << mChannelId << std::endl; - rsChannels->channelSetDestinationDirectory(mChannelId,dirname.toStdString()) ; -} -void ChannelFeed::createChannel() -{ - CreateChannel *cf = new CreateChannel(); - cf->show(); - - /* window will destroy itself! */ -} - -/*************************************************************************************/ -/*************************************************************************************/ -/*************************************************************************************/ - -QScrollArea *ChannelFeed::getScrollArea() -{ - return scrollArea; -} - -void ChannelFeed::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/) -{ -} - -void ChannelFeed::openChat(std::string /*peerId*/) -{ -} - -void ChannelFeed::openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /* title */) -{ -} - -void ChannelFeed::editChannelDetail(){ - - EditChanDetails editUi(this, mChannelId); - editUi.exec(); -} - -void ChannelFeed::shareKey() -{ - ShareKey shareUi(this, mChannelId, CHANNEL_KEY_SHARE); - shareUi.exec(); -} - -void ChannelFeed::copyChannelLink() -{ - if (mChannelId.empty()) { - return; - } - - ChannelInfo ci; - if (rsChannels->getChannelInfo(mChannelId, ci)) { - RetroShareLink link; - if (link.createChannel(ci.channelId, "")) { - QList urls; - urls.push_back(link); - RSLinkClipboard::copyLinks(urls); - } - } -} - -void ChannelFeed::createMsg() -{ - if (mChannelId.empty()) { - return; - } - - CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId); - msgDialog->show(); - - /* window will destroy itself! */ -} - -void ChannelFeed::restoreChannelKeys() -{ - if(rsChannels->channelRestoreKeys(mChannelId)) - QMessageBox::information(NULL,tr("Publish rights restored."),tr("Publish rights have been restored for this channel.")) ; - else - QMessageBox::warning(NULL,tr("Publish not restored."),tr("Publish rights can't be restored for this channel.
You're not the creator of this channel.")) ; -} - -void ChannelFeed::selectChannel(const QString &id) -{ - mChannelId = id.toStdString(); - - bool autoDl = false; - rsChannels->channelGetAutoDl(mChannelId, autoDl); - - setAutoDownloadButton(autoDl); - - updateChannelMsgs(); -} - -void ChannelFeed::updateDisplay() -{ - if (!rsChannels) { - return; - } - - std::list chanIds; - std::list::iterator it; - - if (rsChannels->channelsChanged(chanIds)) { - /* update channel list */ - updateChannelList(); - - it = std::find(chanIds.begin(), chanIds.end(), mChannelId); - if (it != chanIds.end()) { - updateChannelMsgs(); - } - } -} - -static void channelInfoToGroupItemInfo(const ChannelInfo &channelInfo, GroupItemInfo &groupItemInfo) -{ - groupItemInfo.id = QString::fromStdString(channelInfo.channelId); - groupItemInfo.name = QString::fromStdWString(channelInfo.channelName); - groupItemInfo.description = QString::fromStdWString(channelInfo.channelDesc); - groupItemInfo.popularity = channelInfo.pop; - groupItemInfo.lastpost = QDateTime::fromTime_t(channelInfo.lastPost); - - QPixmap chanImage; - if (channelInfo.pngImageLen) { - chanImage.loadFromData(channelInfo.pngChanImage, channelInfo.pngImageLen, "PNG"); - } else { - chanImage = QPixmap(CHAN_DEFAULT_IMAGE); - } - - groupItemInfo.icon = QIcon(chanImage); -} - -void ChannelFeed::updateChannelList() -{ - if (!rsChannels) { - return; - } - - std::list channelList; - std::list::iterator it; - rsChannels->getChannelList(channelList); - - std::list keysAvailable; - std::list::iterator keyIt; - rsChannels->getPubKeysAvailableGrpIds(keysAvailable); - - /* get the ids for our lists */ - QList adminList; - QList subList; - QList popList; - QList otherList; - std::multimap popMap; - - for(it = channelList.begin(); it != channelList.end(); it++) { - /* sort it into Publish (Own), Subscribed, Popular and Other */ - uint32_t flags = it->channelFlags; - - GroupItemInfo groupItemInfo; - channelInfoToGroupItemInfo(*it, groupItemInfo); - - if ((flags & RS_DISTRIB_ADMIN) && (flags & RS_DISTRIB_PUBLISH) && (flags & RS_DISTRIB_SUBSCRIBED)) { - adminList.push_back(groupItemInfo); - } else { - for (keyIt = keysAvailable.begin(); keyIt != keysAvailable.end(); keyIt++) { - if (it->channelId == *keyIt) { - /* Found Key, set title text to bold and colored blue */ - groupItemInfo.privatekey = true; - break; - } - } - - if ((flags & RS_DISTRIB_SUBSCRIBED) || ((flags & RS_DISTRIB_SUBSCRIBED) && (flags & RS_DISTRIB_PUBLISH)) ) { - subList.push_back(groupItemInfo); - } else { - /* rate the others by popularity */ - popMap.insert(std::make_pair(it->pop, groupItemInfo)); - } - } - } - - /* iterate backwards through popMap - take the top 5 or 10% of list */ - uint32_t popCount = 5; - if (popCount < popMap.size() / 10) { - popCount = popMap.size() / 10; - } - - uint32_t i = 0; - std::multimap::reverse_iterator rit; - for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) { - if (i < popCount) { - popList.push_back(rit->second); - i++; - } else { - otherList.push_back(rit->second); - } - } - - /* now we have our lists ---> update entries */ - - treeWidget->fillGroupItems(ownChannels, adminList); - treeWidget->fillGroupItems(subcribedChannels, subList); - treeWidget->fillGroupItems(popularChannels, popList); - treeWidget->fillGroupItems(otherChannels, otherList); - - updateMessageSummaryList(""); -} - - -void ChannelFeed::channelMsgReadSatusChanged(const QString& channelId, const QString& /*msgId*/, int /*status*/) -{ - updateMessageSummaryList(channelId.toStdString()); -} - -void ChannelFeed::updateMessageSummaryList(const std::string &channelId) -{ - QTreeWidgetItem *items[2] = { ownChannels, subcribedChannels }; - - for (int item = 0; item < 2; item++) { - int child; - int childCount = items[item]->childCount(); - for (child = 0; child < childCount; child++) { - QTreeWidgetItem *childItem = items[item]->child(child); - std::string childId = treeWidget->itemId(childItem).toStdString(); - if (childId.empty()) { - continue; - } - - if (channelId.empty() || childId == channelId) { - /* Calculate unread messages */ - unsigned int newMessageCount = 0; - unsigned int unreadMessageCount = 0; - rsChannels->getMessageCount(childId, newMessageCount, unreadMessageCount); - - treeWidget->setUnreadCount(childItem, unreadMessageCount); - - if (channelId.empty() == false) { - /* Calculate only this channel */ - break; - } - } - } - } -} - -static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMsgSummary &msg2) -{ - return (msg1.ts > msg2.ts); -} - -void ChannelFeed::updateChannelMsgs() -{ - if (fillThread) { -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::updateChannelMsgs() stop current fill thread" << std::endl; -#endif - // stop current fill thread - ChannelFillThread *thread = fillThread; - fillThread = NULL; - thread->stop(); - delete(thread); - - progressLabel->hide(); - progressBar->hide(); - } - - if (!rsChannels) { - return; - } - - /* replace all the messages with new ones */ - QList::iterator mit; - for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) { - delete (*mit); - } - mChanMsgItems.clear(); - - ChannelInfo ci; - if (!rsChannels->getChannelInfo(mChannelId, ci)) { - postButton->setEnabled(false); - nameLabel->setText(tr("No Channel Selected")); - logoLabel->setPixmap(QPixmap(":/images/channels.png")); - logoLabel->setEnabled(false); - return; - } - - QPixmap chanImage; - if (ci.pngImageLen != 0) { - chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG"); - } else { - chanImage = QPixmap(CHAN_DEFAULT_IMAGE); - } - logoLabel->setPixmap(chanImage); - logoLabel->setEnabled(true); - - /* set Channel name */ - nameLabel->setText(QString::fromStdWString(ci.channelName)); - - if (ci.channelFlags & RS_DISTRIB_PUBLISH) { - postButton->setEnabled(true); - } else { - postButton->setEnabled(false); - } - - if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) { - actionEnable_Auto_Download->setEnabled(true); - } else { - actionEnable_Auto_Download->setEnabled(false); - } - -#ifdef USE_THREAD - progressLabel->show(); - progressBar->reset(); - progressBar->show(); - - // create fill thread - fillThread = new ChannelFillThread(this, mChannelId); - - // connect thread - connect(fillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection); - connect(fillThread, SIGNAL(addMsg(QString,QString,int,int)), this, SLOT(fillThreadAddMsg(QString,QString,int,int)), Qt::BlockingQueuedConnection); - -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::updateChannelMsgs() Start fill thread" << std::endl; -#endif - - // start thread - fillThread->start(); -#else - std::list msgs; - std::list::iterator it; - rsChannels->getChannelMsgList(mChannelId, msgs); - - msgs.sort(sortChannelMsgSummary); - - for (it = msgs.begin(); it != msgs.end(); it++) { - ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true); - mChanMsgItems.push_back(cmi); - verticalLayout_2->addWidget(cmi); - } -#endif -} - -void ChannelFeed::fillThreadFinished() -{ -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::fillThreadFinished()" << std::endl; -#endif - - // thread has finished - ChannelFillThread *thread = dynamic_cast(sender()); - if (thread) { - if (thread == fillThread) { - // current thread has finished, hide progressbar and release thread - progressBar->hide(); - progressLabel->hide(); - fillThread = NULL; - } - -#ifdef CHAN_DEBUG - if (thread->wasStopped()) { - // thread was stopped - std::cerr << "ChannelFeed::fillThreadFinished() Thread was stopped" << std::endl; - } -#endif - -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::fillThreadFinished() Delete thread" << std::endl; -#endif - - thread->deleteLater(); - thread = NULL; - } - -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::fillThreadFinished done()" << std::endl; -#endif -} - -void ChannelFeed::fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count) -{ - if (sender() == fillThread) { - // show fill progress - if (count) { - progressBar->setValue(current * progressBar->maximum() / count); - } - - lockLayout(NULL, true); - - ChanMsgItem *cmi = new ChanMsgItem(this, 0, channelId.toStdString(), channelMsgId.toStdString(), true); - mChanMsgItems.push_back(cmi); - verticalLayout->addWidget(cmi); - cmi->show(); - - lockLayout(cmi, false); - } -} - -void ChannelFeed::unsubscribeChannel() -{ -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::unsubscribeChannel()"; - std::cerr << std::endl; -#endif - - if (rsChannels) { - rsChannels->channelSubscribe(mChannelId, false, false); - } - - updateChannelMsgs(); -} - - -void ChannelFeed::subscribeChannel() -{ -#ifdef CHAN_DEBUG - std::cerr << "ChannelFeed::subscribeChannel()"; - std::cerr << std::endl; -#endif - - if (rsChannels) { - rsChannels->channelSubscribe(mChannelId, true, false); - } - - updateChannelMsgs(); -} - -void ChannelFeed::showChannelDetails() -{ - if (mChannelId.empty()) { - return; - } - - if (!rsChannels) { - return; - } - - ChannelDetails channelui (this); - - channelui.showDetails(mChannelId); - channelui.exec(); -} - -void ChannelFeed::setAllAsReadClicked() -{ - if (mChannelId.empty()) { - return; - } - - if (!rsChannels) { - return; - } - - ChannelInfo ci; - if (rsChannels->getChannelInfo(mChannelId, ci) == false) { - return; - } - - if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) { - std::list msgs; - std::list::iterator it; - - rsChannels->getChannelMsgList(mChannelId, msgs); - - for(it = msgs.begin(); it != msgs.end(); it++) { - rsChannels->setMessageStatus(mChannelId, it->msgId, CHANNEL_MSG_STATUS_READ, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER); - } - } -} - -void ChannelFeed::toggleAutoDownload(){ - - if(mChannelId.empty()) - return; - - bool autoDl = true; - - if(rsChannels->channelGetAutoDl(mChannelId, autoDl)){ - - // if auto dl is set true, then set false - if(autoDl){ - rsChannels->channelSetAutoDl(mChannelId, false); - }else{ - rsChannels->channelSetAutoDl(mChannelId, true); - } - setAutoDownloadButton(!autoDl); - } - else{ - std::cerr << "Auto Download failed to set" - << std::endl; - } -} - -bool ChannelFeed::navigate(const std::string& channelId, const std::string& msgId) -{ - if (channelId.empty()) { - return false; - } - - if (treeWidget->activateId(QString::fromStdString(channelId), msgId.empty()) == NULL) { - return false; - } - - /* Messages are filled in selectChannel */ - if (mChannelId != channelId) { - return false; - } - - if (msgId.empty()) { - return true; - } - - /* Search exisiting item */ - QList::iterator mit; - for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) { - ChanMsgItem *item = *mit; - if (item->msgId() == msgId) { - // the next two lines are necessary to calculate the layout of the widgets in the scroll area (maybe there is a better solution) - item->show(); - QCoreApplication::processEvents(); - - scrollArea->ensureWidgetVisible(item, 0, 0); - return true; - } - } - - return false; -} - -void ChannelFeed::setAutoDownloadButton(bool autoDl) -{ - if (autoDl) { - actionEnable_Auto_Download->setText(tr("Disable Auto-Download")); - }else{ - actionEnable_Auto_Download->setText(tr("Enable Auto-Download")); - } -} - -void ChannelFeed::generateMassData() -{ -#ifdef CHAN_DEBUG - if (mChannelId.empty ()) { - return; - } - - if (QMessageBox::question(this, "Generate mass data", "Do you really want to generate mass data ?", QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) { - return; - } - - for (int thread = 1; thread < 1000; thread++) { - ChannelMsgInfo msgInfo; - msgInfo.channelId = mChannelId; - msgInfo.subject = QString("Test %1").arg(thread, 3, 10, QChar('0')).toStdWString(); - msgInfo.msg = QString("That is only a test").toStdWString(); - - if (rsChannels->ChannelMessageSend(msgInfo) == false) { - return; - } - } -#endif -} - -// ForumsFillThread -ChannelFillThread::ChannelFillThread(ChannelFeed *parent, const std::string &channelId) - : QThread(parent) -{ - stopped = false; - this->channelId = channelId; -} - -ChannelFillThread::~ChannelFillThread() -{ -#ifdef CHAN_DEBUG - std::cerr << "ChannelFillThread::~ChannelFillThread" << std::endl; -#endif -} - -void ChannelFillThread::stop() -{ - disconnect(); - stopped = true; - QApplication::processEvents(); - wait(); -} - -void ChannelFillThread::run() -{ -#ifdef CHAN_DEBUG - std::cerr << "ChannelFillThread::run()" << std::endl; -#endif - - std::list msgs; - std::list::iterator it; - rsChannels->getChannelMsgList(channelId, msgs); - - msgs.sort(sortChannelMsgSummary); - - int count = msgs.size(); - int pos = 0; - - for (it = msgs.begin(); it != msgs.end(); it++) { - if (stopped) { - break; - } - - emit addMsg(QString::fromStdString(channelId), QString::fromStdString(it->msgId), ++pos, count); - } - -#ifdef CHAN_DEBUG - std::cerr << "ChannelFillThread::run() stopped: " << (wasStopped() ? "yes" : "no") << std::endl; -#endif -} diff --git a/retroshare-gui/src/gui/ChannelFeed.h b/retroshare-gui/src/gui/ChannelFeed.h deleted file mode 100644 index a92c4f811..000000000 --- a/retroshare-gui/src/gui/ChannelFeed.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CHANNEL_FEED_DIALOG_H -#define _CHANNEL_FEED_DIALOG_H - -#include -#include -#include -#include - -#include "mainpage.h" -#include "RsAutoUpdatePage.h" - -#include "ui_ChannelFeed.h" - -#include "gui/feeds/FeedHolder.h" - -class ChanMsgItem; -class QTreeWidgetItem; -class ChannelFillThread; - -class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed -{ - Q_OBJECT - -public: - /** Default Constructor */ - ChannelFeed(QWidget *parent = 0); - /** Default Destructor */ - ~ChannelFeed(); - - virtual UserNotify *getUserNotify(QObject *parent); - - /* FeedHolder */ - virtual QScrollArea *getScrollArea(); - virtual void deleteFeedItem(QWidget *item, uint32_t type); - virtual void openChat(std::string peerId); - virtual void openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /*title */); - - bool navigate(const std::string& channelId, const std::string& msgId); - - /* overloaded from RsAuthUpdatePage */ - virtual void updateDisplay(); - -private slots: - void channelListCustomPopupMenu( QPoint point ); - void selectChannel(const QString &id); - - void createChannel(); - - void subscribeChannel(); - void unsubscribeChannel(); - void setAllAsReadClicked(); - void toggleAutoDownload(); - - void createMsg(); - - void showChannelDetails(); - void restoreChannelKeys(); - void editChannelDetail(); - void shareKey(); - void copyChannelLink(); - void setDestinationDirectory(); - void chooseDestinationDirectory(); - - void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status); - - void generateMassData(); - - void fillThreadFinished(); - void fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count); - -private: - void updateChannelList(); - void updateChannelMsgs(); - void updateMessageSummaryList(const std::string &channelId); - - void processSettings(bool load); - - void setAutoDownloadButton(bool autoDl); - - std::string mChannelId; /* current Channel */ - - /* Layout Pointers */ - QBoxLayout *mMsgLayout; - - QList mChanMsgItems; - std::map mChanSearchScore; //chanId, score - - QTreeWidgetItem *ownChannels; - QTreeWidgetItem *subcribedChannels; - QTreeWidgetItem *popularChannels; - QTreeWidgetItem *otherChannels; - - ChannelFillThread *fillThread; -}; - -class ChannelFillThread : public QThread -{ - Q_OBJECT - -public: - ChannelFillThread(ChannelFeed *parent, const std::string &channelId); - ~ChannelFillThread(); - - void run(); - void stop(); - bool wasStopped() { return stopped; } - -signals: - void addMsg(const QString &channelId, const QString &channelMsgId, int current, int count); - -public: - std::string channelId; - -private: - volatile bool stopped; -}; - -#endif diff --git a/retroshare-gui/src/gui/ChannelFeed.ui b/retroshare-gui/src/gui/ChannelFeed.ui deleted file mode 100644 index 2ccf8ce45..000000000 --- a/retroshare-gui/src/gui/ChannelFeed.ui +++ /dev/null @@ -1,314 +0,0 @@ - - - ChannelFeed - - - - 0 - 0 - 681 - 476 - - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - - 24 - 24 - - - - - - - :/images/channels32.png - - - true - - - - - - - - 10 - 75 - true - - - - Channels - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::NoFocus - - - - :/images/64px_help.png:/images/64px_help.png - - - true - - - true - - - - - - - - - - Qt::Horizontal - - - - - 0 - 0 - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - 4 - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - - - :/images/channels.png - - - true - - - - - - - - - - - - - - - 21 - - - - Channel Name - - - true - - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - Qt::NoFocus - - - Post to Channel - - - - :/images/mail_send.png:/images/mail_send.png - - - - 32 - 16 - - - - true - - - - - - - Qt::Horizontal - - - - 314 - 10 - - - - - - - - - - - - - Loading - - - - - - - 1000 - - - 24 - - - - - - - - - true - - - - - 0 - 0 - 513 - 16 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - - - - - - - - - - - Set all as read - - - Set all as read - - - - - Enable Auto-Download - - - Enable Auto-Download - - - splitter - titleBarFrame - - - - GroupTreeWidget - QWidget -
gui/common/GroupTreeWidget.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp b/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp index f693df430..71b9774c8 100644 --- a/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp +++ b/retroshare-gui/src/gui/FileTransfer/DLListDelegate.cpp @@ -222,7 +222,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti case COLUMN_LASTDL: qi64Value = index.data().value(); if (qi64Value < std::numeric_limits::max()){ - QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value/1000); + QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value); painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss")); } else { painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen")); diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index 19d252957..869b98a8f 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -945,7 +945,7 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map -#include -#include -#include -#include -#include - -#include "ForumsDialog.h" -#include "forums/CreateForum.h" -#include "forums/CreateForumMsg.h" -#include "forums/ForumDetails.h" -#include "forums/EditForumDetails.h" -#include "forums/ForumUserNotify.h" -#include "msgs/MessageComposer.h" -#include "settings/rsharesettings.h" -#include "common/Emoticons.h" -#include "common/RSItemDelegate.h" -#include "common/PopularityDefs.h" -#include "common/RSTreeWidgetItem.h" -#include "RetroShareLink.h" -#include "channels/ShareKey.h" -#include "notifyqt.h" -#include "util/HandleRichText.h" -#include "util/DateTime.h" - -#include -#include -#include - -#include - -//#define DEBUG_FORUMS - -/* Images for context menu icons */ -#define IMAGE_MESSAGE ":/images/folder-draft.png" -#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png" -#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png" -#define IMAGE_DOWNLOAD ":/images/start.png" -#define IMAGE_DOWNLOADALL ":/images/startall.png" - -/* Images for TreeWidget */ -#define IMAGE_FOLDER ":/images/folder16.png" -#define IMAGE_FOLDERGREEN ":/images/folder_green.png" -#define IMAGE_FOLDERRED ":/images/folder_red.png" -#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png" -#define IMAGE_FORUM ":/images/konversation.png" -#define IMAGE_SUBSCRIBE ":/images/edit_add24.png" -#define IMAGE_UNSUBSCRIBE ":/images/cancel.png" -#define IMAGE_INFO ":/images/info16.png" -#define IMAGE_NEWFORUM ":/images/new_forum16.png" -#define IMAGE_FORUMAUTHD ":/images/konv_message2.png" -#define IMAGE_COPYLINK ":/images/copyrslink.png" - -#define VIEW_LAST_POST 0 -#define VIEW_THREADED 1 -#define VIEW_FLAT 2 - -/* Thread constants */ -#define COLUMN_THREAD_COUNT 6 -#define COLUMN_THREAD_TITLE 0 -#define COLUMN_THREAD_READ 1 -#define COLUMN_THREAD_DATE 2 -#define COLUMN_THREAD_AUTHOR 3 -#define COLUMN_THREAD_SIGNED 4 -#define COLUMN_THREAD_CONTENT 5 - -#define COLUMN_THREAD_DATA 0 // column for storing the userdata like msgid and parentid - -#define ROLE_THREAD_MSGID Qt::UserRole -#define ROLE_THREAD_STATUS Qt::UserRole + 1 -#define ROLE_THREAD_MISSING Qt::UserRole + 2 -// no need to copy, don't count in ROLE_THREAD_COUNT -#define ROLE_THREAD_READCHILDREN Qt::UserRole + 3 -#define ROLE_THREAD_UNREADCHILDREN Qt::UserRole + 4 -#define ROLE_THREAD_SORT Qt::UserRole + 5 - -#define ROLE_THREAD_COUNT 3 - -#define IS_UNREAD(status) ((status & FORUM_MSG_STATUS_READ) == 0 || (status & FORUM_MSG_STATUS_UNREAD_BY_USER)) -#define IS_FORUM_ADMIN(subscribeFlags) (subscribeFlags & RS_DISTRIB_ADMIN) -#define IS_FORUM_SUBSCRIBED(subscribeFlags) (subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED)) - -/** Constructor */ -ForumsDialog::ForumsDialog(QWidget *parent) -: RsAutoUpdatePage(1000,parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - m_bProcessSettings = false; - subscribeFlags = 0; - inMsgAsReadUnread = false; - - threadCompareRole = new RSTreeWidgetItemCompareRole; - threadCompareRole->setRole(COLUMN_THREAD_DATE, ROLE_THREAD_SORT); - - connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) ); - connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) ); - - connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(createmessage())); - connect(ui.newthreadButton, SIGNAL(clicked()), this, SLOT(createthread())); - - connect( ui.forumTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedForum(QString) ) ); - - connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread () ) ); - connect( ui.threadTreeWidget, SIGNAL( itemClicked(QTreeWidgetItem*,int)), this, SLOT( clickedThread (QTreeWidgetItem*,int) ) ); - connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( changedViewBox () ) ); - - connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(togglethreadview())); - connect(ui.previousButton, SIGNAL(clicked()), this, SLOT(previousMessage())); - connect(ui.nextButton, SIGNAL(clicked()), this, SLOT(nextMessage())); - connect(ui.nextUnreadButton, SIGNAL(clicked()), this, SLOT(nextUnreadMessage())); - - connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadAllFiles())); - - connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString))); - connect(ui.filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int))); - - connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int))); - - /* Set initial size the splitter */ - QList sizes; - sizes << 300 << width(); // Qt calculates the right sizes - //ui.splitter->setSizes(sizes); - - /* Set own item delegate */ - RSItemDelegate *itemDelegate = new RSItemDelegate(this); - itemDelegate->setSpacing(QSize(0, 2)); - ui.threadTreeWidget->setItemDelegate(itemDelegate); - - /* Set header resize modes and initial section sizes */ - QHeaderView * ttheader = ui.threadTreeWidget->header () ; - ttheader->setResizeMode (COLUMN_THREAD_TITLE, QHeaderView::Interactive); - ttheader->resizeSection (COLUMN_THREAD_DATE, 140); - ttheader->resizeSection (COLUMN_THREAD_TITLE, 290); - - ui.threadTreeWidget->sortItems( COLUMN_THREAD_DATE, Qt::DescendingOrder ); - - /* Set text of column "Read" to empty - without this the column has a number as header text */ - QTreeWidgetItem *headerItem = ui.threadTreeWidget->headerItem(); - headerItem->setText(COLUMN_THREAD_READ, ""); - - /* Initialize group tree */ - QToolButton *newForumButton = new QToolButton(this); - newForumButton->setIcon(QIcon(":/images/new_forum16.png")); - newForumButton->setToolTip(tr("Create Forum")); - connect(newForumButton, SIGNAL(clicked()), this, SLOT(newforum())); - ui.forumTreeWidget->addToolButton(newForumButton); - - /* create forum tree */ - yourForums = ui.forumTreeWidget->addCategoryItem(tr("My Forums"), QIcon(IMAGE_FOLDER), true); - subscribedForums = ui.forumTreeWidget->addCategoryItem(tr("Subscribed Forums"), QIcon(IMAGE_FOLDERRED), true); - popularForums = ui.forumTreeWidget->addCategoryItem(tr("Popular Forums"), QIcon(IMAGE_FOLDERGREEN), false); - otherForums = ui.forumTreeWidget->addCategoryItem(tr("Other Forums"), QIcon(IMAGE_FOLDERYELLOW), false); - - lastViewType = -1; - - /* add filter actions */ - ui.filterLineEdit->addFilter(QIcon(), tr("Title"), COLUMN_THREAD_TITLE, tr("Search Title")); - ui.filterLineEdit->addFilter(QIcon(), tr("Date"), COLUMN_THREAD_DATE, tr("Search Date")); - ui.filterLineEdit->addFilter(QIcon(), tr("Author"), COLUMN_THREAD_AUTHOR, tr("Search Author")); - ui.filterLineEdit->addFilter(QIcon(), tr("Content"), COLUMN_THREAD_CONTENT, tr("Search Content")); - ui.filterLineEdit->setCurrentFilter(COLUMN_THREAD_TITLE); - - // load settings - processSettings(true); - - /* Set header sizes for the fixed columns and resize modes, must be set after processSettings */ - ttheader->resizeSection (COLUMN_THREAD_READ, 24); - ttheader->setResizeMode (COLUMN_THREAD_READ, QHeaderView::Fixed); - ttheader->hideSection (COLUMN_THREAD_CONTENT); - - ui.progressBar->hide(); - ui.progLayOutTxt->hide(); - ui.progressBarLayOut->setEnabled(false); - - fillThread = NULL; - - insertThreads(); - - ui.threadTreeWidget->installEventFilter(this); - - /* Hide platform specific features */ -#ifdef Q_WS_WIN - -#endif - - QString help_str = tr( - "

  Forums

\ -

Retroshare Forums look like internet forums, but they work in a decentralized way: \ - You see forums your friends are subscribed to, and you forward subscribed forums to \ - your friends. This automatically promotes interesting forums in the network.

\ -

Forums are either Authenticated () in which case you need to cryptographically sign \ - your posts, or anonymous (). The former class is more resistant to spamming.

\ -

Forum posts propagate from friend to friend using small cache file exchanges. When you first connect to a new friend, it's likely \ - you will receive many such cache files, and new forums will appear. \ -

\ - ") ; - - - registerHelpButton(ui.helpButton,help_str) ; -} - -ForumsDialog::~ForumsDialog() -{ - if (fillThread) { - fillThread->stop(); - delete(fillThread); - fillThread = NULL; - } - - delete(threadCompareRole); - - // save settings - processSettings(false); -} - -UserNotify *ForumsDialog::getUserNotify(QObject *parent) -{ - return new ForumUserNotify(parent); -} - -void ForumsDialog::processSettings(bool bLoad) -{ - m_bProcessSettings = true; - - QHeaderView *pHeader = ui.threadTreeWidget->header () ; - - Settings->beginGroup(QString("ForumsDialog")); - - if (bLoad) { - // load settings - - // expandFiles - bool bValue = Settings->value("expandButton", true).toBool(); - ui.expandButton->setChecked(bValue); - togglethreadview_internal(); - - // filterColumn - ui.filterLineEdit->setCurrentFilter(Settings->value("filterColumn", COLUMN_THREAD_TITLE).toInt()); - - // index of viewBox - ui.viewBox->setCurrentIndex(Settings->value("viewBox", VIEW_THREADED).toInt()); - - // state of thread tree - pHeader->restoreState(Settings->value("ThreadTree").toByteArray()); - - // state of splitter - ui.splitter->restoreState(Settings->value("Splitter").toByteArray()); - ui.threadSplitter->restoreState(Settings->value("threadSplitter").toByteArray()); - } else { - // save settings - - // state of thread tree - Settings->setValue("ThreadTree", pHeader->saveState()); - - // state of splitter - Settings->setValue("Splitter", ui.splitter->saveState()); - Settings->setValue("threadSplitter", ui.threadSplitter->saveState()); - } - - ui.forumTreeWidget->processSettings(Settings, bLoad); - - Settings->endGroup(); - m_bProcessSettings = false; -} - -void ForumsDialog::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::StyleChange: - CalculateIconsAndFonts(); - break; - default: - // remove compiler warnings - break; - } -} - -void ForumsDialog::forumListCustomPopupMenu( QPoint /*point*/ ) -{ - QMenu contextMnu( this ); - - QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum())); - action->setDisabled (mCurrForumId.empty() || IS_FORUM_SUBSCRIBED(subscribeFlags)); - - action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum())); - action->setEnabled (!mCurrForumId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags)); - - contextMnu.addSeparator(); - - contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum())); - - action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails())); - action->setEnabled (!mCurrForumId.empty ()); - - action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails())); - action->setEnabled (!mCurrForumId.empty () && IS_FORUM_ADMIN(subscribeFlags)); - - QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu); - connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); - shareKeyAct->setEnabled(!mCurrForumId.empty() && IS_FORUM_ADMIN(subscribeFlags)); - contextMnu.addAction( shareKeyAct); - - QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu); - connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) ); - restoreKeysAct->setEnabled(!mCurrForumId.empty() && !IS_FORUM_ADMIN(subscribeFlags)); - contextMnu.addAction( restoreKeysAct); - - action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink())); - action->setEnabled(!mCurrForumId.empty()); - - contextMnu.addSeparator(); - - action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsReadAll())); - action->setEnabled (!mCurrForumId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags)); - - action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll())); - action->setEnabled (!mCurrForumId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags)); - -#ifdef DEBUG_FORUMS - contextMnu.addSeparator(); - action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData())); - action->setEnabled (!mCurrForumId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags)); -#endif - - contextMnu.exec(QCursor::pos()); -} - -void ForumsDialog::threadListCustomPopupMenu( QPoint /*point*/ ) -{ - if (fillThread) { - return; - } - - QMenu contextMnu( this ); - - QAction *replyAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply" ), &contextMnu ); - connect( replyAct , SIGNAL( triggered() ), this, SLOT( createmessage() ) ); - - QAction *newthreadAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Start New Thread" ), &contextMnu ); - newthreadAct->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags)); - connect( newthreadAct , SIGNAL( triggered() ), this, SLOT( createthread() ) ); - - QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply to Author" ), &contextMnu ); - connect( replyauthorAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) ); - - QAction* expandAll = new QAction(tr( "Expand all" ), &contextMnu ); - connect( expandAll , SIGNAL( triggered() ), ui.threadTreeWidget, SLOT (expandAll()) ); - - QAction* collapseAll = new QAction(tr( "Collapse all" ), &contextMnu ); - connect( collapseAll , SIGNAL( triggered() ), ui.threadTreeWidget, SLOT(collapseAll()) ); - - QAction *markMsgAsRead = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read"), &contextMnu); - connect(markMsgAsRead , SIGNAL(triggered()), this, SLOT(markMsgAsRead())); - - QAction *markMsgAsReadChildren = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read") + " (" + tr ("with children") + ")", &contextMnu); - connect(markMsgAsReadChildren, SIGNAL(triggered()), this, SLOT(markMsgAsReadChildren())); - - QAction *markMsgAsUnread = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread"), &contextMnu); - connect(markMsgAsUnread , SIGNAL(triggered()), this, SLOT(markMsgAsUnread())); - - QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu); - connect(markMsgAsUnreadChildren , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren())); - - if (IS_FORUM_SUBSCRIBED(subscribeFlags)) { - QList Rows; - QList RowsRead; - QList RowsUnread; - int nCount = getSelectedMsgCount (&Rows, &RowsRead, &RowsUnread); - - if (RowsUnread.size() == 0) { - - markMsgAsRead->setDisabled(true); - } - if (RowsRead.size() == 0) { - markMsgAsUnread->setDisabled(true); - } - - bool bHasUnreadChildren = false; - bool bHasReadChildren = false; - int nRowCount = Rows.count(); - for (int i = 0; i < nRowCount; i++) { - if (bHasUnreadChildren || Rows[i]->data(COLUMN_THREAD_DATA, ROLE_THREAD_UNREADCHILDREN).toBool()) { - bHasUnreadChildren = true; - } - if (bHasReadChildren || Rows[i]->data(COLUMN_THREAD_DATA, ROLE_THREAD_READCHILDREN).toBool()) { - bHasReadChildren = true; - } - } - markMsgAsReadChildren->setEnabled(bHasUnreadChildren); - markMsgAsUnreadChildren->setEnabled(bHasReadChildren); - - if (nCount == 1) { - replyAct->setEnabled (true); - replyauthorAct->setEnabled (true); - } else { - replyAct->setDisabled (true); - replyauthorAct->setDisabled (true); - } - } else { - markMsgAsRead->setDisabled(true); - markMsgAsReadChildren->setDisabled(true); - markMsgAsUnread->setDisabled(true); - markMsgAsUnreadChildren->setDisabled(true); - replyAct->setDisabled (true); - replyauthorAct->setDisabled (true); - } - - contextMnu.addAction( replyAct); - contextMnu.addAction( newthreadAct); - contextMnu.addAction( replyauthorAct); - QAction* action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr( "Copy RetroShare Link"), this, SLOT(copyMessageLink())); - action->setEnabled(!mCurrForumId.empty() && !mCurrThreadId.empty()); - contextMnu.addSeparator(); - contextMnu.addAction(markMsgAsRead); - contextMnu.addAction(markMsgAsReadChildren); - contextMnu.addAction(markMsgAsUnread); - contextMnu.addAction(markMsgAsUnreadChildren); - contextMnu.addSeparator(); - contextMnu.addAction( expandAll); - contextMnu.addAction( collapseAll); - - contextMnu.exec(QCursor::pos()); -} - -bool ForumsDialog::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == ui.threadTreeWidget) { - if (event->type() == QEvent::KeyPress) { - QKeyEvent *keyEvent = static_cast(event); - if (keyEvent && keyEvent->key() == Qt::Key_Space) { - // Space pressed - QTreeWidgetItem *item = ui.threadTreeWidget->currentItem (); - clickedThread (item, COLUMN_THREAD_READ); - return true; // eat event - } - } - } - // pass the event on to the parent class - return RsAutoUpdatePage::eventFilter(obj, event); -} - -void ForumsDialog::restoreForumKeys(void) -{ - rsForums->forumRestoreKeys(mCurrForumId); -} - -void ForumsDialog::togglethreadview() -{ - // save state of button - Settings->setValueToGroup("ForumsDialog", "expandButton", ui.expandButton->isChecked()); - - togglethreadview_internal(); -} - -void ForumsDialog::togglethreadview_internal() -{ - if (ui.expandButton->isChecked()) { - ui.postText->setVisible(true); - ui.expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - ui.expandButton->setToolTip(tr("Hide")); - } else { - ui.postText->setVisible(false); - ui.expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - ui.expandButton->setToolTip(tr("Expand")); - } -} - -void ForumsDialog::updateDisplay() -{ - std::list forumIds; - std::list::iterator it; - if (!rsForums) - return; - - if (rsForums->forumsChanged(forumIds)) - { - /* update Forums List */ - insertForums(); - - it = std::find(forumIds.begin(), forumIds.end(), mCurrForumId); - if (it != forumIds.end()) - { - /* update threads as well */ - insertThreads(); - } - } -} - -static void CleanupItems (QList &items) -{ - QList::iterator item; - for (item = items.begin (); item != items.end (); item++) { - if (*item) { - delete (*item); - } - } - items.clear(); -} - -void ForumsDialog::forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo) -{ - groupItemInfo.id = QString::fromStdString(forumInfo.forumId); - groupItemInfo.name = QString::fromStdWString(forumInfo.forumName); - groupItemInfo.description = QString::fromStdWString(forumInfo.forumDesc); - groupItemInfo.popularity = forumInfo.pop; - groupItemInfo.lastpost = QDateTime::fromTime_t(forumInfo.lastPost); - - if (forumInfo.forumFlags & RS_DISTRIB_AUTHEN_REQ) { - groupItemInfo.name += " (" + tr("AUTHD") + ")"; - groupItemInfo.icon = QIcon(IMAGE_FORUMAUTHD); - } else { - groupItemInfo.icon = QIcon(IMAGE_FORUM); - } -} - -void ForumsDialog::insertForums() -{ - std::list forumList; - std::list::iterator it; - if (!rsForums) - { - return; - } - - rsForums->getForumList(forumList); - - QList adminList; - QList subList; - QList popList; - QList otherList; - std::multimap popMap; - - for (it = forumList.begin(); it != forumList.end(); it++) { - /* sort it into Publish (Own), Subscribed, Popular and Other */ - uint32_t flags = it->subscribeFlags; - - GroupItemInfo groupItemInfo; - forumInfoToGroupItemInfo(*it, groupItemInfo); - - if (flags & RS_DISTRIB_ADMIN) { - adminList.push_back(groupItemInfo); - } else if (flags & RS_DISTRIB_SUBSCRIBED) { - /* subscribed forum */ - subList.push_back(groupItemInfo); - } else { - /* rate the others by popularity */ - popMap.insert(std::make_pair(it->pop, groupItemInfo)); - } - } - - /* iterate backwards through popMap - take the top 5 or 10% of list */ - uint32_t popCount = 5; - if (popCount < popMap.size() / 10) - { - popCount = popMap.size() / 10; - } - - uint32_t i = 0; - uint32_t popLimit = 0; - std::multimap::reverse_iterator rit; - for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ; - if (rit != popMap.rend()) { - popLimit = rit->first; - } - - for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) { - if (rit->second.popularity < (int) popLimit) { - otherList.append(rit->second); - } else { - popList.append(rit->second); - } - } - - /* now we can add them in as a tree! */ - ui.forumTreeWidget->fillGroupItems(yourForums, adminList); - ui.forumTreeWidget->fillGroupItems(subscribedForums, subList); - ui.forumTreeWidget->fillGroupItems(popularForums, popList); - ui.forumTreeWidget->fillGroupItems(otherForums, otherList); - - updateMessageSummaryList(""); -} - -void ForumsDialog::changedForum(const QString &id) -{ - mCurrForumId = id.toStdString(); - - insertThreads(); -} - -void ForumsDialog::changedThread () -{ - if (fillThread) { - return; - } - - /* just grab the ids of the current item */ - QTreeWidgetItem *curr = ui.threadTreeWidget->currentItem(); - - if ((!curr) || (!curr->isSelected())) { - mCurrThreadId = ""; - } else { - mCurrThreadId = curr->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString(); - } - insertPost(); -} - -void ForumsDialog::clickedThread (QTreeWidgetItem *item, int column) -{ - if (mCurrForumId.empty() || !IS_FORUM_SUBSCRIBED(subscribeFlags)) { - return; - } - - if (item == NULL) { - return; - } - - if (column == COLUMN_THREAD_READ) { - QList Rows; - Rows.append(item); - uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - setMsgAsReadUnread(Rows, IS_UNREAD(status)); - return; - } -} - -void ForumsDialog::forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status) -{ - if (inMsgAsReadUnread) { - return; - } - - if (forumId.toStdString() == mCurrForumId) { - /* Search exisiting item */ - QTreeWidgetItemIterator itemIterator(ui.threadTreeWidget); - QTreeWidgetItem *item = NULL; - while ((item = *itemIterator) != NULL) { - itemIterator++; - - if (item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString() == msgId) { - // update status - item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, status); - - QTreeWidgetItem *parentItem = item; - while (parentItem->parent()) { - parentItem = parentItem->parent(); - } - CalculateIconsAndFonts(parentItem); - break; - } - } - } - updateMessageSummaryList(forumId.toStdString()); -} - -void ForumsDialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren) -{ - uint32_t status = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - - bool bUnread = IS_UNREAD(status); - bool missing = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING).toBool(); - - // set icon - if (missing) { - pItem->setIcon(COLUMN_THREAD_READ, QIcon()); - pItem->setIcon(COLUMN_THREAD_TITLE, QIcon()); - } else { - if (bUnread) { - pItem->setIcon(COLUMN_THREAD_READ, QIcon(":/images/message-state-unread.png")); - } else { - pItem->setIcon(COLUMN_THREAD_READ, QIcon(":/images/message-state-read.png")); - } - if (status & FORUM_MSG_STATUS_READ) { - pItem->setIcon(COLUMN_THREAD_TITLE, QIcon()); - } else { - pItem->setIcon(COLUMN_THREAD_TITLE, QIcon(":/images/message-state-new.png")); - } - } - - int nItem; - int nItemCount = pItem->childCount(); - - bool bMyReadChilddren = false; - bool bMyUnreadChilddren = false; - - for (nItem = 0; nItem < nItemCount; nItem++) { - CalculateIconsAndFonts(pItem->child(nItem), bMyReadChilddren, bMyUnreadChilddren); - } - - // set font - for (int i = 0; i < COLUMN_THREAD_COUNT; i++) { - QFont qf = pItem->font(i); - - if (!IS_FORUM_SUBSCRIBED(subscribeFlags)) { - qf.setBold(false); - pItem->setTextColor(i, textColorNotSubscribed()); - } else if (bUnread) { - qf.setBold(true); - pItem->setTextColor(i, textColorUnread()); - } else if (bMyUnreadChilddren) { - qf.setBold(true); - pItem->setTextColor(i, textColorUnreadChildren()); - } else { - qf.setBold(false); - pItem->setTextColor(i, textColorRead()); - } - if (missing) { - /* Missing message */ - pItem->setTextColor(i, textColorMissing()); - } - pItem->setFont(i, qf); - } - - pItem->setData(COLUMN_THREAD_DATA, ROLE_THREAD_READCHILDREN, bHasReadChilddren || bMyReadChilddren); - pItem->setData(COLUMN_THREAD_DATA, ROLE_THREAD_UNREADCHILDREN, bHasUnreadChilddren || bMyUnreadChilddren); - - bHasReadChilddren = bHasReadChilddren || bMyReadChilddren || !bUnread; - bHasUnreadChilddren = bHasUnreadChilddren || bMyUnreadChilddren || bUnread; -} - -void ForumsDialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem /* = NULL*/) -{ - bool bDummy1 = false; - bool bDummy2 = false; - - if (pItem) { - CalculateIconsAndFonts(pItem, bDummy1, bDummy2); - return; - } - - int nItem; - int nItemCount = ui.threadTreeWidget->topLevelItemCount(); - - for (nItem = 0; nItem < nItemCount; nItem++) { - bDummy1 = false; - bDummy2 = false; - CalculateIconsAndFonts(ui.threadTreeWidget->topLevelItem(nItem), bDummy1, bDummy2); - } -} - -void ForumsDialog::fillThreadFinished() -{ -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::fillThreadFinished" << std::endl; -#endif - - // thread has finished - ForumsFillThread *thread = dynamic_cast(sender()); - if (thread) { - if (thread == fillThread) { - // current thread has finished, hide progressbar and release thread - ui.progressBar->hide(); - ui.progLayOutTxt->hide(); - ui.progressBarLayOut->setEnabled(false); - fillThread = NULL; - } - - if (thread->wasStopped()) { - // thread was stopped -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::fillThreadFinished Thread was stopped" << std::endl; -#endif - } else { -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::fillThreadFinished Add messages" << std::endl; -#endif - ui.threadTreeWidget->setSortingEnabled(false); - - /* add all messages in! */ - if (lastViewType != thread->viewType || lastForumID != mCurrForumId) { - ui.threadTreeWidget->clear(); - lastViewType = thread->viewType; - lastForumID = mCurrForumId; - ui.threadTreeWidget->insertTopLevelItems(0, thread->items); - - // clear list - thread->items.clear(); - } else { - FillThreads (thread->items, thread->expandNewMessages, thread->itemToExpand); - - // cleanup list - CleanupItems (thread->items); - } - - ui.threadTreeWidget->setSortingEnabled(true); - - if (thread->focusMsgId.empty() == false) { - /* Search exisiting item */ - QTreeWidgetItemIterator itemIterator(ui.threadTreeWidget); - QTreeWidgetItem *item = NULL; - while ((item = *itemIterator) != NULL) { - itemIterator++; - - if (item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString() == thread->focusMsgId) { - ui.threadTreeWidget->setCurrentItem(item); - ui.threadTreeWidget->setFocus(); - break; - } - } - } - - QList::iterator Item; - for (Item = thread->itemToExpand.begin(); Item != thread->itemToExpand.end(); Item++) { - if ((*Item)->isHidden() == false) { - (*Item)->setExpanded(true); - } - } - thread->itemToExpand.clear(); - - if (ui.filterLineEdit->text().isEmpty() == false) { - filterItems(ui.filterLineEdit->text()); - } - - insertPost (); - CalculateIconsAndFonts(); - - ui.newthreadButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags)); - } - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::fillThreadFinished Delete thread" << std::endl; -#endif - - thread->deleteLater(); - thread = NULL; - } - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::fillThreadFinished done" << std::endl; -#endif -} - -void ForumsDialog::fillThreadProgress(int current, int count) -{ - // show fill progress - if (count) { - ui.progressBar->setValue(current * ui.progressBar->maximum() / count); - } -} - -void ForumsDialog::insertThreads() -{ -#ifdef DEBUG_FORUMS - /* get the current Forum */ - std::cerr << "ForumsDialog::insertThreads()" << std::endl; -#endif - - if (fillThread) { -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::insertThreads() stop current fill thread" << std::endl; -#endif - // stop current fill thread - ForumsFillThread *thread = fillThread; - fillThread = NULL; - thread->stop(); - delete(thread); - - ui.progressBar->hide(); - ui.progLayOutTxt->hide(); - } - - subscribeFlags = 0; - - ui.newmessageButton->setEnabled (false); - ui.newthreadButton->setEnabled (false); - - ui.postText->clear(); - ui.threadTitle->clear(); - - if (mCurrForumId.empty()) - { - /* not an actual forum - clear */ - ui.threadTreeWidget->clear(); - /* when no Thread selected - clear */ - ui.forumName->clear(); - /* clear last stored forumID */ - mCurrForumId.erase(); - lastForumID.erase(); - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::insertThreads() Current Thread Invalid" << std::endl; -#endif - - return; - } - - ForumInfo fi; - if (!rsForums->getForumInfo(mCurrForumId, fi)) { - return; - } - - subscribeFlags = fi.subscribeFlags; - ui.forumName->setText(QString::fromStdWString(fi.forumName)); - - ui.progressBarLayOut->setEnabled(true); - - ui.progLayOutTxt->show(); - ui.progressBar->reset(); - ui.progressBar->show(); - - // create fill thread - fillThread = new ForumsFillThread(this); - - // set data - fillThread->compareRole = threadCompareRole; - fillThread->forumId = mCurrForumId; - fillThread->filterColumn = ui.filterLineEdit->currentFilter(); - fillThread->subscribeFlags = subscribeFlags; - fillThread->viewType = ui.viewBox->currentIndex(); - if (lastViewType != fillThread->viewType || lastForumID != mCurrForumId) { - fillThread->fillComplete = true; - } - - if (fillThread->viewType == VIEW_FLAT) { - ui.threadTreeWidget->setRootIsDecorated(false); - } else { - ui.threadTreeWidget->setRootIsDecorated(true); - } - - // connect thread - connect(fillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection); - connect(fillThread, SIGNAL(progress(int,int)), this, SLOT(fillThreadProgress(int,int))); - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::insertThreads() Start fill thread" << std::endl; -#endif - - // start thread - fillThread->start(); -} - -void ForumsDialog::FillThreads(QList &ThreadList, bool expandNewMessages, QList &itemToExpand) -{ -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::FillThreads()" << std::endl; -#endif - - int Index = 0; - QTreeWidgetItem *Thread; - QList::iterator NewThread; - - // delete not existing - while (Index < ui.threadTreeWidget->topLevelItemCount ()) { - Thread = ui.threadTreeWidget->topLevelItem (Index); - - // search existing new thread - int Found = -1; - for (NewThread = ThreadList.begin (); NewThread != ThreadList.end (); NewThread++) { - if (Thread->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID) == (*NewThread)->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID)) { - // found it - Found = Index; - break; - } - } - if (Found >= 0) { - Index++; - } else { - delete (ui.threadTreeWidget->takeTopLevelItem (Index)); - } - } - - // iterate all new threads - for (NewThread = ThreadList.begin (); NewThread != ThreadList.end (); NewThread++) { - // search existing thread - int Found = -1; - int Count = ui.threadTreeWidget->topLevelItemCount (); - for (Index = 0; Index < Count; Index++) { - Thread = ui.threadTreeWidget->topLevelItem (Index); - if (Thread->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID) == (*NewThread)->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID)) { - // found it - Found = Index; - break; - } - } - - if (Found >= 0) { - // set child data - int i; - for (i = 0; i < COLUMN_THREAD_COUNT; i++) { - Thread->setText (i, (*NewThread)->text (i)); - } - for (i = 0; i < ROLE_THREAD_COUNT; i++) { - Thread->setData (COLUMN_THREAD_DATA, Qt::UserRole + i, (*NewThread)->data (COLUMN_THREAD_DATA, Qt::UserRole + i)); - } - - // fill recursive - FillChildren (Thread, *NewThread, expandNewMessages, itemToExpand); - } else { - // add new thread - ui.threadTreeWidget->addTopLevelItem (*NewThread); - Thread = *NewThread; - *NewThread = NULL; - } - - uint32_t status = Thread->data (COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - if (expandNewMessages && IS_UNREAD(status)) { - QTreeWidgetItem *pParent = Thread; - while ((pParent = pParent->parent()) != NULL) { - if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) { - itemToExpand.push_back(pParent); - } - } - } - } - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsDialog::FillThreads() done" << std::endl; -#endif -} - -void ForumsDialog::FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool expandNewMessages, QList &itemToExpand) -{ - int Index = 0; - int NewIndex; - int NewCount = NewParent->childCount(); - - QTreeWidgetItem *Child; - QTreeWidgetItem *NewChild; - - // delete not existing - while (Index < Parent->childCount ()) { - Child = Parent->child (Index); - - // search existing new child - int Found = -1; - int Count = NewParent->childCount(); - for (NewIndex = 0; NewIndex < Count; NewIndex++) { - NewChild = NewParent->child (NewIndex); - if (NewChild->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID) == Child->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID)) { - // found it - Found = Index; - break; - } - } - if (Found >= 0) { - Index++; - } else { - delete (Parent->takeChild (Index)); - } - } - - // iterate all new children - for (NewIndex = 0; NewIndex < NewCount; NewIndex++) { - NewChild = NewParent->child (NewIndex); - - // search existing child - int Found = -1; - int Count = Parent->childCount(); - for (Index = 0; Index < Count; Index++) { - Child = Parent->child (Index); - if (Child->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID) == NewChild->data (COLUMN_THREAD_DATA, ROLE_THREAD_MSGID)) { - // found it - Found = Index; - break; - } - } - - if (Found >= 0) { - // set child data - int i; - for (i = 0; i < COLUMN_THREAD_COUNT; i++) { - Child->setText (i, NewChild->text (i)); - } - for (i = 0; i < ROLE_THREAD_COUNT; i++) { - Child->setData (COLUMN_THREAD_DATA, Qt::UserRole + i, NewChild->data (COLUMN_THREAD_DATA, Qt::UserRole + i)); - } - - // fill recursive - FillChildren (Child, NewChild, expandNewMessages, itemToExpand); - } else { - // add new child - Child = NewParent->takeChild(NewIndex); - Parent->addChild (Child); - NewIndex--; - NewCount--; - } - - uint32_t status = Child->data (COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - if (expandNewMessages && IS_UNREAD(status)) { - QTreeWidgetItem *pParent = Child; - while ((pParent = pParent->parent()) != NULL) { - if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) { - itemToExpand.push_back(pParent); - } - } - } - } -} - -QString ForumsDialog::titleFromInfo(ForumMsgInfo &msgInfo) -{ - if (msgInfo.msgflags & RS_DISTRIB_MISSING_MSG) { - return QApplication::translate("ForumsDialog", "[ ... Missing Message ... ]"); - } - - return QString::fromStdWString(msgInfo.title); -} - -QString ForumsDialog::messageFromInfo(ForumMsgInfo &msgInfo) -{ - if (msgInfo.msgflags & RS_DISTRIB_MISSING_MSG) { - return QApplication::translate("ForumsDialog", "Placeholder for missing Message"); - } - - return QString::fromStdWString(msgInfo.msg); -} - -void ForumsDialog::insertPost() -{ - if (mCurrForumId.empty()) - { - ui.postText->setText(""); - ui.threadTitle->setText(""); - ui.previousButton->setEnabled(false); - ui.nextButton->setEnabled(false); - ui.newmessageButton->setEnabled (false); - return; - } - - if (mCurrThreadId.empty()) - { - ui.previousButton->setEnabled(false); - ui.nextButton->setEnabled(false); - ui.newmessageButton->setEnabled (false); - - ForumInfo fi; - if (!rsForums->getForumInfo(mCurrForumId, fi)) { - ui.postText->setText(""); - ui.threadTitle->setText(""); - return; - } - ui.threadTitle->setText(tr("Forum Description")); - ui.postText->setText(QString::fromStdWString(fi.forumDesc)); - return; - } - - QTreeWidgetItem *curr = ui.threadTreeWidget->currentItem(); - if (curr) { - QTreeWidgetItem *Parent = curr->parent (); - int Index = Parent ? Parent->indexOfChild (curr) : ui.threadTreeWidget->indexOfTopLevelItem (curr); - int Count = Parent ? Parent->childCount () : ui.threadTreeWidget->topLevelItemCount (); - ui.previousButton->setEnabled (Index > 0); - ui.nextButton->setEnabled (Index < Count - 1); - } else { - // there is something wrong - ui.previousButton->setEnabled(false); - ui.nextButton->setEnabled(false); - return; - } - - ui.newmessageButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags) && mCurrThreadId.empty() == false); - - /* get the Post */ - ForumMsgInfo msg; - if (!rsForums->getForumMessage(mCurrForumId, mCurrThreadId, msg)) - { - ui.postText->setText(""); - return; - } - - bool bSetToReadOnActive = Settings->getForumMsgSetToReadOnActivate(); - uint32_t status = curr->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - - QList Row; - Row.append(curr); - if (status & FORUM_MSG_STATUS_READ) { - if (bSetToReadOnActive && (status & FORUM_MSG_STATUS_UNREAD_BY_USER)) { - /* set to read */ - setMsgAsReadUnread(Row, true); - } - } else { - /* set to read */ - if (bSetToReadOnActive) { - setMsgAsReadUnread(Row, true); - } else { - /* set to unread by user */ - setMsgAsReadUnread(Row, false); - } - } - - QString extraTxt = RsHtml().formatText(ui.postText->document(), messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS); - - ui.postText->setHtml(extraTxt); - ui.threadTitle->setText(titleFromInfo(msg)); -} - -void ForumsDialog::previousMessage () -{ - QTreeWidgetItem *Item = ui.threadTreeWidget->currentItem (); - if (Item == NULL) { - return; - } - - QTreeWidgetItem *Parent = Item->parent (); - int Index = Parent ? Parent->indexOfChild (Item) : ui.threadTreeWidget->indexOfTopLevelItem (Item); - if (Index > 0) { - QTreeWidgetItem *Previous = Parent ? Parent->child (Index - 1) : ui.threadTreeWidget->topLevelItem (Index - 1); - if (Previous) { - ui.threadTreeWidget->setCurrentItem (Previous); - } - } -} - -void ForumsDialog::nextMessage () -{ - QTreeWidgetItem *Item = ui.threadTreeWidget->currentItem (); - if (Item == NULL) { - return; - } - - QTreeWidgetItem *Parent = Item->parent (); - int Index = Parent ? Parent->indexOfChild (Item) : ui.threadTreeWidget->indexOfTopLevelItem (Item); - int Count = Parent ? Parent->childCount () : ui.threadTreeWidget->topLevelItemCount (); - if (Index < Count - 1) { - QTreeWidgetItem *Next = Parent ? Parent->child (Index + 1) : ui.threadTreeWidget->topLevelItem (Index + 1); - if (Next) { - ui.threadTreeWidget->setCurrentItem (Next); - } - } -} - -void ForumsDialog::downloadAllFiles() -{ - QStringList urls; - if (RsHtml::findAnchors(ui.postText->toHtml(), urls) == false) { - return; - } - - if (urls.count() == 0) { - return; - } - - RetroShareLink::process(urls, RetroShareLink::TYPE_FILE/*, true*/); -} - -void ForumsDialog::nextUnreadMessage() -{ - QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem(); - - while (TRUE) { - QTreeWidgetItemIterator itemIterator = currentItem ? QTreeWidgetItemIterator(currentItem, QTreeWidgetItemIterator::NotHidden) : QTreeWidgetItemIterator(ui.threadTreeWidget, QTreeWidgetItemIterator::NotHidden); - - QTreeWidgetItem *item; - while ((item = *itemIterator) != NULL) { - itemIterator++; - - if (item == currentItem) { - continue; - } - - uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - if (IS_UNREAD(status)) { - ui.threadTreeWidget->setCurrentItem(item); - ui.threadTreeWidget->scrollToItem(item, QAbstractItemView::EnsureVisible); - return; - } - } - - if (currentItem == NULL) { - break; - } - - /* start from top */ - currentItem = NULL; - } -} - -// TODO -#if 0 -void ForumsDialog::removemessage() -{ - //std::cerr << "ForumsDialog::removemessage()" << std::endl; - std::string cid, mid; - if (!getCurrentMsg(cid, mid)) - { - //std::cerr << "ForumsDialog::removemessage()"; - //std::cerr << " No Message selected" << std::endl; - return; - } - - rsMsgs -> MessageDelete(mid); -} -#endif - -/* get selected messages - the messages tree is single selected, but who knows ... */ -int ForumsDialog::getSelectedMsgCount(QList *pRows, QList *pRowsRead, QList *pRowsUnread) -{ - if (pRowsRead) pRowsRead->clear(); - if (pRowsUnread) pRowsUnread->clear(); - - QList selectedItems = ui.threadTreeWidget->selectedItems(); - for(QList::iterator it = selectedItems.begin(); it != selectedItems.end(); it++) { - if (pRows) pRows->append(*it); - if (pRowsRead || pRowsUnread) { - uint32_t status = (*it)->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - if (IS_UNREAD(status)) { - if (pRowsUnread) pRowsUnread->append(*it); - } else { - if (pRowsRead) pRowsRead->append(*it); - } - } - } - - return selectedItems.size(); -} - -void ForumsDialog::setMsgAsReadUnread(QList &Rows, bool bRead) -{ - QList::iterator Row; - std::list changedItems; - - inMsgAsReadUnread = true; - - for (Row = Rows.begin(); Row != Rows.end(); Row++) { - if ((*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING).toBool()) { - /* Missing message */ - continue; - } - - uint32_t status = (*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - - /* set always as read ... */ - uint32_t statusNew = status | FORUM_MSG_STATUS_READ; - if (bRead) { - /* ... and as read by user */ - statusNew &= ~FORUM_MSG_STATUS_UNREAD_BY_USER; - } else { - /* ... and as unread by user */ - statusNew |= FORUM_MSG_STATUS_UNREAD_BY_USER; - } - if (status != statusNew) { - std::string msgId = (*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString(); - rsForums->setMessageStatus(mCurrForumId, msgId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER); - - (*Row)->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, statusNew); - - QTreeWidgetItem *parentItem = *Row; - while (parentItem->parent()) { - parentItem = parentItem->parent(); - } - if (std::find(changedItems.begin(), changedItems.end(), parentItem) == changedItems.end()) { - changedItems.push_back(parentItem); - } - } - } - - inMsgAsReadUnread = false; - - if (changedItems.size()) { - for (std::list::iterator it = changedItems.begin(); it != changedItems.end(); it++) { - CalculateIconsAndFonts(*it); - } - updateMessageSummaryList(mCurrForumId); - } -} - -void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bChildren, bool bForum) -{ - if (mCurrForumId.empty() || !IS_FORUM_SUBSCRIBED(subscribeFlags)) { - return; - } - - /* get selected messages */ - QList Rows; - if (bForum) { - int itemCount = ui.threadTreeWidget->topLevelItemCount(); - for (int item = 0; item < itemCount; item++) { - Rows.push_back(ui.threadTreeWidget->topLevelItem(item)); - } - } else { - getSelectedMsgCount (&Rows, NULL, NULL); - } - - if (bChildren) { - /* add children */ - QList AllRows; - - while (Rows.isEmpty() == false) { - QTreeWidgetItem *pRow = Rows.takeFirst(); - - /* add only items with the right state or with not FORUM_MSG_STATUS_READ */ - uint32_t status = pRow->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt(); - if (IS_UNREAD(status) == bRead || (status & FORUM_MSG_STATUS_READ) == 0) { - AllRows.append(pRow); - } - - for (int i = 0; i < pRow->childCount(); i++) { - /* add child to main list and let the main loop do the work */ - Rows.append(pRow->child(i)); - } - } - - if (AllRows.isEmpty()) { - /* nothing to do */ - return; - } - - setMsgAsReadUnread (AllRows, bRead); - - return; - } - - setMsgAsReadUnread (Rows, bRead); -} - -void ForumsDialog::markMsgAsRead() -{ - markMsgAsReadUnread(true, false, false); -} - -void ForumsDialog::markMsgAsReadChildren() -{ - markMsgAsReadUnread(true, true, false); -} - -void ForumsDialog::markMsgAsReadAll() -{ - markMsgAsReadUnread(true, true, true); -} - -void ForumsDialog::markMsgAsUnread() -{ - markMsgAsReadUnread(false, false, false); -} - -void ForumsDialog::markMsgAsUnreadChildren() -{ - markMsgAsReadUnread(false, true, false); -} - -void ForumsDialog::markMsgAsUnreadAll() -{ - markMsgAsReadUnread(false, true, true); -} - -void ForumsDialog::copyForumLink() -{ - if (mCurrForumId.empty()) { - return; - } - - ForumInfo fi; - if (rsForums->getForumInfo(mCurrForumId, fi)) { - RetroShareLink link; - if (link.createForum(fi.forumId, "")) { - QList urls; - urls.push_back(link); - RSLinkClipboard::copyLinks(urls); - } - } -} - -void ForumsDialog::copyMessageLink() -{ - if (mCurrForumId.empty() || mCurrThreadId.empty()) { - return; - } - - ForumInfo fi; - if (rsForums->getForumInfo(mCurrForumId, fi)) { - RetroShareLink link; - if (link.createForum(mCurrForumId, mCurrThreadId)) { - QList urls; - urls.push_back(link); - RSLinkClipboard::copyLinks(urls); - } - } -} - -void ForumsDialog::newforum() -{ - CreateForum *cf = new CreateForum(); - cf->show(); - - /* window will destroy itself! */ -} - -void ForumsDialog::createmessage() -{ - if (mCurrForumId.empty () || !IS_FORUM_SUBSCRIBED(subscribeFlags)) { - return; - } - - CreateForumMsg *cfm = new CreateForumMsg(mCurrForumId, mCurrThreadId); - cfm->show(); - - /* window will destroy itself! */ -} - -void ForumsDialog::createthread() -{ - if (mCurrForumId.empty ()) { - QMessageBox::information(this, tr("RetroShare"), tr("No Forum Selected!")); - return; - } - - CreateForumMsg *cfm = new CreateForumMsg(mCurrForumId, ""); - cfm->show(); - - /* window will destroy itself! */ -} - -void ForumsDialog::subscribeToForum() -{ - forumSubscribe(true); -} - -void ForumsDialog::unsubscribeToForum() -{ - forumSubscribe(false); -} - -void ForumsDialog::forumSubscribe(bool subscribe) -{ - if (mCurrForumId.empty()) { - return; - } - - rsForums->forumSubscribe(mCurrForumId, subscribe); -} - -void ForumsDialog::showForumDetails() -{ - if (mCurrForumId.empty()) { - return; - } - - ForumDetails fui; - - fui.showDetails (mCurrForumId); - fui.exec (); -} - -void ForumsDialog::editForumDetails() -{ - if (mCurrForumId.empty()) { - return; - } - - EditForumDetails editUi(mCurrForumId, this); - editUi.exec(); -} - -static QString buildReplyHeader(const ForumMsgInfo &msgInfo) -{ - RetroShareLink link; - link.createMessage(msgInfo.srcId, ""); - QString from = link.toHtml(); - - QString header = QString("-----%1-----").arg(QApplication::translate("ForumsDialog", "Original Message")); - header += QString("
%1: %2
").arg(QApplication::translate("ForumsDialog", "From"), from); - - header += QString("
%1: %2
").arg(QApplication::translate("ForumsDialog", "Sent"), DateTime::formatLongDateTime(msgInfo.ts)); - header += QString("%1: %2

").arg(QApplication::translate("ForumsDialog", "Subject"), QString::fromStdWString(msgInfo.title)); - header += "
"; - - header += QApplication::translate("ForumsDialog", "On %1, %2 wrote:").arg(DateTime::formatDateTime(msgInfo.ts), from); - - return header; -} - -void ForumsDialog::replytomessage() -{ - if (mCurrForumId.empty()) { - return; - } - - std::string fId = mCurrForumId; - std::string pId = mCurrThreadId; - - ForumMsgInfo msgInfo ; - rsForums->getForumMessage(fId,pId,msgInfo) ; - - if (rsPeers->getPeerName(msgInfo.srcId) !="") - { - MessageComposer *nMsgDialog = MessageComposer::newMsg(); - - std::string hash ; - std::string mGpgId = msgInfo.srcId; - - if(rsMsgs->getDistantMessageHash(mGpgId,hash)) - { - nMsgDialog->addRecipient(MessageComposer::TO, hash, mGpgId); - - nMsgDialog->setTitleText(QString::fromStdWString(msgInfo.title), MessageComposer::REPLY); - nMsgDialog->setQuotedMsg(QString::fromStdWString(msgInfo.msg), buildReplyHeader(msgInfo)); - - //nMsgDialog->addRecipient(MessageComposer::TO, msgInfo.srcId, false); - - nMsgDialog->show(); - nMsgDialog->activateWindow(); - } - - /* window will destroy itself! */ - } - else - { - QMessageBox::information(this, tr("RetroShare"),tr("You can't reply an Anonymous Author")); - } -} - -void ForumsDialog::changedViewBox() -{ - if (m_bProcessSettings) { - return; - } - - // save index - Settings->setValueToGroup("ForumsDialog", "viewBox", ui.viewBox->currentIndex()); - - insertThreads(); -} - -void ForumsDialog::filterColumnChanged(int column) -{ - if (m_bProcessSettings) { - return; - } - - if (column == COLUMN_THREAD_CONTENT) { - // need content ... refill - insertThreads(); - } else { - filterItems(ui.filterLineEdit->text()); - } - - // save index - Settings->setValueToGroup("ForumsDialog", "filterColumn", column); -} - -void ForumsDialog::filterItems(const QString& text) -{ - int filterColumn = ui.filterLineEdit->currentFilter(); - - int nCount = ui.threadTreeWidget->topLevelItemCount (); - for (int nIndex = 0; nIndex < nCount; nIndex++) { - filterItem(ui.threadTreeWidget->topLevelItem(nIndex), text, filterColumn); - } -} - -void ForumsDialog::shareKey() -{ - ShareKey shareUi(this, mCurrForumId, FORUM_KEY_SHARE); - shareUi.exec(); -} - -bool ForumsDialog::filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn) -{ - bool bVisible = true; - - if (text.isEmpty() == false) { - if (pItem->text(filterColumn).contains(text, Qt::CaseInsensitive) == false) { - bVisible = false; - } - } - - int nVisibleChildCount = 0; - int nCount = pItem->childCount(); - for (int nIndex = 0; nIndex < nCount; nIndex++) { - if (filterItem(pItem->child(nIndex), text, filterColumn)) { - nVisibleChildCount++; - } - } - - if (bVisible || nVisibleChildCount) { - pItem->setHidden(false); - } else { - pItem->setHidden(true); - } - - return (bVisible || nVisibleChildCount); -} - -void ForumsDialog::updateMessageSummaryList(std::string forumId) -{ - QTreeWidgetItem *items[2] = { yourForums, subscribedForums }; - - for (int item = 0; item < 2; item++) { - int child; - int childCount = items[item]->childCount(); - for (child = 0; child < childCount; child++) { - QTreeWidgetItem *childItem = items[item]->child(child); - std::string childId = ui.forumTreeWidget->itemId(childItem).toStdString(); - if (childId.empty()) { - continue; - } - - if (forumId.empty() || childId == forumId) { - /* calculate unread messages */ - unsigned int newMessageCount = 0; - unsigned int unreadMessageCount = 0; - rsForums->getMessageCount(childId, newMessageCount, unreadMessageCount); - - ui.forumTreeWidget->setUnreadCount(childItem, unreadMessageCount); - - if (forumId.empty() == false) { - /* Calculate only this forum */ - break; - } - } - } - } -} - -bool ForumsDialog::navigate(const std::string& forumId, const std::string& msgId) -{ - if (forumId.empty()) { - return false; - } - - if (ui.forumTreeWidget->activateId(QString::fromStdString(forumId), msgId.empty()) == NULL) { - return false; - } - - /* Threads are filled in changedForum */ - if (mCurrForumId != forumId) { - return false; - } - - if (msgId.empty()) { - return true; - } - - if (fillThread && fillThread->isRunning()) { - fillThread->focusMsgId = msgId; - return true; - } - - /* Search exisiting item */ - QTreeWidgetItemIterator itemIterator(ui.threadTreeWidget); - QTreeWidgetItem *item = NULL; - while ((item = *itemIterator) != NULL) { - itemIterator++; - - if (item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString() == msgId) { - ui.threadTreeWidget->setCurrentItem(item); - ui.threadTreeWidget->setFocus(); - return true; - } - } - - return false; -} - -void ForumsDialog::generateMassData() -{ -#ifdef DEBUG_FORUMS - if (mCurrForumId.empty ()) { - return; - } - - if (QMessageBox::question(this, "Generate mass data", "Do you really want to generate mass data ?", QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) { - return; - } - - for (int thread = 1; thread < 1000; thread++) { - ForumMsgInfo threadInfo; - threadInfo.forumId = mCurrForumId; - threadInfo.title = QString("Test %1").arg(thread, 3, 10, QChar('0')).toStdWString(); - threadInfo.msg = QString("That is only a test").toStdWString(); - - if (rsForums->ForumMessageSend(threadInfo) == false) { - return; - } - - for (int msg = 1; msg < 3; msg++) { - ForumMsgInfo msgInfo; - msgInfo.forumId = mCurrForumId; - msgInfo.threadId = threadInfo.msgId; - msgInfo.parentId = threadInfo.msgId; - msgInfo.title = threadInfo.title; - msgInfo.msg = threadInfo.msg; - - if (rsForums->ForumMessageSend(msgInfo) == false) { - return; - } - } - } -#endif -} - -// ForumsFillThread -ForumsFillThread::ForumsFillThread(ForumsDialog *parent) - : QThread(parent) -{ - stopped = false; - compareRole = NULL; - - expandNewMessages = Settings->getForumExpandNewMessages(); - fillComplete = false; - - filterColumn = 0; - subscribeFlags = 0; - viewType = 0; -} - -ForumsFillThread::~ForumsFillThread() -{ -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::~ForumsFillThread" << std::endl; -#endif - // remove all items (when items are available, the thread was terminated) - CleanupItems (items); - itemToExpand.clear(); -} - -void ForumsFillThread::stop() -{ - disconnect(); - stopped = true; - QApplication::processEvents(); - wait(); -} - -void ForumsFillThread::run() -{ -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run()" << std::endl; -#endif - - uint32_t status; - - std::list threads; - std::list::iterator tit; - rsForums->getForumThreadList(forumId, threads); - - bool flatView = false; - bool useChildTS = false; - switch(viewType) - { - case VIEW_LAST_POST: - useChildTS = true; - break; - case VIEW_FLAT: - flatView = true; - break; - case VIEW_THREADED: - break; - } - - int count = threads.size(); - int pos = 0; - - for (tit = threads.begin(); tit != threads.end(); tit++) - { - if (stopped) { - break; - } - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() Adding TopLevel Thread: mId: " << tit->msgId << std::endl; -#endif - - ForumMsgInfo msginfo; - if (rsForums->getForumMessage(forumId, tit->msgId, msginfo) == false) { -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() Failed to Get Msg" << std::endl; -#endif - continue; - } - - /* add Msg */ - /* setup - * - */ - - QTreeWidgetItem *item = new RSTreeWidgetItem(compareRole); - - QString text; - - { - QDateTime qtime; - QString sort; - - if (useChildTS) - qtime.setTime_t(tit->childTS); - else - qtime.setTime_t(tit->ts); - - text = DateTime::formatDateTime(qtime); - sort = qtime.toString("yyyyMMdd_hhmmss"); - - if (useChildTS) - { - qtime.setTime_t(tit->ts); - text += " / "; - text += DateTime::formatDateTime(qtime); - sort += "_" + qtime.toString("yyyyMMdd_hhmmss"); - } - item->setText(COLUMN_THREAD_DATE, text); - item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort); - } - - item->setText(COLUMN_THREAD_TITLE, ForumsDialog::titleFromInfo(msginfo)); - - if (msginfo.msgflags & RS_DISTRIB_MISSING_MSG) - { - item->setText(COLUMN_THREAD_AUTHOR, tr("Unknown")); - } - else - { - text = QString::fromUtf8(rsPeers->getPeerName(msginfo.srcId).c_str()); - if (text.isEmpty()) - { - item->setText(COLUMN_THREAD_AUTHOR, tr("Anonymous")); - } - else - { - item->setText(COLUMN_THREAD_AUTHOR, text); - } - } - - if (msginfo.msgflags & RS_DISTRIB_AUTHEN_REQ) - { - item->setText(COLUMN_THREAD_SIGNED, tr("signed")); - item->setIcon(COLUMN_THREAD_SIGNED, QIcon(":/images/mail-signed.png")); - } - else - { - item->setText(COLUMN_THREAD_SIGNED, tr("none")); - item->setIcon(COLUMN_THREAD_SIGNED, QIcon(":/images/mail-signature-unknown.png")); - } - - if (filterColumn == COLUMN_THREAD_CONTENT) { - // need content for filter - QTextDocument doc; - doc.setHtml(QString::fromStdWString(msginfo.msg)); - item->setText(COLUMN_THREAD_CONTENT, doc.toPlainText().replace(QString("\n"), QString(" "))); - } - - item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(tit->msgId)); - - if (IS_FORUM_SUBSCRIBED(subscribeFlags) && !(msginfo.msgflags & RS_DISTRIB_MISSING_MSG)) { - rsForums->getMessageStatus(msginfo.forumId, msginfo.msgId, status); - } else { - // show message as read - status = FORUM_MSG_STATUS_READ; - } - item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, status); - - item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, (msginfo.msgflags & RS_DISTRIB_MISSING_MSG) ? true : false); - - std::list threadlist; - threadlist.push_back(item); - - while (threadlist.size() > 0) - { - if (stopped) { - break; - } - - /* get children */ - QTreeWidgetItem *parent = threadlist.front(); - threadlist.pop_front(); - std::string pId = parent->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString(); - - std::list msgs; - std::list::iterator mit; - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() Getting Children of : " << pId << std::endl; -#endif - - if (rsForums->getForumThreadMsgList(forumId, pId, msgs)) - { -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() #Children " << msgs.size() << std::endl; -#endif - - /* iterate through child */ - for(mit = msgs.begin(); mit != msgs.end(); mit++) - { -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() adding " << mit->msgId << std::endl; -#endif - - ForumMsgInfo msginfo; - if (rsForums->getForumMessage(forumId, mit->msgId, msginfo) == false) { -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() Failed to Get Msg" << std::endl; -#endif - continue; - } - - QTreeWidgetItem *child = NULL; - if (flatView) - { - child = new RSTreeWidgetItem(compareRole); - } - else - { - child = new RSTreeWidgetItem(compareRole, parent); - } - - { - QDateTime qtime; - QString sort; - - if (useChildTS) - qtime.setTime_t(mit->childTS); - else - qtime.setTime_t(mit->ts); - - text = DateTime::formatDateTime(qtime); - sort = qtime.toString("yyyyMMdd_hhmmss"); - - if (useChildTS) - { - qtime.setTime_t(mit->ts); - text += " / "; - text += DateTime::formatDateTime(qtime); - sort += "_" + qtime.toString("yyyyMMdd_hhmmss"); - } - child->setText(COLUMN_THREAD_DATE, text); - child->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort); - } - - child->setText(COLUMN_THREAD_TITLE, ForumsDialog::titleFromInfo(msginfo)); - - text = QString::fromUtf8(rsPeers->getPeerName(msginfo.srcId).c_str()); - if (text.isEmpty()) - { - child->setText(COLUMN_THREAD_AUTHOR, tr("Anonymous")); - } - else - { - child->setText(COLUMN_THREAD_AUTHOR, text); - } - - if (msginfo.msgflags & RS_DISTRIB_AUTHEN_REQ) - { - child->setText(COLUMN_THREAD_SIGNED, tr("signed")); - child->setIcon(COLUMN_THREAD_SIGNED,(QIcon(":/images/mail-signed.png"))); - } - else - { - child->setText(COLUMN_THREAD_SIGNED, tr("none")); - child->setIcon(COLUMN_THREAD_SIGNED,(QIcon(":/images/mail-signature-unknown.png"))); - } - - if (filterColumn == COLUMN_THREAD_CONTENT) { - // need content for filter - QTextDocument doc; - doc.setHtml(ForumsDialog::messageFromInfo(msginfo)); - child->setText(COLUMN_THREAD_CONTENT, doc.toPlainText().replace(QString("\n"), QString(" "))); - } - - child->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(mit->msgId)); - - if (IS_FORUM_SUBSCRIBED(subscribeFlags) && !(msginfo.msgflags & RS_DISTRIB_MISSING_MSG)) { - rsForums->getMessageStatus(msginfo.forumId, msginfo.msgId, status); - } else { - // show message as read - status = FORUM_MSG_STATUS_READ; - } - child->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, status); - - child->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, (msginfo.msgflags & RS_DISTRIB_MISSING_MSG) ? true : false); - - if (fillComplete && expandNewMessages && IS_UNREAD(status)) { - QTreeWidgetItem *pParent = child; - while ((pParent = pParent->parent()) != NULL) { - if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) { - itemToExpand.push_back(pParent); - } - } - } - - /* setup child */ - threadlist.push_back(child); - - if (flatView) - { - items.append(child); - } - } - } - } - - /* add to list */ - items.append(item); - - emit progress(++pos, count); - } - -#ifdef DEBUG_FORUMS - std::cerr << "ForumsFillThread::run() stopped: " << (wasStopped() ? "yes" : "no") << std::endl; -#endif -} diff --git a/retroshare-gui/src/gui/ForumsDialog.h b/retroshare-gui/src/gui/ForumsDialog.h deleted file mode 100644 index ed3c21f98..000000000 --- a/retroshare-gui/src/gui/ForumsDialog.h +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _FORUMSDIALOG_H -#define _FORUMSDIALOG_H - -#include - -#include "mainpage.h" -#include "RsAutoUpdatePage.h" -#include "ui_ForumsDialog.h" - -class ForumInfo; -class ForumsFillThread; -class ForumMsgInfo; -class RSTreeWidgetItemCompareRole; - -class ForumsDialog : public RsAutoUpdatePage -{ - Q_OBJECT - - Q_PROPERTY(QColor textColorRead READ textColorRead WRITE setTextColorRead) - Q_PROPERTY(QColor textColorUnread READ textColorUnread WRITE setTextColorUnread) - Q_PROPERTY(QColor textColorUnreadChildren READ textColorUnreadChildren WRITE setTextColorUnreadChildren) - Q_PROPERTY(QColor textColorNotSubscribed READ textColorNotSubscribed WRITE setTextColorNotSubscribed) - Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing) - -public: - ForumsDialog(QWidget *parent = 0); - ~ForumsDialog(); - - virtual UserNotify *getUserNotify(QObject *parent); - - bool navigate(const std::string& forumId, const std::string& msgId); - - /* overloaded from RsAuthUpdatePage */ - virtual void updateDisplay(); - - static QString titleFromInfo(ForumMsgInfo &msgInfo); - static QString messageFromInfo(ForumMsgInfo &msgInfo); - - QColor textColorRead() const { return mTextColorRead; } - QColor textColorUnread() const { return mTextColorUnread; } - QColor textColorUnreadChildren() const { return mTextColorUnreadChildren; } - QColor textColorNotSubscribed() const { return mTextColorNotSubscribed; } - QColor textColorMissing() const { return mTextColorMissing; } - - void setTextColorRead(QColor color) { mTextColorRead = color; } - void setTextColorUnread(QColor color) { mTextColorUnread = color; } - void setTextColorUnreadChildren(QColor color) { mTextColorUnreadChildren = color; } - void setTextColorNotSubscribed(QColor color) { mTextColorNotSubscribed = color; } - void setTextColorMissing(QColor color) { mTextColorMissing = color; } - -protected: - bool eventFilter(QObject *obj, QEvent *ev); - void changeEvent(QEvent *e); - -private slots: - /** Create the context popup menu and it's submenus */ - void forumListCustomPopupMenu( QPoint point ); - void threadListCustomPopupMenu( QPoint point ); - void restoreForumKeys(); - void newforum(); - - void changedForum(const QString &id); - void changedThread(); - void clickedThread (QTreeWidgetItem *item, int column); - void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status); - - void replytomessage(); - //void print(); - //void printpreview(); - - //void removemessage(); - void markMsgAsRead(); - void markMsgAsReadChildren(); - void markMsgAsReadAll(); - void markMsgAsUnread(); - void markMsgAsUnreadAll(); - void markMsgAsUnreadChildren(); - void copyForumLink(); - void copyMessageLink(); - - /* handle splitter */ - void togglethreadview(); - - void createthread(); - void createmessage(); - - void subscribeToForum(); - void unsubscribeToForum(); - - void showForumDetails(); - void editForumDetails(); - - void previousMessage (); - void nextMessage (); - void nextUnreadMessage(); - void downloadAllFiles(); - - void changedViewBox(); - - void filterColumnChanged(int column); - void filterItems(const QString &text); - - void generateMassData(); - - void fillThreadFinished(); - void fillThreadProgress(int current, int count); - - void shareKey(); - -private: - void insertForums(); - void insertThreads(); - void insertPost(); - void updateMessageSummaryList(std::string forumId); - void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo); - - void forumSubscribe(bool subscribe); - void FillThreads(QList &ThreadList, bool bExpandNewMessages, QList &itemToExpand); - void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool bExpandNewMessages, QList &itemToExpand); - - int getSelectedMsgCount(QList *pRows, QList *pRowsRead, QList *pRowsUnread); - void setMsgAsReadUnread(QList &Rows, bool bRead); - void markMsgAsReadUnread(bool bRead, bool bChildren, bool bForum); - void CalculateIconsAndFonts(QTreeWidgetItem *pItem = NULL); - void CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren); - - void processSettings(bool bLoad); - void togglethreadview_internal(); - - bool filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn); - - bool m_bProcessSettings; - bool inMsgAsReadUnread; - - QTreeWidgetItem *yourForums; - QTreeWidgetItem *subscribedForums; - QTreeWidgetItem *popularForums; - QTreeWidgetItem *otherForums; - - RSTreeWidgetItemCompareRole *threadCompareRole; - std::string mCurrForumId; - std::string mCurrThreadId; - int subscribeFlags; - - int lastViewType; - std::string lastForumID; - - ForumsFillThread *fillThread; - - /* Color definitions (for standard see qss.default) */ - QColor mTextColorRead; - QColor mTextColorUnread; - QColor mTextColorUnreadChildren; - QColor mTextColorNotSubscribed; - QColor mTextColorMissing; - - /** Qt Designer generated object */ - Ui::ForumsDialog ui; -}; - -class ForumsFillThread : public QThread -{ - Q_OBJECT - -public: - ForumsFillThread(ForumsDialog *parent); - ~ForumsFillThread(); - - void run(); - void stop(); - bool wasStopped() { return stopped; } - -signals: - void progress(int current, int count); - -public: - std::string forumId; - int filterColumn; - int subscribeFlags; - bool fillComplete; - int viewType; - bool expandNewMessages; - std::string focusMsgId; - RSTreeWidgetItemCompareRole *compareRole; - - QList items; - QList itemToExpand; - -private: - volatile bool stopped; -}; - -#endif diff --git a/retroshare-gui/src/gui/ForumsDialog.ui b/retroshare-gui/src/gui/ForumsDialog.ui deleted file mode 100644 index 672738739..000000000 --- a/retroshare-gui/src/gui/ForumsDialog.ui +++ /dev/null @@ -1,591 +0,0 @@ - - - ForumsDialog - - - - 0 - 0 - 769 - 519 - - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - - 24 - 24 - - - - - - - :/images/konversation.png - - - true - - - - - - - - 10 - 75 - true - - - - Forums - - - - - - - Qt::Horizontal - - - - 123 - 13 - - - - - - - - Qt::NoFocus - - - - :/images/64px_help.png:/images/64px_help.png - - - true - - - true - - - - - - - - - - Qt::Horizontal - - - - - 0 - 0 - - - - - - Qt::Vertical - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Forum: - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - Last Post - - - - - Threaded View - - - - - Flat View - - - - - - - - - - - 9 - - - - Qt::CustomContextMenu - - - true - - - true - - - - Title - - - - - - - - - :/images/message-state-header.png:/images/message-state-header.png - - - - - Date - - - - - Author - - - - - Signed - - - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Thread: - - - - - - - - 10 - 75 - true - - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - false - - - - 0 - 0 - - - - - 24 - 24 - - - - - 24 - 24 - - - - Qt::NoFocus - - - Previous Thread - - - - - - - :/images/back.png:/images/back.png - - - - - - - false - - - - 0 - 0 - - - - - 24 - 24 - - - - - 24 - 24 - - - - Qt::NoFocus - - - Next Thread - - - - - - - :/images/forward.png:/images/forward.png - - - - - - - - 24 - 24 - - - - Qt::NoFocus - - - - - - - :/images/edit_remove24.png:/images/edit_remove24.png - - - true - - - true - - - - - - - - 24 - 24 - - - - Qt::NoFocus - - - Download all files - - - - :/images/down.png:/images/down.png - - - - - - - - 0 - 0 - - - - Next unread - - - - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - Qt::NoFocus - - - Start new Thread for Selected Forum - - - - :/images/mail_new.png:/images/mail_new.png - - - - 32 - 16 - - - - true - - - - - - - Qt::NoFocus - - - Reply Message - - - - :/images/mail_reply.png:/images/mail_reply.png - - - - 32 - 16 - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - - - - - 75 - true - - - - Loading - - - - - - - - 16777215 - 25 - - - - 1000 - - - 0 - - - - - - - - - - - 0 - 10 - - - - - 9 - - - - - - - - - - Print - - - - - PrintPreview - - - splitter - titleBarFrame - - - - GroupTreeWidget - QWidget -
gui/common/GroupTreeWidget.h
- 1 -
- - LineEditClear - QLineEdit -
gui/common/LineEditClear.h
-
- - LinkTextBrowser - QTextBrowser -
gui/common/LinkTextBrowser.h
-
-
- - - - -
diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 0fb92cee3..4d4cc1da4 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -48,12 +48,12 @@ #include "NewsFeed.h" #include "ShareManager.h" #include "NetworkView.h" -#include "ForumsDialog.h" +//#include "ForumsDialog.h" #include "FriendsDialog.h" #include "ChatLobbyWidget.h" #include "HelpDialog.h" #include "AboutDialog.h" -#include "ChannelFeed.h" +//#include "ChannelFeed.h" #include "bwgraph/bwgraph.h" #include "help/browser/helpbrowser.h" #include "chat/ChatDialog.h" @@ -87,8 +87,6 @@ #include #include #include -#include -#include #include #include "gui/connect/ConnectFriendWizard.h" @@ -267,17 +265,21 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); notify.push_back(QPair(messagesDialog, action)); +#if 0 ui->stackPages->add(channelFeed = new ChannelFeed(ui->stackPages), action = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); notify.push_back(QPair(channelFeed, action)); +#endif #ifdef BLOGS ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp)); #endif - + +#if 0 ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); notify.push_back(QPair(forumsDialog, action)); +#endif std::cerr << "Looking for interfaces in existing plugins:" << std::endl; for(int i = 0;inbPlugins();++i) @@ -815,12 +817,14 @@ void SetForegroundWindowInternal(HWND hWnd) case Messages: _instance->ui->stackPages->setCurrentPage( _instance->messagesDialog ); break; +#if 0 case Channels: _instance->ui->stackPages->setCurrentPage( _instance->channelFeed ); return true ; case Forums: _instance->ui->stackPages->setCurrentPage( _instance->forumsDialog ); return true ; +#endif #ifdef BLOGS case Blogs: Page = _instance->blogsFeed; @@ -865,12 +869,14 @@ void SetForegroundWindowInternal(HWND hWnd) return Links; } #endif +#if 0 if (page == _instance->channelFeed) { return Channels; } if (page == _instance->forumsDialog) { return Forums; } +#endif #ifdef BLOGS if (page == _instance->blogsFeed) { return Blogs; @@ -907,10 +913,12 @@ void SetForegroundWindowInternal(HWND hWnd) case Links: return _instance->linksDialog; #endif +#if 0 case Channels: return _instance->channelFeed; case Forums: return _instance->forumsDialog; +#endif #ifdef BLOGS case Blogs: return _instance->blogsFeed; diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index ed822d78e..589f6ceae 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -41,7 +41,7 @@ class RatesStatus; class DiscStatus; class DHTStatus; class HashingStatus; -class ForumsDialog; +//class ForumsDialog; class FriendsDialog; class ChatLobbyWidget; class ChatDialog; @@ -52,7 +52,7 @@ class MessagesDialog; class SharedFilesDialog; class MessengerWindow; class PluginsPage; -class ChannelFeed; +//class ChannelFeed; class BandwidthGraph; class MainPage; class NewsFeed; @@ -84,8 +84,8 @@ public: Transfers = 3, /** Transfers page. */ SharedDirectories = 4, /** Shared Directories page. */ Messages = 5, /** Messages page. */ - Channels = 6, /** Channels page. */ - Forums = 7, /** Forums page. */ + // Channels = 6, /** Channels page. */ + // Forums = 7, /** Forums page. */ Search = 8, /** Search page. */ #ifdef BLOGS Blogs = 9, /** Blogs page. */ @@ -129,8 +129,8 @@ public: ChatLobbyWidget *chatLobbyDialog; MessagesDialog *messagesDialog; SharedFilesDialog *sharedfilesDialog; - ForumsDialog *forumsDialog; - ChannelFeed *channelFeed; +// ForumsDialog *forumsDialog; +// ChannelFeed *channelFeed; Idle *idle; #ifdef RS_USE_LINKS diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index aa352a83d..066b2b3b8 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -25,15 +25,17 @@ #include #include -#include -#include +//#include +//#include #include #include +#if 0 #include "feeds/ChanNewItem.h" #include "feeds/ChanMsgItem.h" #include "feeds/ForumNewItem.h" #include "feeds/ForumMsgItem.h" +#endif #include "settings/rsettingswin.h" #ifdef BLOGS @@ -53,12 +55,16 @@ #include "common/FeedNotify.h" const uint32_t NEWSFEED_PEERLIST = 0x0001; + +#if 0 const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002; const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003; const uint32_t NEWSFEED_CHANNEWLIST = 0x0004; const uint32_t NEWSFEED_CHANMSGLIST = 0x0005; const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006; const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007; +#endif + const uint32_t NEWSFEED_MESSAGELIST = 0x0008; const uint32_t NEWSFEED_CHATMSGLIST = 0x0009; const uint32_t NEWSFEED_SECLIST = 0x000a; @@ -164,6 +170,7 @@ void NewsFeed::updateDisplay() addFeedItemSecurityUnknownOut(fi); break; +#if 0 case RS_FEED_ITEM_CHAN_NEW: if (flags & RS_FEED_TYPE_CHAN) addFeedItemChanNew(fi); @@ -198,6 +205,7 @@ void NewsFeed::updateDisplay() if (flags & RS_FEED_TYPE_BLOG) addFeedItemBlogMsg(fi); break; +#endif case RS_FEED_ITEM_CHAT_NEW: if (flags & RS_FEED_TYPE_CHAT) @@ -270,6 +278,7 @@ void NewsFeed::testFeeds(uint notifyFlags) instance->addFeedItemSecurityUnknownOut(fi); break; +#if 0 case RS_FEED_TYPE_CHAN: { std::list channelList; @@ -385,6 +394,7 @@ void NewsFeed::testFeeds(uint notifyFlags) // instance->addFeedItemBlogNew(fi); // instance->addFeedItemBlogMsg(fi); break; +#endif case RS_FEED_TYPE_CHAT: fi.mId1 = rsPeers->getOwnId(); @@ -618,8 +628,10 @@ void NewsFeed::addFeedItemSecurityUnknownOut(RsFeedItem &fi) #endif } +#if 0 void NewsFeed::addFeedItemChanNew(RsFeedItem &fi) { + /* make new widget */ ChanNewItem *cni = new ChanNewItem(this, NEWSFEED_CHANNEWLIST, fi.mId1, false, true); @@ -756,6 +768,8 @@ void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi) #endif } +#endif + void NewsFeed::addFeedItemChatNew(RsFeedItem &fi, bool addWithoutCheck) { #ifdef NEWS_DEBUG diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 698b040ec..e0dcc0378 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -80,6 +80,7 @@ private: void addFeedItemSecurityUnknownIn(RsFeedItem &fi); void addFeedItemSecurityUnknownOut(RsFeedItem &fi); +#if 0 void addFeedItemChanNew(RsFeedItem &fi); void addFeedItemChanUpdate(RsFeedItem &fi); void addFeedItemChanMsg(RsFeedItem &fi); @@ -88,6 +89,8 @@ private: void addFeedItemForumMsg(RsFeedItem &fi); void addFeedItemBlogNew(RsFeedItem &fi); void addFeedItemBlogMsg(RsFeedItem &fi); +#endif + void addFeedItemChatNew(RsFeedItem &fi, bool addWithoutCheck); void addFeedItemMessage(RsFeedItem &fi); void addFeedItemFilesNew(RsFeedItem &fi); diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 308eea491..e5d6630c2 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -30,8 +30,8 @@ #include "RetroShareLink.h" #include "MainWindow.h" -#include "ForumsDialog.h" -#include "ChannelFeed.h" +//#include "ForumsDialog.h" +//#include "ChannelFeed.h" #include "SearchDialog.h" #include "msgs/MessageComposer.h" #include "util/misc.h" @@ -44,8 +44,8 @@ #include #include #include -#include -#include +//#include +//#include //#define DEBUG_RSLINK 1 @@ -470,6 +470,7 @@ bool RetroShareLink::createForum(const std::string& id, const std::string& msgId { clear(); +#if 0 if (!id.empty()) { _hash = QString::fromStdString(id); _msgId = QString::fromStdString(msgId); @@ -488,6 +489,7 @@ bool RetroShareLink::createForum(const std::string& id, const std::string& msgId } } } +#endif check(); @@ -498,6 +500,7 @@ bool RetroShareLink::createChannel(const std::string& id, const std::string& msg { clear(); +#if 0 if (!id.empty()) { _hash = QString::fromStdString(id); _msgId = QString::fromStdString(msgId); @@ -516,6 +519,7 @@ bool RetroShareLink::createChannel(const std::string& id, const std::string& msg } } } +#endif check(); @@ -1365,6 +1369,7 @@ static void processList(const QStringList &list, const QString &textSingular, co break; } +#if 0 case TYPE_FORUM: { #ifdef DEBUG_RSLINK @@ -1456,6 +1461,7 @@ static void processList(const QStringList &list, const QString &textSingular, co } break; } +#endif case TYPE_SEARCH: { diff --git a/retroshare-gui/src/gui/channels/ChannelDetails.cpp b/retroshare-gui/src/gui/channels/ChannelDetails.cpp deleted file mode 100644 index e45622c5d..000000000 --- a/retroshare-gui/src/gui/channels/ChannelDetails.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2009 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ -#include "ChannelDetails.h" -#include "util/DateTime.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -/** Default constructor */ -ChannelDetails::ChannelDetails(QWidget *parent) - : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - - ui.nameline ->setReadOnly(true); - ui.popline ->setReadOnly(true); - ui.postline ->setReadOnly(true); - ui.IDline ->setReadOnly(true); - ui.DescriptiontextEdit ->setReadOnly(true); - - ui.typeEncrypted->setEnabled(false); - ui.typePrivate->setEnabled(false); -} - - -/** - Overloads the default show() slot so we can set opacity*/ - -void -ChannelDetails::show() -{ - //loadSettings(); - if(!this->isVisible()) { - QDialog::show(); - - } -} - -void ChannelDetails::showDetails(std::string mChannelId) -{ - cId = mChannelId; - loadChannel(); -} - -void ChannelDetails::loadChannel() -{ - if (!rsChannels) - { - return; - } - uint32_t flags = 0; - - ChannelInfo ci; - rsChannels->getChannelInfo(cId, ci); - flags = ci.channelFlags; - - // Set Channel Name - ui.nameline->setText(QString::fromStdWString(ci.channelName)); - - // Set Channel Popularity - { - ui.popline -> setText(QString::number(ci.pop)); - } - - // Set Last Channel Post Date - if (ci.lastPost) { - ui.postline->setText(DateTime::formatLongDateTime(ci.lastPost)); - } - - // Set Channel ID - ui.IDline->setText(QString::fromStdString(ci.channelId)); - - // Set Channel Description - ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc)); - - if (flags |= RS_DISTRIB_PRIVATE) - { - ui.typeEncrypted->setChecked(false); - ui.typePrivate->setChecked(true); - } - else if (flags |= RS_DISTRIB_ENCRYPTED) - { - ui.typeEncrypted->setChecked(true); - ui.typePrivate->setChecked(false); - } -} diff --git a/retroshare-gui/src/gui/channels/ChannelDetails.h b/retroshare-gui/src/gui/channels/ChannelDetails.h deleted file mode 100644 index 4fd31dcac..000000000 --- a/retroshare-gui/src/gui/channels/ChannelDetails.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2009 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CHANNELDETAILS_H -#define _CHANNELDETAILS_H - -#include - -#include "ui_ChannelDetails.h" - -class ChannelDetails : public QDialog -{ - Q_OBJECT - - public: - - /** Default constructor */ - ChannelDetails(QWidget *parent = 0); - - void showDetails(std::string mChannelId); - -signals: - void configChanged() ; - -public slots: - /** Overloaded QWidget.show */ - void show(); - -private: - void loadChannel(); - - std::string cId; - /** Qt Designer generated object */ - Ui::ChannelDetails ui; - -}; - -#endif - diff --git a/retroshare-gui/src/gui/channels/ChannelDetails.ui b/retroshare-gui/src/gui/channels/ChannelDetails.ui deleted file mode 100644 index f7c15c02e..000000000 --- a/retroshare-gui/src/gui/channels/ChannelDetails.ui +++ /dev/null @@ -1,148 +0,0 @@ - - - ChannelDetails - - - - 0 - 0 - 455 - 408 - - - - Channel Details - - - - :/images/rstray3.png:/images/rstray3.png - - - - - - 0 - - - - - :/images/info16.png:/images/info16.png - - - Channel Details - - - - - - Channel Info - - - - - - Channel Name - - - - - - - - - - Popularity - - - - - - - true - - - - - - - Last Post - - - - - - - true - - - - - - - Channel ID - - - - - - - - - - Channel Description - - - - - - - - - Type - - - - - - Restricted - Anyone can read, limited publishing (Private Publish Key) - - - - - - - Private - (Private Publish Key required to view Messages) - - - - - - - - - - - - - - - - - - - - - - QDialogButtonBox::Close - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/channels/ChannelUserNotify.cpp b/retroshare-gui/src/gui/channels/ChannelUserNotify.cpp deleted file mode 100644 index ac88fca68..000000000 --- a/retroshare-gui/src/gui/channels/ChannelUserNotify.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2012 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "ChannelUserNotify.h" -#include "gui/settings/rsharesettings.h" -#include "gui/notifyqt.h" -#include "gui/MainWindow.h" - -#include - -ChannelUserNotify::ChannelUserNotify(QObject *parent) : - UserNotify(parent) -{ - connect(NotifyQt::getInstance(), SIGNAL(channelsChanged(int)), this, SLOT(updateIcon()), Qt::QueuedConnection); -} - -bool ChannelUserNotify::hasSetting(QString &name) -{ - name = tr("Channel Post"); - - return true; -} - -bool ChannelUserNotify::notifyEnabled() -{ - return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS); -} - -bool ChannelUserNotify::notifyCombined() -{ - return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS_COMBINED); -} - -bool ChannelUserNotify::notifyBlink() -{ - return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_CHANNELS); -} - -void ChannelUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink) -{ - uint notifyFlags = Settings->getTrayNotifyFlags(); - uint blinkFlags = Settings->getTrayNotifyBlinkFlags(); - - if (enabled) { - notifyFlags |= TRAYNOTIFY_CHANNELS; - } else { - notifyFlags &= ~TRAYNOTIFY_CHANNELS; - } - - if (combined) { - notifyFlags |= TRAYNOTIFY_CHANNELS_COMBINED; - } else { - notifyFlags &= ~TRAYNOTIFY_CHANNELS_COMBINED; - } - - if (blink) { - blinkFlags |= TRAYNOTIFY_BLINK_CHANNELS; - } else { - blinkFlags &= ~TRAYNOTIFY_BLINK_CHANNELS; - } - - Settings->setTrayNotifyFlags(notifyFlags); - Settings->setTrayNotifyBlinkFlags(blinkFlags); -} - -QIcon ChannelUserNotify::getIcon() -{ - return QIcon(":/images/channels16.png"); -} - -QIcon ChannelUserNotify::getMainIcon(bool hasNew) -{ - return hasNew ? QIcon(":/images/channels_new.png") : QIcon(":/images/channels.png"); -} - -unsigned int ChannelUserNotify::getNewCount() -{ - unsigned int newMessageCount = 0; - unsigned int unreadMessageCount = 0; - rsChannels->getMessageCount("", newMessageCount, unreadMessageCount); - - return newMessageCount; -} - -void ChannelUserNotify::iconClicked() -{ - MainWindow::showWindow(MainWindow::Channels); -} diff --git a/retroshare-gui/src/gui/channels/ChannelUserNotify.h b/retroshare-gui/src/gui/channels/ChannelUserNotify.h deleted file mode 100644 index ef1608001..000000000 --- a/retroshare-gui/src/gui/channels/ChannelUserNotify.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2012 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef CHANNELUSERNOTIFY_H -#define CHANNELUSERNOTIFY_H - -#include "gui/common/UserNotify.h" - -class ChannelUserNotify : public UserNotify -{ - Q_OBJECT - -public: - ChannelUserNotify(QObject *parent = 0); - - virtual bool hasSetting(QString &name); - virtual bool notifyEnabled(); - virtual bool notifyCombined(); - virtual bool notifyBlink(); - virtual void setNotifyEnabled(bool enabled, bool combined, bool blink); - -private: - virtual QIcon getIcon(); - virtual QIcon getMainIcon(bool hasNew); - virtual unsigned int getNewCount(); - virtual void iconClicked(); -}; - -#endif // CHANNELUSERNOTIFY_H diff --git a/retroshare-gui/src/gui/channels/CreateChannel.cpp b/retroshare-gui/src/gui/channels/CreateChannel.cpp deleted file mode 100644 index 4342204b0..000000000 --- a/retroshare-gui/src/gui/channels/CreateChannel.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include - -#include - -#include "CreateChannel.h" -#include "gui/common/PeerDefs.h" -#include "util/misc.h" - -#include -#include - -/** Constructor */ -CreateChannel::CreateChannel() -: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - setAttribute(Qt::WA_DeleteOnClose, true); - - ui.headerFrame->setHeaderImage(QPixmap(":/images/add_channel64.png")); - ui.headerFrame->setHeaderText(tr("New Channel")); - - picture = NULL; - - // connect up the buttons. - connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createChannel())); - connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - - connect( ui.logoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo())); - connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) )); - - if (!ui.pubKeyShare_cb->isChecked()) { - ui.contactsdockWidget->hide(); - this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height()); - } - - /* initialize key share list */ - ui.keyShareList->setHeaderText(tr("Contacts:")); - ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK); - ui.keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL); - ui.keyShareList->start(); - - newChannel(); -} - -void CreateChannel::setShareList(){ - - if (ui.pubKeyShare_cb->isChecked()){ - this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height()); - ui.contactsdockWidget->show(); - } else { - ui.contactsdockWidget->hide(); - this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height()); - } -} - -void CreateChannel::newChannel() -{ - /* enforce Private for the moment */ - ui.typePrivate->setChecked(true); - - ui.typeEncrypted->setEnabled(true); - - ui.msgAnon->setChecked(true); - ui.msgAuth->setEnabled(false); - ui.msgGroupBox->hide(); - - ui.channelName->setFocus(); -} - -void CreateChannel::createChannel() -{ - QString name = misc::removeNewLine(ui.channelName->text()); - QString desc = ui.channelDesc->toPlainText(); - uint32_t flags = 0; - - if (name.isEmpty()) { - /* error message */ - QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok); - return; //Don't add a empty name!! - } - - if (ui.typePrivate->isChecked()) { - flags |= RS_DISTRIB_PRIVATE; - } else if (ui.typeEncrypted->isChecked()) { - flags |= RS_DISTRIB_ENCRYPTED; - } - - if (ui.msgAuth->isChecked()) { - flags |= RS_DISTRIB_AUTHEN_REQ; - } else if (ui.msgAnon->isChecked()) { - flags |= RS_DISTRIB_AUTHEN_ANON; - } - QByteArray ba; - QBuffer buffer(&ba); - - if (!picture.isNull()) { - // send chan image - - buffer.open(QIODevice::WriteOnly); - picture.save(&buffer, "PNG"); // writes image into ba in PNG format - } - - if (rsChannels) { - std::string chId = rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags, (unsigned char*)ba.data(), ba.size()); - - if (ui.pubKeyShare_cb->isChecked()) { - std::list shareList; - ui.keyShareList->selectedSslIds(shareList, false); - rsChannels->channelShareKeys(chId, shareList); - } - } - - close(); -} - -void CreateChannel::addChannelLogo() // the same function as in EditChanDetails -{ - QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load channel logo"), 64, 64); - - if (img.isNull()) - return; - - picture = img; - - // to show the selected - ui.logoLabel->setPixmap(picture); -} diff --git a/retroshare-gui/src/gui/channels/CreateChannel.h b/retroshare-gui/src/gui/channels/CreateChannel.h deleted file mode 100644 index f82e3536c..000000000 --- a/retroshare-gui/src/gui/channels/CreateChannel.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CREATE_CHANNEL_DIALOG_H -#define _CREATE_CHANNEL_DIALOG_H - -#include "ui_CreateChannel.h" - -class CreateChannel : public QDialog -{ - Q_OBJECT - -public: - CreateChannel(); - - void newChannel(); /* cleanup */ - -private slots: - /* actions to take.... */ - void createChannel(); - - void addChannelLogo(); - void setShareList(); - -private: - QPixmap picture; - - /** Qt Designer generated object */ - Ui::CreateChannel ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/channels/CreateChannel.ui b/retroshare-gui/src/gui/channels/CreateChannel.ui deleted file mode 100644 index d93df8009..000000000 --- a/retroshare-gui/src/gui/channels/CreateChannel.ui +++ /dev/null @@ -1,371 +0,0 @@ - - - CreateChannel - - - - 0 - 0 - 703 - 611 - - - - Create a new Channel - - - - :/images/rstray3.png:/images/rstray3.png - - - - 0 - - - 0 - - - - - - - - - - - - - Name - - - - - - - - - - - - true - - - - 0 - 0 - - - - - 300 - 524287 - - - - - 220 - 0 - - - - - 0 - 0 - - - - check peers you would like to share private publish key with - - - false - - - QDockWidget::NoDockWidgetFeatures - - - Share Key With - - - - - 0 - - - 0 - - - - - - 0 - 4 - - - - - 20 - 0 - - - - - 300 - 16777215 - - - - - 220 - 0 - - - - - 200 - 0 - - - - - - - - - - - - - - Description - - - - - - - - - - - - Type: - - - - 0 - - - 6 - - - - - Restricted - Anyone can read, limited publishing (Private Publish Key) - - - - - - - Private - (Private Publish Key required to view Messages) - - - - - - - - - - Allowed Messages - - - - 0 - - - 6 - - - - - Anonymous Messages - - - - - - - Authenticated Messages - - - - - - - - - - Key Sharing - - - - 0 - - - 6 - - - - - Key recipients can publish to restricted-type channels, and can view and publish for private-type channels - - - Share Private Publish Key - - - - - - - - - - Channel Logo - - - - 6 - - - 6 - - - 6 - - - 2 - - - 6 - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - :/images/channels.png - - - true - - - - - - - Add Channel Logo - - - - :/images/add_image24.png:/images/add_image24.png - - - - - - - Qt::Horizontal - - - - 118 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - - - HeaderFrame - QFrame -
gui/common/HeaderFrame.h
- 1 -
- - FriendSelectionWidget - QWidget -
gui/common/FriendSelectionWidget.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp b/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp deleted file mode 100644 index a1caaecbc..000000000 --- a/retroshare-gui/src/gui/channels/CreateChannelMsg.cpp +++ /dev/null @@ -1,648 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include "CreateChannelMsg.h" -#include "gui/feeds/SubFileItem.h" -#include "util/misc.h" - -#include -#include - -#include - -/** Constructor */ -CreateChannelMsg::CreateChannelMsg(std::string cId) -: QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - headerFrame->setHeaderImage(QPixmap(":/images/channels.png")); - headerFrame->setHeaderText(tr("New Channel Post")); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg())); - - connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); - connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); - connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail())); - connect(thumbNailCb, SIGNAL(toggled(bool)), this, SLOT(allowAutoMediaThumbNail(bool))); - connect(tabWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); - - thumbNailCb->setVisible(false); - thumbNailCb->setEnabled(false); -#ifdef CHANNELS_FRAME_CATCHER - fCatcher = new framecatcher(); - thumbNailCb->setVisible(true); - thumbNailCb->setEnabled(true); -#endif - //buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - - setAcceptDrops(true); - - newChannelMsg(); -} - -void CreateChannelMsg::contextMenu(QPoint /*point*/) -{ - QList links ; - RSLinkClipboard::pasteLinks(links) ; - - int n_file = 0 ; - - for(QList::const_iterator it(links.begin());it!=links.end();++it) - if((*it).type() == RetroShareLink::TYPE_FILE) - n_file++ ; - - QMenu contextMnu(this) ; - - QAction *action ; - - if(n_file > 1) - action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Links"), this, SLOT(pasteLink())); - else - action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); - - action->setDisabled(n_file < 1) ; - contextMnu.exec(QCursor::pos()); -} - -void CreateChannelMsg::pasteLink() -{ - std::cerr << "Pasting links: " << std::endl; - - QList links,not_have ; - RSLinkClipboard::pasteLinks(links) ; - - for(QList::const_iterator it(links.begin());it!=links.end();++it) - if((*it).type() == RetroShareLink::TYPE_FILE) - { - // 0 - check that we actually have the file! - // - - std::cerr << "Pasting " << (*it).toString().toStdString() << std::endl; - - FileInfo info ; - if(rsFiles->alreadyHaveFile( (*it).hash().toStdString(),info ) ) - addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), true, "") ; - else - not_have.push_back( *it ) ; - } - - if(!not_have.empty()) - { - QString msg = tr("You are about to add files you're not actually sharing. Do you still want this to happen?")+"

" ; - - for(QList::const_iterator it(not_have.begin());it!=not_have.end();++it) - msg += (*it).toString() + "
" ; - - if(QMessageBox::YesToAll == QMessageBox::question(NULL,tr("About to post un-owned files to a channel."),msg,QMessageBox::YesToAll | QMessageBox::No)) - for(QList::const_iterator it(not_have.begin());it!=not_have.end();++it) - addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), false, "") ; - } -} - -CreateChannelMsg::~CreateChannelMsg(){ - -#ifdef CHANNELS_FRAME_CATCHER - delete fCatcher; -#endif - -} - -/* Dropping */ - -void CreateChannelMsg::dragEnterEvent(QDragEnterEvent *event) -{ - /* print out mimeType */ - std::cerr << "CreateChannelMsg::dragEnterEvent() Formats"; - std::cerr << std::endl; - QStringList formats = event->mimeData()->formats(); - QStringList::iterator it; - for(it = formats.begin(); it != formats.end(); it++) - { - std::cerr << "Format: " << (*it).toStdString(); - std::cerr << std::endl; - } - - if (event->mimeData()->hasFormat("text/plain")) - { - std::cerr << "CreateChannelMsg::dragEnterEvent() Accepting PlainText"; - std::cerr << std::endl; - event->acceptProposedAction(); - } - else if (event->mimeData()->hasUrls()) - { - std::cerr << "CreateChannelMsg::dragEnterEvent() Accepting Urls"; - std::cerr << std::endl; - event->acceptProposedAction(); - } - else if (event->mimeData()->hasFormat("application/x-rsfilelist")) - { - std::cerr << "CreateChannelMsg::dragEnterEvent() accepting Application/x-qabs..."; - std::cerr << std::endl; - event->acceptProposedAction(); - } - else - { - std::cerr << "CreateChannelMsg::dragEnterEvent() No PlainText/Urls"; - std::cerr << std::endl; - } -} - -void CreateChannelMsg::dropEvent(QDropEvent *event) -{ - if (!(Qt::CopyAction & event->possibleActions())) - { - std::cerr << "CreateChannelMsg::dropEvent() Rejecting uncopyable DropAction"; - std::cerr << std::endl; - - /* can't do it */ - return; - } - - std::cerr << "CreateChannelMsg::dropEvent() Formats" << std::endl; - QStringList formats = event->mimeData()->formats(); - QStringList::iterator it; - for(it = formats.begin(); it != formats.end(); it++) - { - std::cerr << "Format: " << (*it).toStdString(); - std::cerr << std::endl; - } - - if (event->mimeData()->hasText()) - { - std::cerr << "CreateChannelMsg::dropEvent() Plain Text:"; - std::cerr << std::endl; - std::cerr << event->mimeData()->text().toStdString(); - std::cerr << std::endl; - } - - if (event->mimeData()->hasUrls()) - { - std::cerr << "CreateChannelMsg::dropEvent() Urls:" << std::endl; - - QList urls = event->mimeData()->urls(); - QList::iterator uit; - for(uit = urls.begin(); uit != urls.end(); uit++) - { - QString localpath = uit->toLocalFile(); - std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl; - std::cerr << "or As Local File: " << localpath.toStdString() << std::endl; - - if (localpath.isEmpty() == false) - { - // Check that the file does exist and is not a directory - QDir dir(localpath); - if (dir.exists()) { - std::cerr << "CreateChannelMsg::dropEvent() directory not accepted."<< std::endl; - QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this); - mb.exec(); - } else if (QFile::exists(localpath)) { - addAttachment(localpath.toUtf8().constData()); - } else { - std::cerr << "CreateChannelMsg::dropEvent() file does not exists."<< std::endl; - QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this); - mb.exec(); - } - } - } - } - else if (event->mimeData()->hasFormat("application/x-rsfilelist")) - { - std::cerr << "CreateChannelMsg::dropEvent() Application/x-rsfilelist"; - std::cerr << std::endl; - - QByteArray data = event->mimeData()->data("application/x-rsfilelist"); - std::cerr << "Data Len:" << data.length(); - std::cerr << std::endl; - std::cerr << "Data is:" << data.data(); - std::cerr << std::endl; - - std::string newattachments(data.data()); - parseRsFileListAttachments(newattachments); - } - - event->setDropAction(Qt::CopyAction); - event->accept(); -} - -void CreateChannelMsg::parseRsFileListAttachments(const std::string &attachList) -{ - /* split into lines */ - QString input = QString::fromStdString(attachList); - - QStringList attachItems = input.split("\n"); - QStringList::iterator it; - QStringList::iterator it2; - - for(it = attachItems.begin(); it != attachItems.end(); it++) - { - std::cerr << "CreateChannelMsg::parseRsFileListAttachments() Entry: "; - - QStringList parts = (*it).split("/"); - - bool ok = false; - quint64 qsize = 0; - - std::string fname; - std::string hash; - uint64_t size = 0; - std::string source; - - int i = 0; - for(it2 = parts.begin(); it2 != parts.end(); it2++, i++) - { - std::cerr << "\"" << it2->toStdString() << "\" "; - switch(i) - { - case 0: - fname = it2->toStdString(); - break; - case 1: - hash = it2->toStdString(); - break; - case 2: - qsize = it2->toULongLong(&ok, 10); - size = qsize; - break; - case 3: - source = it2->toStdString(); - break; - } - } - - std::cerr << std::endl; - - std::cerr << "\tfname: " << fname << std::endl; - std::cerr << "\thash: " << hash << std::endl; - std::cerr << "\tsize: " << size << std::endl; - std::cerr << "\tsource: " << source << std::endl; - - /* basic error checking */ - if ((ok) && (hash.size() == 40)) - { - std::cerr << "Item Ok" << std::endl; - if (source == "Local") - { - addAttachment(hash, fname, size, true, ""); - } - else - { - // TEMP NOT ALLOWED UNTIL FT WORKING. - addAttachment(hash, fname, size, false, source); - } - - } - else - { - std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl; - } - - } -} - - -void CreateChannelMsg::addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId) -{ - /* add a SubFileItem to the attachment section */ - std::cerr << "CreateChannelMsg::addAttachment()"; - std::cerr << std::endl; - - /* add widget in for new destination */ - - uint32_t flags = SFI_TYPE_CHANNEL; - if (local) - { - flags |= SFI_STATE_LOCAL; - } - else - { - flags |= SFI_STATE_REMOTE; - } - - SubFileItem *file = new SubFileItem(hash, fname, "", size, flags, srcId); // destroyed when fileFrame (this subfileitem) is destroyed - - mAttachments.push_back(file); - QLayout *layout = fileFrame->layout(); - layout->addWidget(file); - - if (mCheckAttachment) - { - checkAttachmentReady(); - } - - return; -} - - -void CreateChannelMsg::addExtraFile() -{ - /* add a SubFileItem to the attachment section */ - std::cerr << "CreateChannelMsg::addExtraFile() opening file dialog"; - std::cerr << std::endl; - - QStringList files; - if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) { - for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) { - addAttachment((*fileIt).toUtf8().constData()); - } - } -} - - -void CreateChannelMsg::addAttachment(const std::string &path) -{ - /* add a SubFileItem to the attachment section */ - std::cerr << "CreateChannelMsg::addAttachment()"; - std::cerr << std::endl; - - if(mAutoMediaThumbNail) - setThumbNail(path, 2000); - - /* add widget in for new destination */ - uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE; - - // check attachment if hash exists already - std::list::iterator it; - - for(it= mAttachments.begin(); it != mAttachments.end(); it++){ - - if((*it)->FilePath() == path){ - QMessageBox::warning(this, tr("RetroShare"), - tr("File already Added and Hashed"), - QMessageBox::Ok, QMessageBox::Ok); - - return; - } - - } - - // channels creates copy of file into channels directory and shares this - - FileInfo fInfo; - rsChannels->channelExtraFileHash(path, mChannelId, fInfo); - - // file is not innitial - SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size, - flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed - - mAttachments.push_back(file); - QLayout *layout = fileFrame->layout(); - layout->addWidget(file); - - if (mCheckAttachment) - { - checkAttachmentReady(); - } - - return; -} - -bool CreateChannelMsg::setThumbNail(const std::string& path, int frame){ - -#ifdef CHANNELS_FRAME_CATCHER - unsigned char* imageBuffer = NULL; - int width = 0, height = 0, errCode = 0; - int length; - std::string errString; - - if(1 != (errCode = fCatcher->open(path))){ - fCatcher->getError(errCode, errString); - std::cerr << errString << std::endl; - return false; - } - - length = fCatcher->getLength(); - - // make sure frame chosen is at lease a quarter length of video length if not choose quarter length - if(frame < (int) (0.25 * length)) - frame = 0.25 * length; - - if(1 != (errCode = fCatcher->getRGBImage(frame, imageBuffer, width, height))){ - fCatcher->getError(errCode, errString); - std::cerr << errString << std::endl; - return false; - } - - if(imageBuffer == NULL) - return false; - - QImage tNail(imageBuffer, width, height, QImage::Format_RGB32); - QByteArray ba; - QBuffer buffer(&ba); - buffer.open(QIODevice::WriteOnly); - tNail.save(&buffer, "PNG"); - QPixmap img; - img.loadFromData(ba, "PNG"); - img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio); - thumbnail_label->setPixmap(img); - - delete[] imageBuffer; -#else - Q_UNUSED(path); - Q_UNUSED(frame); -#endif - - return true; -} - -void CreateChannelMsg::allowAutoMediaThumbNail(bool allowThumbNail){ - - mAutoMediaThumbNail = allowThumbNail; -} - -void CreateChannelMsg::checkAttachmentReady() -{ - std::list::iterator fit; - - mCheckAttachment = false; - - for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++) - { - if (!(*fit)->isHidden()) - { - if (!(*fit)->ready()) - { - /* ensure file is hashed or file will be hashed, thus - * recognized by librs but not correctly by gui (can't - * formally remove it) - */ - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); - break; - } - } - } - - if (fit == mAttachments.end()) - { - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); - buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(true); - } - - /* repeat... */ - int msec_rate = 1000; - QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void))); -} - - -void CreateChannelMsg::cancelMsg() -{ - std::cerr << "CreateChannelMsg::cancelMsg() :" - << "Deleting EXTRA attachments" << std::endl; - - std::cerr << std::endl; - - std::list::const_iterator it; - - for(it = mAttachments.begin(); it != mAttachments.end(); it++) - rsChannels->channelExtraFileRemove((*it)->FileHash(), mChannelId); - - close(); - return; -} - -void CreateChannelMsg::newChannelMsg() -{ - if (!rsChannels) - return; - - ChannelInfo ci; - if (!rsChannels->getChannelInfo(mChannelId, ci)) - { - - return; - } - - channelName->setText(QString::fromStdWString(ci.channelName)); - subjectEdit->setFocus(); -} - -void CreateChannelMsg::sendMsg() -{ - std::cerr << "CreateChannelMsg::sendMsg()"; - std::cerr << std::endl; - - /* construct message bits */ - std::wstring subject = misc::removeNewLine(subjectEdit->text()).toStdWString(); - std::wstring msg = msgEdit->toPlainText().toStdWString(); - - std::list files; - - std::list::iterator fit; - - for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++) - { - if (!(*fit)->isHidden()) - { - FileInfo fi; - fi.hash = (*fit)->FileHash(); - fi.fname = (*fit)->FileName(); - fi.size = (*fit)->FileSize(); - - files.push_back(fi); - - /* commence downloads - if we don't have the file */ - - if (!(*fit)->done()) - { - if ((*fit)->ready()) - { - (*fit)->download(); - } - // Skips unhashed files. - } - } - } - - sendMessage(subject, msg, files); - -} - -void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::list &files) -{ - QString name = misc::removeNewLine(subjectEdit->text()); - - if(name.isEmpty()) - { /* error message */ - QMessageBox::warning(this, tr("RetroShare"), - tr("Please add a Subject"), - QMessageBox::Ok, QMessageBox::Ok); - - return; //Don't add an empty Subject!! - } - else - /* rsChannels */ - if (rsChannels) - { - ChannelMsgInfo msgInfo; - - msgInfo.channelId = mChannelId; - msgInfo.msgId = ""; - - msgInfo.subject = subject; - msgInfo.msg = msg; - msgInfo.files = files; - - QByteArray ba; - QBuffer buffer(&ba); - - if(!picture.isNull()){ - // send chan image - - buffer.open(QIODevice::WriteOnly); - picture.save(&buffer, "PNG"); // writes image into ba in PNG format - msgInfo.thumbnail.image_thumbnail = (unsigned char*) ba.data(); - msgInfo.thumbnail.im_thumbnail_size = ba.size(); - } - - rsChannels->ChannelMessageSend(msgInfo); - } - - close(); - return; - -} - -void CreateChannelMsg::addThumbnail() -{ - QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load thumbnail picture"), 156, 107); - - if (img.isNull()) - return; - - picture = img; - - // to show the selected - thumbnail_label->setPixmap(picture); -} diff --git a/retroshare-gui/src/gui/channels/CreateChannelMsg.h b/retroshare-gui/src/gui/channels/CreateChannelMsg.h deleted file mode 100644 index 848aa5b03..000000000 --- a/retroshare-gui/src/gui/channels/CreateChannelMsg.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CREATECHANNELMSG_H -#define _CREATECHANNELMSG_H - -#include "ui_CreateChannelMsg.h" -#include - -#ifdef CHANNELS_FRAME_CATCHER -#include "util/framecatcher.h" -#endif - -class SubFileItem; -class FileInfo; - -class CreateChannelMsg : public QDialog, private Ui::CreateChannelMsg -{ - Q_OBJECT - -public: - /** Default Constructor */ - CreateChannelMsg(std::string cId); - - - /** Default Destructor */ - ~CreateChannelMsg(); - - void addAttachment(const std::string &path); - void addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId); - - void newChannelMsg(); - - QPixmap picture; - -protected: -virtual void dragEnterEvent(QDragEnterEvent *event); -virtual void dropEvent(QDropEvent *event); - -private slots: - void addExtraFile(); - void checkAttachmentReady(); - - void cancelMsg(); - void sendMsg(); - void pasteLink() ; - void contextMenu(QPoint) ; - - void addThumbnail(); - void allowAutoMediaThumbNail(bool); - -private: - - void parseRsFileListAttachments(const std::string &attachList); - void sendMessage(std::wstring subject, std::wstring msg, std::list &files); - bool setThumbNail(const std::string& path, int frame); - - - std::string mChannelId; - - std::list mAttachments; - - bool mCheckAttachment; - bool mAutoMediaThumbNail; - -#ifdef CHANNELS_FRAME_CATCHER - framecatcher* fCatcher; -#endif - -}; - -#endif - diff --git a/retroshare-gui/src/gui/channels/CreateChannelMsg.ui b/retroshare-gui/src/gui/channels/CreateChannelMsg.ui deleted file mode 100644 index 6e9ebb4bd..000000000 --- a/retroshare-gui/src/gui/channels/CreateChannelMsg.ui +++ /dev/null @@ -1,365 +0,0 @@ - - - CreateChannelMsg - - - - 0 - 0 - 581 - 479 - - - - true - - - New Channel Post - - - - :/images/rstray3.png:/images/rstray3.png - - - - 0 - - - 0 - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - true - - - Qt::CustomContextMenu - - - false - - - 0 - - - - Channel Post - - - - - - - - - 75 - true - - - - Channel Post to: - - - - - - - true - - - true - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;">Attachments:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/feedback_arrow.png" /><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> Use Drag and Drop / Add Files button, to Hash new files.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/images/feedback_arrow.png" /><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> Copy/Paste RetroShare links from your shares</span></p></body></html> - - - - - - - Add File to Attach - - - - :/images/add-share24.png:/images/add-share24.png - - - - - - - Add Channel Thumbnail - - - - :/images/add_image24.png:/images/add_image24.png - - - - - - - - - - 156 - 107 - - - - - 0 - 0 - - - - :/images/thumb-default-video.png - - - - - - - Qt::Horizontal - - - - 12 - 98 - - - - - - - - Message - - - - - - - - - 75 - true - - - - Subject : - - - - - - - - - - - - - - - - - - - - :/images/attachment.png:/images/attachment.png - - - Attachments - - - - - - - - - :/images/attachment.png - - - - - - - - 16777215 - 26 - - - - - 75 - true - - - - Attachments - - - - - - - Qt::Horizontal - - - - 334 - 26 - - - - - - - - - 0 - 0 - - - - - 34 - 34 - - - - - - - - :/images/add-share24.png:/images/add-share24.png - - - - 24 - 24 - - - - - - - - Allow channels to get frame for message thumbnail from movie media attachments or not - - - Auto Thumbnail - - - - - - - Qt::ScrollBarAlwaysOn - - - true - - - - - 0 - 0 - 98 - 24 - - - - - 0 - 0 - - - - - 3 - - - 3 - - - - - - 0 - 0 - - - - true - - - Drag and Drop Files from Search Results - - - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - HeaderFrame - QFrame -
gui/common/HeaderFrame.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/channels/EditChanDetails.cpp b/retroshare-gui/src/gui/channels/EditChanDetails.cpp deleted file mode 100644 index f0cc39d78..000000000 --- a/retroshare-gui/src/gui/channels/EditChanDetails.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2010 Christopher Evi-Parker - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ -#include "EditChanDetails.h" - -#include - -#include - -#include "util/misc.h" - -#include -#include -#include - -#define CHAN_DEFAULT_IMAGE ":/images/channels.png" - - -/** Default constructor */ -EditChanDetails::EditChanDetails(QWidget *parent, std::string cId) - : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mChannelId(cId) -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyDialog())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - - connect( ui.logoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo())); - - ui.logoButton->setDisabled(true); - ui.logoLabel->setDisabled(true); - - loadChannel(); -} - -void EditChanDetails::loadChannel() -{ - if (!rsChannels) - { - return; - } - - ChannelInfo ci; - rsChannels->getChannelInfo(mChannelId, ci); - - // Set Channel Name - ui.nameline->setText(QString::fromStdWString(ci.channelName)); - - // Set Channel Description - ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc)); - - // Set Channel Logo - QPixmap chanImage; - if(ci.pngImageLen != 0) - { - chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG"); - } - else - { - chanImage = QPixmap(CHAN_DEFAULT_IMAGE); - } - ui.logoLabel->setPixmap(chanImage); - -} - -void EditChanDetails::applyDialog() -{ - if(!rsChannels) - return; - - // if text boxes have not been edited leave alone - if(!ui.nameline->isModified() && !ui.DescriptiontextEdit->document()->isModified()) - return; - - ChannelInfo ci; - - ci.channelName = misc::removeNewLine(ui.nameline->text()).toStdWString(); - ci.channelDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString(); - - /* reload now */ - rsChannels->channelEditInfo(mChannelId, ci); - - /* close the Dialog after the Changes applied */ - close(); - - return; -} - -void EditChanDetails::addChannelLogo() // the same function as in CreateChannel -{ - QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load channel logo"), 64, 64); - - if (img.isNull()) - return; - - picture = img; - - // to show the selected - ui.logoLabel->setPixmap(picture); -} diff --git a/retroshare-gui/src/gui/channels/EditChanDetails.h b/retroshare-gui/src/gui/channels/EditChanDetails.h deleted file mode 100644 index dc9cd0c4e..000000000 --- a/retroshare-gui/src/gui/channels/EditChanDetails.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2010 Christopher Evi-Parker - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _EDITCHANDETAILS_H -#define _EDITCHANDETAILS_H - -#include - -#include "ui_EditChanDetails.h" - -class EditChanDetails : public QDialog -{ - Q_OBJECT - -public: - /** Default constructor */ - EditChanDetails(QWidget *parent = 0, std::string cId = 0); - -signals: - void configChanged(); - -private slots: - void applyDialog(); - void addChannelLogo(); - -private: - void loadChannel(); - - std::string mChannelId; - QPixmap picture; - - /** Qt Designer generated object */ - Ui::EditChanDetails ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/channels/EditChanDetails.ui b/retroshare-gui/src/gui/channels/EditChanDetails.ui deleted file mode 100644 index 4035d284f..000000000 --- a/retroshare-gui/src/gui/channels/EditChanDetails.ui +++ /dev/null @@ -1,143 +0,0 @@ - - - EditChanDetails - - - - 0 - 0 - 436 - 355 - - - - Channel Details - - - - :/images/rstray3.png:/images/rstray3.png - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - 0 - - - - - :/images/info16.png:/images/info16.png - - - Edit Channel Details - - - - - - Channel Info - - - - - - Channel Name - - - - - - - - - - Channel Description - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 118 - 20 - - - - - - - - Add Channel Logo - - - - :/images/add_image24.png:/images/add_image24.png - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - :/images/channels.png - - - true - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/channels/ShareKey.cpp b/retroshare-gui/src/gui/channels/ShareKey.cpp index 52adf91e5..390f4f193 100644 --- a/retroshare-gui/src/gui/channels/ShareKey.cpp +++ b/retroshare-gui/src/gui/channels/ShareKey.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +//#include +//#include #include #include "gui/common/PeerDefs.h" @@ -77,6 +77,7 @@ void ShareKey::shareKey() return; } +#if 0 if (mGrpType & CHANNEL_KEY_SHARE) { if (!rsChannels) return; @@ -97,6 +98,7 @@ void ShareKey::shareKey() // incorrect type return; } +#endif close(); } diff --git a/retroshare-gui/src/gui/common/StatusDefs.cpp b/retroshare-gui/src/gui/common/StatusDefs.cpp index 6050ad470..6cc4f771f 100644 --- a/retroshare-gui/src/gui/common/StatusDefs.cpp +++ b/retroshare-gui/src/gui/common/StatusDefs.cpp @@ -144,9 +144,6 @@ QString StatusDefs::connectStateString(RsPeerDetails &details) case 0: stateString = peerStateString(details.state); break; - case RS_PEER_CONNECTSTATE_TRYING_TUNNEL: - stateString = qApp->translate("StatusDefs", "Trying tunnel connection"); - break; case RS_PEER_CONNECTSTATE_TRYING_TCP: stateString = qApp->translate("StatusDefs", "Trying TCP"); break; @@ -159,9 +156,6 @@ QString StatusDefs::connectStateString(RsPeerDetails &details) case RS_PEER_CONNECTSTATE_CONNECTED_UDP: stateString = qApp->translate("StatusDefs", "Connected: UDP"); break; - case RS_PEER_CONNECTSTATE_CONNECTED_TUNNEL: - stateString = qApp->translate("StatusDefs", "Connected: Tunnel"); - break; case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN: stateString = qApp->translate("StatusDefs", "Connected: Unknown"); break; diff --git a/retroshare-gui/src/gui/feeds/BlogMsgItem.cpp b/retroshare-gui/src/gui/feeds/BlogMsgItem.cpp deleted file mode 100644 index 24348735b..000000000 --- a/retroshare-gui/src/gui/feeds/BlogMsgItem.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include - -#include "BlogMsgItem.h" - -#include "FeedHolder.h" -#include "SubFileItem.h" - -/**** - * #define DEBUG_ITEM 1 - ****/ - -/** Constructor */ -BlogMsgItem::BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mPeerId(peerId), mMsgId(msgId), mIsHome(isHome) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - //connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) ); - - /* specific ones */ - connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) ); - - small(); - updateItemStatic(); - updateItem(); -} - - -void BlogMsgItem::updateItemStatic() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "BlogMsgItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - msgLabel->setText("What did you expect? \nThe Blogs will be up and running shortly!"); - titleLabel->setText("Blog Feed: Jacki @ Friday"); - subjectLabel->setText("Brand new exciting Blog stuff"); - - /* add Files */ - int total = (int) (10.0 * (rand() / (RAND_MAX + 1.0))); - int i; - - total = 0; - - for(i = 0; i < total; i++) - { - /* add file */ - SubFileItem *fi = new SubFileItem("dummyHash", "dummy_File", "", 1283918, SFI_STATE_REMOTE, mPeerId); - mFileItems.push_back(fi); - - QLayout *layout = expandFrame->layout(); - layout->addWidget(fi); - } - - playButton->setEnabled(false); - - if (mIsHome) - { - /* disable buttons */ - clearButton->setEnabled(false); - //gotoButton->setEnabled(false); - - clearButton->hide(); - } -} - - -void BlogMsgItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "BlogMsgItem::updateItem()"; - std::cerr << std::endl; -#endif - int msec_rate = 10000; - - /* Very slow Tick to check when all files are downloaded */ - std::list::iterator it; - for(it = mFileItems.begin(); it != mFileItems.end(); it++) - { - if (!(*it)->done()) - { - /* loop again */ - QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) )); - return; - } - } - if (mFileItems.size() > 0) - { - playButton->setEnabled(true); - } -} - - -void BlogMsgItem::small() -{ - expandFrame->hide(); -} - -void BlogMsgItem::toggle() -{ - mParent->lockLayout(this, true); - - if (expandFrame->isHidden()) - { - expandFrame->show(); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - } - else - { - expandFrame->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } - - mParent->lockLayout(this, false); -} - - -void BlogMsgItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogMsgItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - - -void BlogMsgItem::gotoHome() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogMsgItem::gotoHome()"; - std::cerr << std::endl; -#endif -} - -/*********** SPECIFIC FUNCTIOSN ***********************/ - - -void BlogMsgItem::playMedia() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogMsgItem::playMedia()"; - std::cerr << std::endl; -#endif -} - - - diff --git a/retroshare-gui/src/gui/feeds/BlogMsgItem.h b/retroshare-gui/src/gui/feeds/BlogMsgItem.h deleted file mode 100644 index b89e21a59..000000000 --- a/retroshare-gui/src/gui/feeds/BlogMsgItem.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _BLOG_MSG_ITEM_DIALOG_H -#define _BLOG_MSG_ITEM_DIALOG_H - -#include "ui_BlogMsgItem.h" -#include - -class FeedHolder; -class SubFileItem; - -class BlogMsgItem : public QWidget, private Ui::BlogMsgItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - BlogMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &msgId, bool isHome); - - void updateItemStatic(); - void small(); - -private slots: - /* default stuff */ - void gotoHome(); - void removeItem(); - void toggle(); - - void playMedia(); - - void updateItem(); - -private: - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mPeerId; - std::string mMsgId; - - bool mIsHome; - - std::list mFileItems; -}; - -#endif - diff --git a/retroshare-gui/src/gui/feeds/BlogMsgItem.ui b/retroshare-gui/src/gui/feeds/BlogMsgItem.ui deleted file mode 100644 index 94c82ec8f..000000000 --- a/retroshare-gui/src/gui/feeds/BlogMsgItem.ui +++ /dev/null @@ -1,242 +0,0 @@ - - - BlogMsgItem - - - - 0 - 0 - 552 - 238 - - - - - - - - 0 - - - - - - 0 - 0 - - - - QFrame#frame{ -border: 2px solid #6ACEFF; -border-radius: 10px; -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, -stop:0 #0076B1, stop:1 #12A3EB);} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - 6 - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Remove Item - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 16 - 26 - - - - - - - - - 0 - 0 - - - - - 75 - true - true - - - - Blog - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 1000 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Expand - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - - - - Subject - - - - - - - - 0 - 0 - - - - subjectLabel - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 500 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Play Media - - - - :/images/startall.png:/images/startall.png - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - 0 - - - - Long - message here - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/feeds/BlogNewItem.cpp b/retroshare-gui/src/gui/feeds/BlogNewItem.cpp deleted file mode 100644 index 8a3f7674b..000000000 --- a/retroshare-gui/src/gui/feeds/BlogNewItem.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "BlogNewItem.h" -#include "FeedHolder.h" - -#include - -#define BLOG_DEFAULT_IMAGE ":/images/hi64-app-kblogger.png" - - -/**** - * #define DEBUG_ITEM 1 - ****/ - -/** Constructor */ -BlogNewItem::BlogNewItem(FeedHolder *parent, uint32_t feedId, std::string blogId, bool isHome, bool isNew) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mBlogId(blogId), mIsHome(isHome), mIsNew(isNew) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - - /* specific ones */ - connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) ); - - small(); - updateItemStatic(); - updateItem(); -} - - -void BlogNewItem::updateItemStatic() -{ - if (!rsBlogs) - return; - - - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "BlogNewItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - BlogInfo bi; - if (rsBlogs->getBlogInfo(mBlogId, bi)) - { - nameLabel->setText(QString::fromStdWString(bi.blogName)); - - descLabel->setText(QString::fromStdWString(bi.blogDesc)); - - if(bi.pngImageLen != 0){ - - QPixmap blogImage; - blogImage.loadFromData(bi.pngChanImage, bi.pngImageLen, "PNG"); - logo_label->setPixmap(QPixmap(blogImage)); - }else{ - QPixmap defaulImage(BLOG_DEFAULT_IMAGE); - logo_label->setPixmap(QPixmap(defaulImage)); - } - - if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED) - { - subscribeButton->setEnabled(false); - //postButton->setEnabled(true); - } - else - { - subscribeButton->setEnabled(true); - //postButton->setEnabled(false); - } - - - /* should also check the other flags */ - } - else - { - nameLabel->setText(tr("Unknown Blog")); - titleLabel->setText("Blog ???"); - descLabel->setText(""); - } - - if (mIsNew) - { - titleLabel->setText(tr("New Blog")); - } - else - { - titleLabel->setText(tr("Updated Blog")); - } - - if (mIsHome) - { - /* disable buttons */ - clearButton->setEnabled(false); - //gotoButton->setEnabled(false); - } -} - - -void BlogNewItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "BlogNewItem::updateItem()"; - std::cerr << std::endl; -#endif - -} - - -void BlogNewItem::small() -{ - expandFrame->hide(); -} - -void BlogNewItem::toggle() -{ - mParent->lockLayout(this, true); - - if (expandFrame->isHidden()) - { - expandFrame->show(); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - } - else - { - expandFrame->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } - - mParent->lockLayout(this, false); -} - - -void BlogNewItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogNewItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - - -void BlogNewItem::gotoHome() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogNewItem::gotoHome()"; - std::cerr << std::endl; -#endif -} - -/*********** SPECIFIC FUNCTIOSN ***********************/ - - -void BlogNewItem::unsubscribeBlog() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogNewItem::unsubscribeBlog()"; - std::cerr << std::endl; -#endif - if (rsBlogs) - { - rsBlogs->blogSubscribe(mBlogId, false); - } - updateItemStatic(); -} - - -void BlogNewItem::subscribeBlog() -{ -#ifdef DEBUG_ITEM - std::cerr << "BlogNewItem::subscribeBlog()"; - std::cerr << std::endl; -#endif - if (rsBlogs) - { - rsBlogs->blogSubscribe(mBlogId, true); - } - updateItemStatic(); -} - - - diff --git a/retroshare-gui/src/gui/feeds/BlogNewItem.h b/retroshare-gui/src/gui/feeds/BlogNewItem.h deleted file mode 100644 index 93f7781da..000000000 --- a/retroshare-gui/src/gui/feeds/BlogNewItem.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _BLOG_NEW_ITEM_DIALOG_H -#define _BLOG_NEW_ITEM_DIALOG_H - -#include "ui_BlogNewItem.h" -#include - -class FeedHolder; - -class BlogNewItem : public QWidget, private Ui::BlogNewItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - BlogNewItem(FeedHolder *parent, uint32_t feedId, const std::string &blogId, bool isHome, bool isNew); - - void updateItemStatic(); - void small(); - -private slots: - /* default stuff */ - void gotoHome(); - void removeItem(); - void toggle(); - - void unsubscribeBlog(); - void subscribeBlog(); - - void updateItem(); - -private: - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mBlogId; - bool mIsHome; - bool mIsNew; -}; - -#endif - diff --git a/retroshare-gui/src/gui/feeds/BlogNewItem.ui b/retroshare-gui/src/gui/feeds/BlogNewItem.ui deleted file mode 100644 index 39c531f69..000000000 --- a/retroshare-gui/src/gui/feeds/BlogNewItem.ui +++ /dev/null @@ -1,260 +0,0 @@ - - - BlogNewItem - - - - 0 - 0 - 643 - 109 - - - - - 0 - - - - - - 0 - 0 - - - - QFrame#frame{ -border: 2px solid #6ACEFF; -border-radius: 10px; -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, -stop:0 #0076B1, stop:1 #12A3EB);} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 6 - - - 6 - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Remove Item - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - - 0 - 0 - - - - - 75 - true - true - - - - New Blog - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 32 - 32 - - - - Logo - - - true - - - - - - - name - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 500 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Subscribe to Blog - - - - :/images/directoryadd_24x24_shadow.png:/images/directoryadd_24x24_shadow.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Expand - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - Blog Description - - - - - - - - - :/images/contacts24.png - - - - - - - - 0 - 0 - - - - Description - of Blog - - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp b/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp deleted file mode 100644 index 51244a8d1..000000000 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include -#include - -#include "rshare.h" -#include "ChanMsgItem.h" - -#include "FeedHolder.h" -#include "SubFileItem.h" -#include "gui/notifyqt.h" -#include "util/misc.h" -#include "gui/RetroShareLink.h" -#include "util/HandleRichText.h" -#include "util/DateTime.h" - -#include - -/**** - * #define DEBUG_ITEM 1 - ****/ - -#define COLOR_NORMAL QColor(248, 248, 248) -#define COLOR_NEW QColor(220, 236, 253) - -/** Constructor */ -ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mChanId(chanId), mMsgId(msgId), mIsHome(isHome) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - m_inUpdateItemStatic = false; - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - - /* specific */ - connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem())); - connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) ); - connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) ); - connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) ); - connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) ); - - connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) ); - connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); - - downloadButton->hide(); - playButton->hide(); - warn_image_label->hide(); - warning_label->hide(); - - titleLabel->setMinimumWidth(100); - subjectLabel->setMinimumWidth(100); - warning_label->setMinimumWidth(100); - - frame->setProperty("state", ""); - QPalette palette = frame->palette(); - palette.setColor(frame->backgroundRole(), COLOR_NORMAL); - frame->setPalette(palette); - - expandFrame->hide(); - updateItemStatic(); - updateItem(); -} - -void ChanMsgItem::updateItemStatic() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - ChannelMsgInfo cmi; - - if (!rsChannels) - return; - - if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) - return; - - m_inUpdateItemStatic = true; - - QString title; - - ChannelInfo ci; - rsChannels->getChannelInfo(mChanId, ci); - - if (!mIsHome) - { - title = tr("Channel Feed") + ": "; - RetroShareLink link; - link.createChannel(ci.channelId, ""); - title += link.toHtml(); - titleLabel->setText(title); - RetroShareLink msgLink; - msgLink.createChannel(cmi.channelId, cmi.msgId); - subjectLabel->setText(msgLink.toHtml()); - - if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) { - unsubscribeButton->setEnabled(true); - } else { - unsubscribeButton->setEnabled(false); - } - readButton->hide(); - newLabel->hide(); - copyLinkButton->hide(); - } - else - { - /* subject */ - titleLabel->setText(QString::fromStdWString(cmi.subject)); - subjectLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - - /* disable buttons: deletion facility not enabled with cache services yet */ - clearButton->setEnabled(false); - unsubscribeButton->setEnabled(false); - clearButton->hide(); - readAndClearButton->hide(); - unsubscribeButton->hide(); - copyLinkButton->show(); - - if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) { - readButton->setVisible(true); - - uint32_t status = 0; - rsChannels->getMessageStatus(mChanId, mMsgId, status); - - if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) { - readButton->setChecked(true); - readButton->setIcon(QIcon(":/images/message-state-unread.png")); - } else { - readButton->setChecked(false); - readButton->setIcon(QIcon(":/images/message-state-read.png")); - } - - bool newState; - QColor color; - if (status & CHANNEL_MSG_STATUS_READ) { - newLabel->setVisible(false); - newState = false; - color = COLOR_NORMAL; - } else { - newLabel->setVisible(true); - newState = true; - color = COLOR_NEW; - } - - /* unpolish widget to clear the stylesheet's palette cache */ - frame->style()->unpolish(frame); - - QPalette palette = frame->palette(); - palette.setColor(frame->backgroundRole(), color); - frame->setPalette(palette); - - frame->setProperty("new", newState); - Rshare::refreshStyleSheet(frame, false); - } else { - readButton->setVisible(false); - newLabel->setVisible(false); - } - } - - msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - msgFrame->setVisible(!cmi.msg.empty()); - - datetimelabel->setText(DateTime::formatLongDateTime(cmi.ts)); - - filelabel->setText(QString("(%1 %2) %3").arg(cmi.count).arg(tr("Files")).arg(misc::friendlyUnit(cmi.size))); - - if (mFileItems.empty() == false) { - std::list::iterator it; - for(it = mFileItems.begin(); it != mFileItems.end(); it++) - { - delete(*it); - } - mFileItems.clear(); - } - - std::list::iterator it; - for(it = cmi.files.begin(); it != cmi.files.end(); it++) - { - /* add file */ - SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size, - SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, ""); - mFileItems.push_back(fi); - - /* check if the file is a media file */ - if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix())) - fi->mediatype(); - - - QLayout *layout = expandFrame->layout(); - layout->addWidget(fi); - } - - if(cmi.thumbnail.image_thumbnail != NULL) - { - QPixmap thumbnail; - thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG"); - - logoLabel->setPixmap(thumbnail); - } - - m_inUpdateItemStatic = false; -} - -void ChanMsgItem::setFileCleanUpWarning(uint32_t time_left) -{ - int hours = (int)time_left/3600; - int minutes = (time_left - hours*3600)%60; - - warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg( - QString::number(hours)).arg(QString::number(minutes))); - - QFont warnFont = warning_label->font(); - warnFont.setBold(true); - warning_label->setFont(warnFont); - - warn_image_label->setVisible(true); - warning_label->setVisible(true); - return; - -} - -void ChanMsgItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::updateItem()"; - std::cerr << std::endl; -#endif - int msec_rate = 10000; - - int downloadCount = 0; - int downloadStartable = 0; - int playCount = 0; - int playStartable = 0; - bool startable; - bool loopAgain = false; - - /* Very slow Tick to check when all files are downloaded */ - std::list::iterator it; - for(it = mFileItems.begin(); it != mFileItems.end(); it++) - { - SubFileItem *item = *it; - - if (item->isDownloadable(startable)) { - downloadCount++; - if (startable) { - downloadStartable++; - } - } - if (item->isPlayable(startable)) { - playCount++; - if (startable) { - playStartable++; - } - } - - if (!item->done()) - { - /* loop again */ - loopAgain = true; - } - } - - if (downloadCount) { - downloadButton->show(); - - if (downloadStartable) { - downloadButton->setEnabled(true); - } else { - downloadButton->setEnabled(false); - } - } else { - downloadButton->hide(); - } - if (playCount) { - /* one file is playable */ - playButton->show(); - - if (playStartable == 1) { - playButton->setEnabled(true); - } else { - playButton->setEnabled(false); - } - } else { - playButton->hide(); - } - - if (loopAgain) { - QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) )); - } -} - -void ChanMsgItem::toggle() -{ - mParent->lockLayout(this, true); - - if (expandFrame->isHidden()) - { - expandFrame->show(); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - - readToggled(false); - } - else - { - expandFrame->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } - - mParent->lockLayout(this, false); -} - -void ChanMsgItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - -/*********** SPECIFIC FUNCTIONS ***********************/ - -void ChanMsgItem::readAndClearItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::readAndClearItem()"; - std::cerr << std::endl; -#endif - - readToggled(false); - removeItem(); -} - -void ChanMsgItem::unsubscribeChannel() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::unsubscribeChannel()"; - std::cerr << std::endl; -#endif - - if (rsChannels) - { - rsChannels->channelSubscribe(mChanId, false, false); - } - updateItemStatic(); -} - -void ChanMsgItem::download() -{ - readToggled(false); - - std::list::iterator it; - for(it = mFileItems.begin(); it != mFileItems.end(); it++) - { - (*it)->download(); - } - - updateItem(); -} - -void ChanMsgItem::play() -{ - std::list::iterator it; - for(it = mFileItems.begin(); it != mFileItems.end(); it++) - { - bool startable; - if ((*it)->isPlayable(startable) && startable) { - (*it)->play(); - } - } -} - -void ChanMsgItem::readToggled(bool checked) -{ - if (m_inUpdateItemStatic) { - return; - } - - /* set always as read ... */ - uint32_t statusNew = CHANNEL_MSG_STATUS_READ; - if (checked) { - /* ... and as unread by user */ - statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER; - } else { - /* ... and as read by user */ - statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER; - } - - if (!mIsHome) { - disconnect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int))); - } - rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER); - if (!mIsHome) { - connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); - } -} - -void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status) -{ - if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) { - if (!mIsHome) { - if (status & CHANNEL_MSG_STATUS_READ) { - close(); - return; - } - } - updateItemStatic(); - } -} - -void ChanMsgItem::copyLink() -{ - if (mChanId.empty() || mMsgId.empty()) { - return; - } - - ChannelMsgInfo cmi; - if (rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) { - RetroShareLink link; - if (link.createChannel(cmi.channelId, cmi.msgId)) { - QList urls; - urls.push_back(link); - RSLinkClipboard::copyLinks(urls); - } - } -} diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.h b/retroshare-gui/src/gui/feeds/ChanMsgItem.h deleted file mode 100644 index aad77f49a..000000000 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CHAN_MSG_ITEM_DIALOG_H -#define _CHAN_MSG_ITEM_DIALOG_H - -#include "ui_ChanMsgItem.h" -#include - -class FeedHolder; -class SubFileItem; - -class ChanMsgItem : public QWidget, private Ui::ChanMsgItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome); - - void updateItemStatic(); - void setFileCleanUpWarning(uint32_t time_left); - - const std::string &msgId() { return mMsgId; } - -private slots: - /* default stuff */ - void removeItem(); - void toggle(); - - void readAndClearItem(); - void unsubscribeChannel(); - void download(); - void play(); - void copyLink(); - - void readToggled(bool checked); - void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status); - - void updateItem(); - -private: - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mChanId; - std::string mMsgId; - - bool mIsHome; - bool m_inUpdateItemStatic; - - std::list mFileItems; -}; - -#endif - diff --git a/retroshare-gui/src/gui/feeds/ChanMsgItem.ui b/retroshare-gui/src/gui/feeds/ChanMsgItem.ui deleted file mode 100644 index 795c5fa0a..000000000 --- a/retroshare-gui/src/gui/feeds/ChanMsgItem.ui +++ /dev/null @@ -1,481 +0,0 @@ - - - ChanMsgItem - - - - 0 - 0 - 629 - 172 - - - - - 6 - - - 1 - - - 1 - - - - - - 0 - 0 - - - - true - - - QFrame::Box - - - QFrame::Sunken - - - - - - - - - 156 - 107 - - - - - - - :/images/thumb-default-video.png - - - true - - - - - - - - - - - - 0 - 0 - - - - - 11 - 75 - true - true - PreferAntialias - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:normal; color:#656565;">Channel Subject</span></p></body></html> - - - false - - - true - - - - - - - - 75 - true - PreferAntialias - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">DateTime</span></p></body></html> - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 60 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">Short Description</span></p></body></html> - - - true - - - true - - - - - - - - PreferAntialias - - - - fileLabel - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - - - - - - - - - - 24 - 16777215 - - - - - - - :/images/status_unknown.png - - - - - - - TextLabel - - - - - - - - - 8 - - - - - - 24 - 16777215 - - - - Qt::NoFocus - - - Toggle Message Read Status - - - - :/images/message-state-unread.png:/images/message-state-unread.png - - - true - - - false - - - false - - - - - - - - 16777215 - 21 - - - - New - - - - - - - - - - Qt::NoFocus - - - Download - - - - :/images/download16.png:/images/download16.png - - - - - - - - - - Qt::NoFocus - - - Play - - - - :/images/player_play.png:/images/player_play.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 24 - 16777215 - - - - Qt::NoFocus - - - Copy RetroShare Link - - - - :/images/copyrslink.png:/images/copyrslink.png - - - - - - - - 0 - 0 - - - - - 24 - 16777215 - - - - Qt::NoFocus - - - Unsubscribe From Channel - - - - :/images/mail_delete.png:/images/mail_delete.png - - - - - - - - 0 - 0 - - - - - 24 - 16777215 - - - - Qt::NoFocus - - - Expand - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - 0 - 0 - - - - - 24 - 16777215 - - - - Qt::NoFocus - - - Set as read and remove item - - - - :/images/cancel.png:/images/cancel.png - - - - - - - - 0 - 0 - - - - - 24 - 16777215 - - - - Qt::NoFocus - - - Remove Item - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - - - - - - - - 0 - - - - - QFrame::Box - - - QFrame::Sunken - - - - 5 - - - - - - 0 - 0 - - - - true - - - 6 - - - -1 - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/feeds/ChanNewItem.cpp b/retroshare-gui/src/gui/feeds/ChanNewItem.cpp deleted file mode 100644 index bc5dad292..000000000 --- a/retroshare-gui/src/gui/feeds/ChanNewItem.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "ChanNewItem.h" -#include "FeedHolder.h" -#include "gui/RetroShareLink.h" - -#include - -#define CHAN_DEFAULT_IMAGE ":/images/channels.png" - -/**** - * #define DEBUG_ITEM 1 - ****/ - -/** Constructor */ -ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mChanId(chanId), mIsHome(isHome), mIsNew(isNew) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - - /* specific ones */ - connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) ); - - expandFrame->hide(); - updateItemStatic(); - updateItem(); -} - - -void ChanNewItem::updateItemStatic() -{ - if (!rsChannels) - return; - - - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ChanNewItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - ChannelInfo ci; - if (rsChannels->getChannelInfo(mChanId, ci)) - { - RetroShareLink link; - link.createChannel(ci.channelId, ""); - nameLabel->setText(link.toHtml()); - - descLabel->setText(QString::fromStdWString(ci.channelDesc)); - - if(ci.pngImageLen != 0){ - QPixmap chanImage; - chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG"); - logoLabel->setPixmap(QPixmap(chanImage)); - } else { - QPixmap defaulImage(CHAN_DEFAULT_IMAGE); - logoLabel->setPixmap(QPixmap(defaulImage)); - } - - if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) - { - subscribeButton->setEnabled(false); - //postButton->setEnabled(true); - } - else - { - subscribeButton->setEnabled(true); - //postButton->setEnabled(false); - } - - - /* should also check the other flags */ - } - else - { - nameLabel->setText(tr("Unknown Channel")); - titleLabel->setText("Channel ???"); - descLabel->setText(""); - } - - if (mIsNew) - { - titleLabel->setText(tr("New Channel")); - } - else - { - titleLabel->setText(tr("Updated Channel")); - } - - if (mIsHome) - { - /* disable buttons */ - clearButton->setEnabled(false); - } -} - - -void ChanNewItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ChanNewItem::updateItem()"; - std::cerr << std::endl; -#endif - -} - -void ChanNewItem::toggle() -{ - mParent->lockLayout(this, true); - - if (expandFrame->isHidden()) - { - expandFrame->show(); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - } - else - { - expandFrame->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } - - mParent->lockLayout(this, false); -} - - -void ChanNewItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanNewItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - - -/*********** SPECIFIC FUNCTIOSN ***********************/ - - -void ChanNewItem::unsubscribeChannel() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanNewItem::unsubscribeChannel()"; - std::cerr << std::endl; -#endif - if (rsChannels) - { - rsChannels->channelSubscribe(mChanId, false, false); - } - updateItemStatic(); -} - - -void ChanNewItem::subscribeChannel() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanNewItem::subscribeChannel()"; - std::cerr << std::endl; -#endif - if (rsChannels) - { - rsChannels->channelSubscribe(mChanId, true, true); - } - updateItemStatic(); -} - - - diff --git a/retroshare-gui/src/gui/feeds/ChanNewItem.h b/retroshare-gui/src/gui/feeds/ChanNewItem.h deleted file mode 100644 index cda5b1088..000000000 --- a/retroshare-gui/src/gui/feeds/ChanNewItem.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CHANNEL_NEW_ITEM_DIALOG_H -#define _CHANNEL_NEW_ITEM_DIALOG_H - -#include "ui_ChanNewItem.h" -#include - -class FeedHolder; - -class ChanNewItem : public QWidget, private Ui::ChanNewItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew); - - void updateItemStatic(); - -private slots: - /* default stuff */ - void removeItem(); - void toggle(); - - void unsubscribeChannel(); - void subscribeChannel(); - - void updateItem(); - -private: - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mChanId; - bool mIsHome; - bool mIsNew; -}; - -#endif - diff --git a/retroshare-gui/src/gui/feeds/ChanNewItem.ui b/retroshare-gui/src/gui/feeds/ChanNewItem.ui deleted file mode 100644 index 4f8379de9..000000000 --- a/retroshare-gui/src/gui/feeds/ChanNewItem.ui +++ /dev/null @@ -1,284 +0,0 @@ - - - ChanNewItem - - - - 0 - 0 - 643 - 155 - - - - - 0 - - - - - - 0 - 0 - - - - - - - - - 248 - 248 - 248 - - - - - - - - - 248 - 248 - 248 - - - - - - - - - 248 - 248 - 248 - - - - - - - - true - - - QFrame::Box - - - QFrame::Sunken - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - true - - - - - - - name - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - 0 - 0 - - - - - 75 - true - true - - - - New Channel - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 338 - 28 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Subscribe to Channel - - - - :/images/directoryadd_24x24_shadow.png:/images/directoryadd_24x24_shadow.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Expand - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Remove Item - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - - - Qt::Horizontal - - - - 455 - 20 - - - - - - - - - 0 - - - 0 - - - - - Channel Description - - - - - - - - - :/images/contacts24.png - - - - - - - - 0 - 0 - - - - Description - of Channel - - - true - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp b/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp deleted file mode 100644 index 2a4fadde6..000000000 --- a/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include - -#include "ForumMsgItem.h" -#include "FeedHolder.h" -#include "gui/RetroShareLink.h" - -#include -#include -#include - -#include "gui/forums/CreateForumMsg.h" -#include "util/HandleRichText.h" -#include "util/DateTime.h" -#include "gui/common/AvatarDefs.h" -#include "gui/notifyqt.h" -#include "gui/ForumsDialog.h" -//#include "gui/settings/rsharesettings.h" - -/**** - * #define DEBUG_ITEM 1 - ****/ - -/** Constructor */ -ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome) -:QWidget(NULL), mParent(parent), mFeedId(feedId), mForumId(forumId), mPostId(postId), mIsHome(isHome), mIsTop(false) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - - /* specific ones */ - connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem())); - connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) ); - connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) ); - connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) ); - - connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); - - subjectLabel->setMinimumWidth(20); - - nextFrame->hide(); - prevFrame->hide(); - - updateItemStatic(); - updateItem(); - textEdit->hide(); - sendButton->hide(); - signedcheckBox->hide(); -} - -void ForumMsgItem::updateItemStatic() -{ - if (!rsForums) - return; - - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - canReply = false; - - ForumInfo fi; - if (rsForums->getForumInfo(mForumId, fi)) - { - RetroShareLink link; - link.createForum(fi.forumId, ""); - QString title = tr("Forum Post") + ": "; - title += link.toHtml(); - - titleLabel->setText(title); - if (fi.subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED)) - { - unsubscribeButton->setEnabled(true); - replyButton->setEnabled(true); - - if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) - { - signedcheckBox->setChecked(true); - signedcheckBox->setEnabled(false); - } - - canReply = true; - } - else - { - unsubscribeButton->setEnabled(false); - replyButton->setEnabled(false); - } - } - else - { - titleLabel->setText(tr("Unknown Forum Post")); - } - - /* get actual Message */ - ForumMsgInfo msg; - if (rsForums->getForumMessage(mForumId, mPostId, msg)) - { -#ifdef DEBUG_ITEM - std::cerr << "Ids: MsgId: " << msg.msgId; - std::cerr << std::endl; - std::cerr << "Ids: ParentId: " << msg.parentId; - std::cerr << std::endl; - std::cerr << "Ids: ThreadId: " << msg.threadId; - std::cerr << std::endl; -#endif - - /* decide if top or not */ - if ((msg.msgId == msg.threadId) || (msg.threadId == "")) - { - mIsTop = true; - } - - RetroShareLink link; - link.createForum(msg.forumId, msg.msgId); - - if (mIsTop) - { - avatar->setId(msg.srcId, true); - - if (rsPeers->getPeerName(msg.srcId) !="") - { - RetroShareLink linkMessage; - linkMessage.createMessage(msg.srcId, ""); - nameLabel->setText(linkMessage.toHtml()); - } - else - { - nameLabel->setText(tr("Anonymous")); - } - - prevSubLabel->setText(link.toHtml()); - prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - - timestamplabel->setText(DateTime::formatLongDateTime(msg.ts)); - - nextFrame->hide(); - } - else - { - nextAvatar->setId(msg.srcId, true); - - if (rsPeers->getPeerName(msg.srcId) !="") - { - RetroShareLink linkMessage; - linkMessage.createMessage(msg.srcId, ""); - nextNameLabel->setText(linkMessage.toHtml()); - } - else - { - nextNameLabel->setText(tr("Anonymous")); - } - - nextSubLabel->setText(link.toHtml()); - nextMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - - timestamplabel->setText(DateTime::formatLongDateTime(msg.ts)); - - prevSHLabel->setText(tr("In Reply to") + ": "); - - ForumMsgInfo msgParent; - if (rsForums->getForumMessage(mForumId, msg.parentId, msgParent)) - { - avatar->setId(msgParent.srcId, true); - - RetroShareLink linkParent; - linkParent.createForum(msgParent.forumId, msgParent.msgId); - prevSubLabel->setText(linkParent.toHtml()); - prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msgParent), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - - if (rsPeers->getPeerName(msgParent.srcId) !="") - { - RetroShareLink linkMessage; - linkMessage.createMessage(msgParent.srcId, ""); - nameLabel->setText(linkMessage.toHtml()); - } - else - { - nameLabel->setText(tr("Anonymous")); - } - } - else - { - prevSubLabel->setText("???"); - prevMsgLabel->setText("???"); - } - } - - /* header stuff */ - subjectLabel->setText(link.toHtml()); - //srcLabel->setText(QString::fromStdString(msg.srcId)); - } - - if (mIsHome) - { - /* disable buttons */ - clearButton->setEnabled(false); - //gotoButton->setEnabled(false); - - clearButton->hide(); - } - - unsubscribeButton->hide(); -} - -void ForumMsgItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::updateItem()"; - std::cerr << std::endl; -#endif -} - -void ForumMsgItem::toggle() -{ - mParent->lockLayout(this, true); - - if (prevFrame->isHidden()) - { - prevFrame->show(); - textEdit->setVisible(canReply); - sendButton->setVisible(canReply); - signedcheckBox->setVisible(canReply); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - if (!mIsTop) - { - nextFrame->show(); - } - - setAsRead(); - } - else - { - prevFrame->hide(); - nextFrame->hide(); - textEdit->hide(); - sendButton->hide(); - signedcheckBox->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } - - mParent->lockLayout(this, false); -} - -void ForumMsgItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - -/*********** SPECIFIC FUNCTIOSN ***********************/ - -void ForumMsgItem::readAndClearItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::readAndClearItem()"; - std::cerr << std::endl; -#endif - - setAsRead(); - removeItem(); -} - -void ForumMsgItem::unsubscribeForum() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::unsubscribeForum()"; - std::cerr << std::endl; -#endif - if (rsForums) - { - rsForums->forumSubscribe(mForumId, false); - } - updateItemStatic(); -} - -void ForumMsgItem::subscribeForum() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::subscribeForum()"; - std::cerr << std::endl; -#endif - if (rsForums) - { - rsForums->forumSubscribe(mForumId, true); - } - updateItemStatic(); -} - -void ForumMsgItem::replyToPost() -{ - if (canReply == false) { - return; - } - -#ifdef DEBUG_ITEM - std::cerr << "ForumMsgItem::replyToPost()"; - std::cerr << std::endl; -#endif - if (mParent) - { - CreateForumMsg *cfm = new CreateForumMsg(mForumId, mPostId); - cfm->show(); - } -} - -void ForumMsgItem::sendMsg() -{ - if (canReply == false) { - return; - } - - if(textEdit->toPlainText().isEmpty()) - { /* error message */ - QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"), - QMessageBox::Ok, QMessageBox::Ok); - - return; //Don't add a empty Message!! - } - - ForumMsgInfo msg; - - /* get message */ - if (rsForums->getForumMessage(mForumId, mPostId, msg)) { - ForumMsgInfo msgInfo; - - msgInfo.forumId = mForumId; - msgInfo.threadId = ""; - msgInfo.parentId = mPostId; - msgInfo.msgId = ""; - - /* modify title */ - QString text = QString::fromStdWString(msg.title); - if (text.startsWith("Re:", Qt::CaseInsensitive)) { - msgInfo.title = msg.title; - } else { - msgInfo.title = L"Re: " + msg.title; - } - - QString desc; - RsHtml::optimizeHtml(textEdit, desc); - - msgInfo.msg = desc.toStdWString(); - msgInfo.msgflags = 0; - - if (signedcheckBox->isChecked()) - { - msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ; - } - - if ((msgInfo.msg == L"") && (msgInfo.title == L"")) - return; /* do nothing */ - - if (rsForums->ForumMessageSend(msgInfo) == true) { - textEdit->clear(); - } - } -} - -void ForumMsgItem::forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status) -{ - if (mForumId == forumId.toStdString() && mPostId == msgId.toStdString()) { - if (status & FORUM_MSG_STATUS_READ) { - close(); - } - } -} - -void ForumMsgItem::setAsRead() -{ - if (canReply) { - uint32_t status; - rsForums->getMessageStatus(mForumId, mPostId, status); - - /* set always to read ... */ - uint32_t statusNew = status | FORUM_MSG_STATUS_READ; - -// bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate(); -// if (setToReadOnActive) { - /* ... and to read by user */ - statusNew &= ~FORUM_MSG_STATUS_UNREAD_BY_USER; -// } else { -// /* ... and to unread by user */ -// statusNew |= FORUM_MSG_STATUS_UNREAD_BY_USER; -// } - - if (status != statusNew) { - disconnect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int))); - rsForums->setMessageStatus(mForumId, mPostId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER); - connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); - } - } -} diff --git a/retroshare-gui/src/gui/feeds/ForumMsgItem.h b/retroshare-gui/src/gui/feeds/ForumMsgItem.h deleted file mode 100644 index 74acfa5d9..000000000 --- a/retroshare-gui/src/gui/feeds/ForumMsgItem.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _FORUM_MSG_ITEM_DIALOG_H -#define _FORUM_MSG_ITEM_DIALOG_H - -#include "ui_ForumMsgItem.h" - -class FeedHolder; - -#include -class ForumMsgItem : public QWidget, private Ui::ForumMsgItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome); - - void updateItemStatic(); - -private slots: - /* default stuff */ - void removeItem(); - void toggle(); - - void readAndClearItem(); - void unsubscribeForum(); - void subscribeForum(); - void replyToPost(); - void sendMsg(); - - void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status); - - void updateItem(); - -private: - void setAsRead(); - - FeedHolder *mParent; - uint32_t mFeedId; - bool canReply; - - std::string mForumId; - std::string mPostId; - bool mIsHome; - bool mIsTop; -}; - -#endif - diff --git a/retroshare-gui/src/gui/feeds/ForumMsgItem.ui b/retroshare-gui/src/gui/feeds/ForumMsgItem.ui deleted file mode 100644 index 46494cae1..000000000 --- a/retroshare-gui/src/gui/feeds/ForumMsgItem.ui +++ /dev/null @@ -1,664 +0,0 @@ - - - ForumMsgItem - - - - 0 - 0 - 577 - 387 - - - - - 0 - - - - - - 0 - 0 - - - - - - - - - 215 - 215 - 215 - - - - - - - - - 215 - 215 - 215 - - - - - - - - - 215 - 215 - 215 - - - - - - - - true - - - QFrame::Box - - - QFrame::Sunken - - - - - - - - - 48 - 48 - - - - - 48 - 48 - - - - :/images/konversation.png - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 9 - 75 - false - true - - - - Forum Name - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - - Qt::Horizontal - - - - 358 - 20 - - - - - - - - - 9 - 75 - true - - - - Timestamp - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::Horizontal - - - - 518 - 20 - - - - - - - - - - - - - 75 - true - - - - Subject: - - - - - - - Subject... - - - false - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 10 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Unsubscribe To Forum - - - - :/images/mail_delete.png:/images/mail_delete.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Reply - - - - :/images/replymail24.png:/images/replymail24.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Expand - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Set as read and remove item - - - - :/images/cancel.png:/images/cancel.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Remove Item - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - - - - 32 - 32 - - - - - 32 - 32 - - - - - - - - - 75 - true - - - - Friend Name - - - true - - - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Subject: - - - - - - - - 0 - 0 - - - - Message is about ??? - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 9 - - - - - - - - - - - 0 - 0 - - - - Previous Message... - - - true - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - - - - 32 - 32 - - - - - 32 - 32 - - - - - - - - - 75 - true - - - - Next Name - - - true - - - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Subject: - - - - - - - - 0 - 0 - - - - Message is about ??? - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - Qt::Vertical - - - - 20 - 27 - - - - - - - - - - - 0 - 0 - - - - Current Message.. - - - true - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - - - - 16777215 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 2 - - - - - - - - Send - - - - - - - Signed - - - - - - - - - - - - - AvatarWidget - QLabel -
gui/common/AvatarWidget.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.cpp b/retroshare-gui/src/gui/feeds/ForumNewItem.cpp deleted file mode 100644 index 87534b34a..000000000 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "ForumNewItem.h" -#include "FeedHolder.h" - -#include -#include "gui/forums/CreateForumMsg.h" -#include "gui/RetroShareLink.h" - -/**** - * #define DEBUG_ITEM 1 - ****/ - -/** Constructor */ -ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mForumId(forumId), mIsHome(isHome), mIsNew(isNew) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - - /* specific ones */ - connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeForum ( void ) ) ); - // To Cheeky to post on a brand new forum.... - connect( postButton, SIGNAL( clicked( void ) ), this, SLOT( postToForum ( void ) ) ); - - expandFrame->hide(); - updateItemStatic(); - updateItem(); -} - - -void ForumNewItem::updateItemStatic() -{ - if (!rsForums) - return; - - - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ForumNewItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - ForumInfo fi; - if (rsForums->getForumInfo(mForumId, fi)) - { - RetroShareLink link; - link.createForum(fi.forumId, ""); - nameLabel->setText(link.toHtml()); - - descLabel->setText(QString::fromStdWString(fi.forumDesc)); - - if (fi.subscribeFlags & RS_DISTRIB_SUBSCRIBED) - { - subscribeButton->setEnabled(false); - postButton->setEnabled(true); - } - else - { - subscribeButton->setEnabled(true); - postButton->setEnabled(false); - } - - /* should also check the other flags */ - } - else - { - nameLabel->setText(tr("Unknown Forum")); - titleLabel->setText(tr("New Forum")); - descLabel->setText(""); - } - - if (mIsNew) - { - titleLabel->setText(tr("New Forum")); - } - else - { - titleLabel->setText(tr("Updated Forum")); - } - - if (mIsHome) - { - /* disable buttons */ - clearButton->setEnabled(false); - } -} - - -void ForumNewItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ForumNewItem::updateItem()"; - std::cerr << std::endl; -#endif - -} - -void ForumNewItem::toggle() -{ - mParent->lockLayout(this, true); - - if (expandFrame->isHidden()) - { - expandFrame->show(); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - } - else - { - expandFrame->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } - - mParent->lockLayout(this, false); -} - -void ForumNewItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumNewItem::removeItem()"; - std::cerr << std::endl; -#endif - - mParent->lockLayout(this, true); - hide(); - mParent->lockLayout(this, false); - - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - - -/*********** SPECIFIC FUNCTIOSN ***********************/ - - -void ForumNewItem::unsubscribeForum() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumNewItem::unsubscribeForum()"; - std::cerr << std::endl; -#endif - if (rsForums) - { - rsForums->forumSubscribe(mForumId, false); - } - updateItemStatic(); -} - - -void ForumNewItem::subscribeForum() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumNewItem::subscribeForum()"; - std::cerr << std::endl; -#endif - if (rsForums) - { - rsForums->forumSubscribe(mForumId, true); - } - updateItemStatic(); -} - -void ForumNewItem::postToForum() -{ -#ifdef DEBUG_ITEM - std::cerr << "ForumNewItem::subscribeForum()"; - std::cerr << std::endl; -#endif - if (mParent) - { - //mParent->openMsg(FEEDHOLDER_MSG_FORUM, mForumId, ""); - CreateForumMsg *cfm = new CreateForumMsg(mForumId, ""); - cfm->show(); - } -} diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.h b/retroshare-gui/src/gui/feeds/ForumNewItem.h deleted file mode 100644 index 88e64c20e..000000000 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _FORUM_NEW_ITEM_DIALOG_H -#define _FORUM_NEW_ITEM_DIALOG_H - -#include "ui_ForumNewItem.h" -#include - -class FeedHolder; - -class ForumNewItem : public QWidget, private Ui::ForumNewItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew); - - void updateItemStatic(); - -private slots: - /* default stuff */ - void removeItem(); - void toggle(); - - void unsubscribeForum(); - void subscribeForum(); - void postToForum(); - - void updateItem(); - -private: - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mForumId; - bool mIsHome; - bool mIsNew; -}; - -#endif - diff --git a/retroshare-gui/src/gui/feeds/ForumNewItem.ui b/retroshare-gui/src/gui/feeds/ForumNewItem.ui deleted file mode 100644 index 87983df57..000000000 --- a/retroshare-gui/src/gui/feeds/ForumNewItem.ui +++ /dev/null @@ -1,325 +0,0 @@ - - - ForumNewItem - - - - 0 - 0 - 618 - 117 - - - - - 0 - - - - - - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 215 - 215 - 215 - - - - - - - - - 255 - 255 - 255 - - - - - - - 215 - 215 - 215 - - - - - - - - - 215 - 215 - 215 - - - - - - - 215 - 215 - 215 - - - - - - - - true - - - QFrame::Box - - - QFrame::Sunken - - - - 9 - - - 6 - - - 6 - - - - - - - - - - :/images/konversation.png - - - - - - - - 0 - 0 - - - - - 75 - true - true - - - - Forum - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - name - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 500 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Subscribe to Forum - - - - :/images/directoryadd_24x24_shadow.png:/images/directoryadd_24x24_shadow.png - - - - - - - Qt::NoFocus - - - - :/images/mail_new.png:/images/mail_new.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Expand - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Remove Item - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - - - - 0 - - - 0 - - - - - Forum Description - - - - - - - - - :/images/contacts24.png - - - - - - - - 0 - 0 - - - - Description - of Forum - - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/forums/CreateForum.cpp b/retroshare-gui/src/gui/forums/CreateForum.cpp deleted file mode 100644 index 08a128fb1..000000000 --- a/retroshare-gui/src/gui/forums/CreateForum.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include - -#include "util/misc.h" -#include "CreateForum.h" -#include "gui/common/PeerDefs.h" - -#include - -#include -#include - -/** Constructor */ -CreateForum::CreateForum() -: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - setAttribute(Qt::WA_DeleteOnClose, true); - - ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png")); - ui.headerFrame->setHeaderText(tr("New Forum")); - - // connect up the buttons. - connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createForum())); - connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) )); - - if (!ui.pubKeyShare_cb->isChecked()) { - ui.contactsdockWidget->hide(); - this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height()); - } - - /* initialize key share list */ - ui.keyShareList->setHeaderText(tr("Contacts:")); - ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK); - ui.keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL); - ui.keyShareList->start(); - - newForum(); -} - -void CreateForum::newForum() -{ - /* enforce Public for the moment */ - ui.typePublic->setChecked(true); - - ui.typePrivate->setEnabled(false); - ui.typeEncrypted->setEnabled(true); - -#ifdef RS_RELEASE_VERSION - ui.typePrivate->setVisible(false); - ui.typeEncrypted->setVisible(true); -#endif - - ui.msgAnon->setChecked(true); - //ui.msgAuth->setEnabled(false); - - ui.forumName->clear(); - ui.forumDesc->clear(); - - ui.forumName->setFocus(); -} - -void CreateForum::createForum() -{ - QString name = misc::removeNewLine(ui.forumName->text()); - QString desc = ui.forumDesc->toPlainText(); //toHtml(); - uint32_t flags = 0; - - if(name.isEmpty()) { - /* error message */ - QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok); - return; //Don't add a empty name!! - } - - if (ui.typePublic->isChecked()) { - flags |= RS_DISTRIB_PUBLIC; - } else if (ui.typePrivate->isChecked()) { - flags |= RS_DISTRIB_PRIVATE; - } else if (ui.typeEncrypted->isChecked()) { - flags |= RS_DISTRIB_ENCRYPTED; - } - - if (ui.msgAuth->isChecked()) { - flags |= RS_DISTRIB_AUTHEN_REQ; - } else if (ui.msgAnon->isChecked()) { - flags |= RS_DISTRIB_AUTHEN_ANON; - } - - if (rsForums) { - std::string forumId = rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags); - - if (ui.pubKeyShare_cb->isChecked()) { - std::list shareList; - ui.keyShareList->selectedSslIds(shareList, false); - rsForums->forumShareKeys(forumId, shareList); - } - } - - close(); -} - -void CreateForum::setShareList() -{ - if (ui.pubKeyShare_cb->isChecked()){ - this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height()); - ui.contactsdockWidget->show(); - } else { // hide share widget - ui.contactsdockWidget->hide(); - this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height()); - } -} diff --git a/retroshare-gui/src/gui/forums/CreateForum.h b/retroshare-gui/src/gui/forums/CreateForum.h deleted file mode 100644 index c8725e0c7..000000000 --- a/retroshare-gui/src/gui/forums/CreateForum.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - - -#ifndef _CREATE_FORUM_DIALOG_H -#define _CREATE_FORUM_DIALOG_H - -#include "ui_CreateForum.h" - -class CreateForum : public QDialog -{ - Q_OBJECT - -public: - CreateForum(); - - void newForum(); /* cleanup */ - -private slots: - /* actions to take.... */ - void createForum(); - - // set private forum key share list - void setShareList(); - -private: - std::list mShareList; - - QPixmap picture; - - /** Qt Designer generated object */ - Ui::CreateForum ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/forums/CreateForum.ui b/retroshare-gui/src/gui/forums/CreateForum.ui deleted file mode 100644 index edc23fa0d..000000000 --- a/retroshare-gui/src/gui/forums/CreateForum.ui +++ /dev/null @@ -1,314 +0,0 @@ - - - CreateForum - - - - 0 - 0 - 672 - 495 - - - - Create new Forum - - - - :/images/rstray3.png:/images/rstray3.png - - - - 0 - - - 0 - - - - - - - - - - - - - Name - - - - - - - - - - - - true - - - - 0 - 0 - - - - - 300 - 524287 - - - - - 220 - 0 - - - - - 0 - 0 - - - - check peers you would like to share private publish key with - - - false - - - QDockWidget::NoDockWidgetFeatures - - - Share Key With - - - - - 0 - - - 0 - - - - - - 0 - 4 - - - - - 20 - 0 - - - - - 300 - 16777215 - - - - - 220 - 0 - - - - - 200 - 0 - - - - - - - - - - - - - - Description - - - - - - - - - - - - - 0 - 0 - - - - Type: - - - - 6 - - - - - Public - Anyone can read and publish (Shared Publish Key) - - - - - - - Restricted - Anyone can read, limited publishing (Private Publish Key) - - - - - - - Private - (Private Publish Key required to view Messages) - - - - - - - - - - Key Sharing - - - - 0 - - - 6 - - - - - Key recipients can publish to restricted-type channels, and can view and publish for private-type channels - - - Share Private Publish Key - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Allowed Messages - - - - 0 - - - 6 - - - - - Authenticated Messages - - - - - - - Anonymous Messages - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - - - HeaderFrame - QFrame -
gui/common/HeaderFrame.h
- 1 -
- - FriendSelectionWidget - QWidget -
gui/common/FriendSelectionWidget.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp deleted file mode 100644 index d4cda839c..000000000 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "CreateForumMsg.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "gui/settings/rsharesettings.h" -#include "gui/RetroShareLink.h" -#include "gui/common/Emoticons.h" - -#include "util/HandleRichText.h" -#include "util/misc.h" - -#include - - -/** Constructor */ -CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId) -: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - setAttribute(Qt::WA_DeleteOnClose, true); - - QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message"); - setWindowTitle(text); - - ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png")); - ui.headerFrame->setHeaderText(text); - - Settings->loadWidgetInformation(this); - - connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) ); - - connect(ui.hashBox, SIGNAL(fileHashingFinished(QList)), this, SLOT(fileHashingFinished(QList))); - - // connect up the buttons. - connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg())); - connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); - connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); - connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); - - setAcceptDrops(true); - ui.hashBox->setDropWidget(this); - ui.hashBox->setAutoHide(false); - - newMsg(); -} - -/** context menu searchTablewidget2 **/ -void CreateForumMsg::forumMessageCostumPopupMenu(QPoint point) -{ - QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point); - - contextMnu->addSeparator(); - QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); - QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull())); - contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink())); - - if (RSLinkClipboard::empty()) { - pasteLinkAct->setDisabled (true); - pasteLinkFullAct->setDisabled (true); - } - - contextMnu->exec(QCursor::pos()); - delete(contextMnu); -} - -void CreateForumMsg::newMsg() -{ - /* clear all */ - ForumInfo fi; - if (rsForums->getForumInfo(mForumId, fi)) - { - ForumMsgInfo msg; - - QString name = QString::fromStdWString(fi.forumName); - QString subj; - if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg))) - { - QString title = QString::fromStdWString(msg.title); - name += " " + tr("In Reply to") + ": "; - name += title; - - QString text = title; - - if (text.startsWith("Re:", Qt::CaseInsensitive)) - { - subj = title; - } - else - { - subj = "Re: " + title; - } - - } - - ui.forumName->setText(misc::removeNewLine(name)); - ui.forumSubject->setText(misc::removeNewLine(subj)); - - if (!ui.forumSubject->text().isEmpty()) - { - ui.forumMessage->setFocus(); - } - else - { - ui.forumSubject->setFocus(); - } - - if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) - { - ui.signBox->setChecked(true); - ui.signBox->setEnabled(false); - } - else - { - /* Uncheck sign box by default for anonymous forums */ - ui.signBox->setChecked(false); - ui.signBox->setEnabled(true); - } - } - - ui.forumMessage->setText(""); -} - -void CreateForumMsg::createMsg() -{ - QString name = misc::removeNewLine(ui.forumSubject->text()); - QString desc; - - RsHtml::optimizeHtml(ui.forumMessage, desc); - - if(name.isEmpty()) - { /* error message */ - QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"), - QMessageBox::Ok, QMessageBox::Ok); - - return; //Don't add a empty Subject!! - } - - ForumMsgInfo msgInfo; - - msgInfo.forumId = mForumId; - msgInfo.threadId = ""; - msgInfo.parentId = mParentId; - msgInfo.msgId = ""; - - msgInfo.title = name.toStdWString(); - msgInfo.msg = desc.toStdWString(); - msgInfo.msgflags = 0; - - if (ui.signBox->isChecked()) - { - msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ; - } - - if ((msgInfo.msg == L"") && (msgInfo.title == L"")) - return; /* do nothing */ - - if (rsForums->ForumMessageSend(msgInfo) == true) { - close(); - } -} - -void CreateForumMsg::closeEvent (QCloseEvent * /*event*/) -{ - Settings->saveWidgetInformation(this); -} - -void CreateForumMsg::smileyWidgetForums() -{ - Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false); -} - -void CreateForumMsg::addSmileys() -{ - ui.forumMessage->textCursor().insertText(qobject_cast(sender())->toolTip().split("|").first()); -} - -void CreateForumMsg::addFile() -{ - QStringList files; - if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) { - ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING); - } -} - -void CreateForumMsg::fileHashingFinished(QList hashedFiles) -{ - std::cerr << "CreateForumMsg::fileHashingFinished() started." << std::endl; - - QString mesgString; - - QList::iterator it; - for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) { - HashedFile& hashedFile = *it; - RetroShareLink link; - if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) { - mesgString += link.toHtmlSize() + "
"; - } - } - -#ifdef CHAT_DEBUG - std::cerr << "CreateForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl; -#endif - - if (!mesgString.isEmpty()) { - ui.forumMessage->textCursor().insertHtml(mesgString); - } - - ui.forumMessage->setFocus( Qt::OtherFocusReason ); -} - -void CreateForumMsg::pasteLink() -{ - ui.forumMessage->insertHtml(RSLinkClipboard::toHtml()) ; -} - -void CreateForumMsg::pasteLinkFull() -{ - ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ; -} - -void CreateForumMsg::pasteOwnCertificateLink() -{ - RetroShareLink link ; - std::string ownId = rsPeers->getOwnId() ; - if( link.createCertificate(ownId) ) { - ui.forumMessage->insertHtml(link.toHtml() + " "); - } -} diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.h b/retroshare-gui/src/gui/forums/CreateForumMsg.h deleted file mode 100644 index 1ff855b5a..000000000 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - - -#ifndef _CREATE_FORUM_MSG_DIALOG_H -#define _CREATE_FORUM_MSG_DIALOG_H - -#include "ui_CreateForumMsg.h" - -class CreateForumMsg : public QDialog -{ - Q_OBJECT - -public: - CreateForumMsg(const std::string &fId, const std::string &pId); - - void newMsg(); /* cleanup */ - -private slots: - /** Create the context popup menu and it's submenus */ - void forumMessageCostumPopupMenu( QPoint point ); - - void fileHashingFinished(QList hashedFiles); - /* actions to take.... */ - void createMsg(); - void pasteLink(); - void pasteLinkFull(); - void pasteOwnCertificateLink(); - - void smileyWidgetForums(); - void addSmileys(); - void addFile(); - -protected: - void closeEvent (QCloseEvent * event); - -private: - std::string mForumId; - std::string mParentId; - - /** Qt Designer generated object */ - Ui::CreateForumMsg ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.ui b/retroshare-gui/src/gui/forums/CreateForumMsg.ui deleted file mode 100644 index 80206caad..000000000 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.ui +++ /dev/null @@ -1,282 +0,0 @@ - - - CreateForumMsg - - - - 0 - 0 - 482 - 448 - - - - Post Forum Message - - - - :/images/rstray3.png:/images/rstray3.png - - - - 0 - - - 0 - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - - - Forum - - - - - - - false - - - - - - - Subject - - - - - - - - - - - - - - 16777215 - 38 - - - - QFrame::Box - - - QFrame::Sunken - - - - 6 - - - - - Qt::NoFocus - - - Attach File - - - - - - - :/images/add-share24.png:/images/add-share24.png - - - - 24 - 24 - - - - true - - - - - - - Qt::NoFocus - - - - - - - :/images/emoticons/kopete/kopete020.png:/images/emoticons/kopete/kopete020.png - - - - 24 - 24 - - - - true - - - - - - - Qt::NoFocus - - - Sign Message - - - - :/images/pgp.png:/images/pgp.png - - - - 24 - 24 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 15 - - - - - - - - Qt::NoFocus - - - Paste RetroShare Link - - - - - - - :/images/pasterslink.png:/images/pasterslink.png - - - true - - - - - - - - - - Forum Post - - - - - - Qt::CustomContextMenu - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p></body></html> - - - - - - - - - - Attach files via drag and drop - - - - - - - 0 - 0 - - - - You can attach files via drag and drop here in this window - - - true - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - HeaderFrame - QFrame -
gui/common/HeaderFrame.h
- 1 -
- - HashBox - QScrollArea -
gui/common/HashBox.h
- 1 -
-
- - - - -
diff --git a/retroshare-gui/src/gui/forums/EditForumDetails.cpp b/retroshare-gui/src/gui/forums/EditForumDetails.cpp deleted file mode 100644 index 048db0ffa..000000000 --- a/retroshare-gui/src/gui/forums/EditForumDetails.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2010 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "EditForumDetails.h" - -#include - -#include "util/misc.h" - -#include -#include -#include - - -/** Default constructor */ -EditForumDetails::EditForumDetails(std::string forumId, QWidget *parent) - : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), m_forumId(forumId) -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyDialog())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - - loadForum(); -} - -void EditForumDetails::loadForum() -{ - if (!rsForums) { - return; - } - - ForumInfo info; - rsForums->getForumInfo(m_forumId, info); - - // set name - ui.nameline->setText(QString::fromStdWString(info.forumName)); - - // set description - ui.DescriptiontextEdit->setText(QString::fromStdWString(info.forumDesc)); -} - -void EditForumDetails::applyDialog() -{ - if (!rsForums) { - return; - } - - // if text boxes have not been edited leave alone - if (!ui.nameline->isModified() && !ui.DescriptiontextEdit->document()->isModified()) { - return; - } - - ForumInfo info; - - info.forumName = misc::removeNewLine(ui.nameline->text()).toStdWString(); - info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString(); - - rsForums->setForumInfo(m_forumId, info); - - /* close the Dialog after the Changes applied */ - close(); -} diff --git a/retroshare-gui/src/gui/forums/EditForumDetails.h b/retroshare-gui/src/gui/forums/EditForumDetails.h deleted file mode 100644 index 28ae8d69b..000000000 --- a/retroshare-gui/src/gui/forums/EditForumDetails.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2010 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _EDITFORUMDETAILS_H -#define _EDITFORUMDETAILS_H - -#include - -#include "ui_EditForumDetails.h" - -class EditForumDetails : public QDialog -{ - Q_OBJECT - -public: - /** Default constructor */ - EditForumDetails(std::string forumId = "", QWidget *parent = 0); - -signals: - void configChanged(); - -private slots: - void applyDialog(); - -private: - void loadForum(); - - std::string m_forumId; - - /** Qt Designer generated object */ - Ui::EditForumDetails ui; -}; - -#endif - diff --git a/retroshare-gui/src/gui/forums/EditForumDetails.ui b/retroshare-gui/src/gui/forums/EditForumDetails.ui deleted file mode 100644 index e7a1f0c79..000000000 --- a/retroshare-gui/src/gui/forums/EditForumDetails.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - EditForumDetails - - - - 0 - 0 - 436 - 355 - - - - Forum Details - - - - :/images/rstray3.png:/images/rstray3.png - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - 0 - - - - - :/images/info16.png:/images/info16.png - - - Edit Forum Details - - - - - - Forum Info - - - - - - Forum Name - - - - - - - - - - Forum Description - - - - - - - - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/forums/ForumDetails.cpp b/retroshare-gui/src/gui/forums/ForumDetails.cpp deleted file mode 100644 index 9846b073d..000000000 --- a/retroshare-gui/src/gui/forums/ForumDetails.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2009 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ -#include "ForumDetails.h" -#include "util/DateTime.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -/** Default constructor */ -ForumDetails::ForumDetails(QWidget *parent) - : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); - - ui.nameline ->setReadOnly(true); - ui.popline ->setReadOnly(true); - ui.postline ->setReadOnly(true); - ui.IDline ->setReadOnly(true); - ui.DescriptiontextEdit ->setReadOnly(true); - - ui.radioButton_authd->setEnabled(false); - ui.radioButton_anonymous->setEnabled(false); -} - - -/** - Overloads the default show() slot so we can set opacity*/ - -void -ForumDetails::show() -{ - //loadSettings(); - if(!this->isVisible()) { - QDialog::show(); - - } -} - -void ForumDetails::showDetails(std::string mCurrForumId) -{ - fId = mCurrForumId; - loadDialog(); -} - -void ForumDetails::loadDialog() -{ - if (!rsForums) - { - return; - } - - ForumInfo fi; - rsForums->getForumInfo(fId, fi); - - // Set Forum Name - ui.nameline->setText(QString::fromStdWString(fi.forumName)); - - // Set Popularity - ui.popline->setText(QString::number(fi.pop)); - - // Set Last Post Date - if (fi.lastPost) { - ui.postline->setText(DateTime::formatLongDateTime(fi.lastPost)); - } - - // Set Forum ID - ui.IDline->setText(QString::fromStdString(fi.forumId)); - - // Set Forum Description - ui.DescriptiontextEdit->setText(QString::fromStdWString(fi.forumDesc)); - - if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) - { - ui.radioButton_authd->setChecked(true); - ui.radioButton_anonymous->setChecked(false); - } - if (fi.forumFlags & RS_DISTRIB_AUTHEN_ANON) - { - ui.radioButton_authd->setChecked(false); - ui.radioButton_anonymous->setChecked(true); - } -} diff --git a/retroshare-gui/src/gui/forums/ForumDetails.h b/retroshare-gui/src/gui/forums/ForumDetails.h deleted file mode 100644 index 659bda8a8..000000000 --- a/retroshare-gui/src/gui/forums/ForumDetails.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2009 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _FORUMDETAILS_H -#define _FORUMDETAILS_H - -#include - -#include "ui_ForumDetails.h" - -class ForumDetails : public QDialog -{ - Q_OBJECT - - public: - - /** Default constructor */ - ForumDetails(QWidget *parent = 0); - - void showDetails(std::string mCurrForumId); - -signals: - void configChanged() ; - -public slots: - /** Overloaded QWidget.show */ - void show(); - -private: - void loadDialog(); - - std::string fId; - /** Qt Designer generated object */ - Ui::ForumDetails ui; - -}; - -#endif - diff --git a/retroshare-gui/src/gui/forums/ForumDetails.ui b/retroshare-gui/src/gui/forums/ForumDetails.ui deleted file mode 100644 index 295f16028..000000000 --- a/retroshare-gui/src/gui/forums/ForumDetails.ui +++ /dev/null @@ -1,175 +0,0 @@ - - - ForumDetails - - - - 0 - 0 - 436 - 355 - - - - Forum Details - - - - :/images/rstray3.png:/images/rstray3.png - - - - - - 0 - - - - - :/images/info16.png:/images/info16.png - - - Forum Details - - - - - - Forum Info - - - - - - Forum Name - - - - - - - - - - Popularity - - - - - - - true - - - - - - - Last Post - - - - - - - true - - - - - - - Forum ID - - - - - - - - - - Forum Description - - - - - - - - - - - - - - - - - :/images/encrypted22.png:/images/encrypted22.png - - - Security - - - - - - Allowed Messages - - - - - - Authenticated Messages - - - - - - - Anonymous Messages - - - true - - - - - - - - - - Qt::Vertical - - - - 358 - 172 - - - - - - - - - - - - - - QDialogButtonBox::Close - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/forums/ForumUserNotify.cpp b/retroshare-gui/src/gui/forums/ForumUserNotify.cpp deleted file mode 100644 index fa1da8831..000000000 --- a/retroshare-gui/src/gui/forums/ForumUserNotify.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2012 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "ForumUserNotify.h" -#include "gui/settings/rsharesettings.h" -#include "gui/notifyqt.h" -#include "gui/MainWindow.h" - -#include - -ForumUserNotify::ForumUserNotify(QObject *parent) : - UserNotify(parent) -{ - connect(NotifyQt::getInstance(), SIGNAL(forumsChanged()), this, SLOT(updateIcon()), Qt::QueuedConnection); -} - -bool ForumUserNotify::hasSetting(QString &name) -{ - name = tr("Forum Post"); - - return true; -} - -bool ForumUserNotify::notifyEnabled() -{ - return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS); -} - -bool ForumUserNotify::notifyCombined() -{ - return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS_COMBINED); -} - -bool ForumUserNotify::notifyBlink() -{ - return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_FORUMS); -} - -void ForumUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink) -{ - uint notifyFlags = Settings->getTrayNotifyFlags(); - uint blinkFlags = Settings->getTrayNotifyBlinkFlags(); - - if (enabled) { - notifyFlags |= TRAYNOTIFY_FORUMS; - } else { - notifyFlags &= ~TRAYNOTIFY_FORUMS; - } - - if (combined) { - notifyFlags |= TRAYNOTIFY_FORUMS_COMBINED; - } else { - notifyFlags &= ~TRAYNOTIFY_FORUMS_COMBINED; - } - - if (blink) { - blinkFlags |= TRAYNOTIFY_BLINK_FORUMS; - } else { - blinkFlags &= ~TRAYNOTIFY_BLINK_FORUMS; - } - - Settings->setTrayNotifyFlags(notifyFlags); - Settings->setTrayNotifyBlinkFlags(blinkFlags); -} - -QIcon ForumUserNotify::getIcon() -{ - return QIcon(":/images/konversation16.png"); -} - -QIcon ForumUserNotify::getMainIcon(bool hasNew) -{ - return hasNew ? QIcon(":/images/forums_new.png") : QIcon(":/images/konversation.png"); -} - -unsigned int ForumUserNotify::getNewCount() -{ - unsigned int newMessageCount = 0; - unsigned int unreadMessageCount = 0; - rsForums->getMessageCount("", newMessageCount, unreadMessageCount); - - return newMessageCount; -} - -void ForumUserNotify::iconClicked() -{ - MainWindow::showWindow(MainWindow::Forums); -} diff --git a/retroshare-gui/src/gui/forums/ForumUserNotify.h b/retroshare-gui/src/gui/forums/ForumUserNotify.h deleted file mode 100644 index 8451bd0b0..000000000 --- a/retroshare-gui/src/gui/forums/ForumUserNotify.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2012 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef FORUMUSERNOTIFY_H -#define FORUMUSERNOTIFY_H - -#include "gui/common/UserNotify.h" - -class ForumUserNotify : public UserNotify -{ - Q_OBJECT - -public: - ForumUserNotify(QObject *parent = 0); - - virtual bool hasSetting(QString &name); - virtual bool notifyEnabled(); - virtual bool notifyCombined(); - virtual bool notifyBlink(); - virtual void setNotifyEnabled(bool enabled, bool combined, bool blink); - -private: - virtual QIcon getIcon(); - virtual QIcon getMainIcon(bool hasNew); - virtual unsigned int getNewCount(); - virtual void iconClicked(); -}; - -#endif // FORUMUSERNOTIFY_H diff --git a/retroshare-gui/src/gui/settings/ForumPage.cpp b/retroshare-gui/src/gui/settings/ForumPage.cpp deleted file mode 100644 index c877178d0..000000000 --- a/retroshare-gui/src/gui/settings/ForumPage.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "ForumPage.h" -#include "rshare.h" -#include "rsharesettings.h" - -#include "../MainWindow.h" -#include "../ForumsDialog.h" - -ForumPage::ForumPage(QWidget * parent, Qt::WFlags flags) - : ConfigPage(parent, flags) -{ - ui.setupUi(this); - setAttribute(Qt::WA_QuitOnClose, false); -} - -ForumPage::~ForumPage() -{ -} - -/** Saves the changes on this page */ -bool -ForumPage::save(QString &/*errmsg*/) -{ - Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); - Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked()); - Settings->setForumOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked()); - - return true; -} - -/** Loads the settings for this page */ -void -ForumPage::load() -{ - ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate()); - ui.expandNewMessages->setChecked(Settings->getForumExpandNewMessages()); - ui.openAllInNewTabCheckBox->setChecked(Settings->getForumOpenAllInNewTab()); -} diff --git a/retroshare-gui/src/gui/settings/ForumPage.h b/retroshare-gui/src/gui/settings/ForumPage.h deleted file mode 100644 index 50b4d7102..000000000 --- a/retroshare-gui/src/gui/settings/ForumPage.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006, crypton - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef FORUMPAGE_H -#define FORUMPAGE_H - -#include -#include "ui_ForumPage.h" - -class ForumPage : public ConfigPage -{ - Q_OBJECT - -public: - ForumPage(QWidget * parent = 0, Qt::WFlags flags = 0); - ~ForumPage(); - - /** Saves the changes on this page */ - virtual bool save(QString &errmsg); - /** Loads the settings for this page */ - virtual void load(); - - virtual QPixmap iconPixmap() const { return QPixmap(":/images/konversation.png") ; } - virtual QString pageName() const { return tr("Forum") ; } - -private: - Ui::ForumPage ui; -}; - -#endif // !FORUMPAGE_H - diff --git a/retroshare-gui/src/gui/settings/ForumPage.ui b/retroshare-gui/src/gui/settings/ForumPage.ui deleted file mode 100644 index 30ed15f11..000000000 --- a/retroshare-gui/src/gui/settings/ForumPage.ui +++ /dev/null @@ -1,70 +0,0 @@ - - - ForumPage - - - - 0 - 0 - 423 - 340 - - - - - - - Misc - - - - - - Set message to read on activate - - - - - - - Expand new messages - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - New forum - - - - - - Open all forums in new tab - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp index bafa327a8..bbfeb00c1 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.cpp +++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp @@ -110,12 +110,14 @@ uint NotifyPage::getNewsFlags() if (ui.notify_Peers->isChecked()) newsFlags |= RS_FEED_TYPE_PEER; +#if 0 if (ui.notify_Channels->isChecked()) newsFlags |= RS_FEED_TYPE_CHAN; if (ui.notify_Forums->isChecked()) newsFlags |= RS_FEED_TYPE_FORUM; if (ui.notify_Blogs->isChecked()) newsFlags |= RS_FEED_TYPE_BLOG; +#endif if (ui.notify_Messages->isChecked()) newsFlags |= RS_FEED_TYPE_MSG; if (ui.notify_Chat->isChecked()) @@ -210,9 +212,11 @@ void NotifyPage::load() ui.popup_ConnectAttempt->setChecked(notifyflags & RS_POPUP_CONNECT_ATTEMPT); ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER); +#if 0 ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN); ui.notify_Forums->setChecked(newsflags & RS_FEED_TYPE_FORUM); ui.notify_Blogs->setChecked(newsflags & RS_FEED_TYPE_BLOG); +#endif ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT); ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG); ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT); diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 73bb152c3..005e4137b 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -112,7 +112,7 @@ void ServerPage::toggleIpDetermination(bool b) void ServerPage::toggleTunnelConnection(bool b) { std::cerr << "ServerPage::toggleTunnelConnection() set tunnel to : " << b << std::endl; - rsPeers->allowTunnelConnection(b) ; + //rsPeers->allowTunnelConnection(b) ; } /** Saves the changes on this page */ diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index c1daa9027..47ff19a33 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -36,7 +36,7 @@ #include "RelayPage.h" #include "ChatPage.h" #include "MessagePage.h" -#include "ForumPage.h" +//#include "ForumPage.h" #include "PluginsPage.h" #include "rsharesettings.h" #include "gui/notifyqt.h" @@ -127,7 +127,7 @@ RSettingsWin::initStackedWidget() addPage(new NotifyPage()); addPage(new CryptoPage()); addPage(new MessagePage()); - addPage(new ForumPage()); + //addPage(new ForumPage()); addPage(new ChatPage()); addPage(new AppearancePage()); addPage(new SoundPage() ); diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index c596ec2af..d6d71c4f0 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -123,8 +123,8 @@ void RshareSettings::initSettings() uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG); - uint defNewsFeed = (RS_FEED_TYPE_PEER | RS_FEED_TYPE_CHAN | - RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG | + uint defNewsFeed = (RS_FEED_TYPE_PEER | +// RS_FEED_TYPE_CHAN | RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG | RS_FEED_TYPE_CHAT | RS_FEED_TYPE_MSG | RS_FEED_TYPE_FILES | RS_FEED_TYPE_SECURITY); diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.cpp b/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.cpp deleted file mode 100644 index e698596e2..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2009 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ -#include "BlogDetails.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -/** Default constructor */ -BlogDetails::BlogDetails(QWidget *parent, Qt::WFlags flags) - : QDialog(parent, flags) -{ - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog())); - connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg())); - - ui.applyButton->setToolTip(tr("Close")); - - ui.nameline ->setReadOnly(true); - ui.popline ->setReadOnly(true); - ui.postline ->setReadOnly(true); - ui.IDline ->setReadOnly(true); - ui.DescriptiontextEdit ->setReadOnly(true); - - -} - -/** Overloads the default show() */ -void -BlogDetails::show() -{ - if(!this->isVisible()) { - QDialog::show(); - - } -} - -void BlogDetails::closeEvent (QCloseEvent * event) -{ - QWidget::closeEvent(event); -} - -void BlogDetails::closeinfodlg() -{ - close(); -} - -void BlogDetails::showDetails(std::string mBlogId) -{ - bId = mBlogId; - loadBlog(); -} - -void BlogDetails::loadBlog() -{ - - if (!rsBlogs) - { - return; - } - - std::list channelList; - std::list::iterator it; - - BlogInfo bi; - rsBlogs->getBlogInfo(bId, bi); - - rsBlogs->getBlogList(channelList); - - - for(it = channelList.begin(); it != channelList.end(); it++) - { - - // Set Blog Name - ui.nameline->setText(QString::fromStdWString(bi.blogName)); - - // Set Blog Popularity - { - std::ostringstream out; - out << it->pop; - ui.popline -> setText(QString::fromStdString(out.str())); - } - - // Set Last Blog Post Date - { - QDateTime qtime; - qtime.setTime_t(it->lastPost); - QString timestamp = qtime.toString(Qt::DefaultLocaleShortDate); - ui.postline -> setText(timestamp); - } - - // Set Blog ID - ui.IDline->setText(QString::fromStdString(bi.blogId)); - - // Set Blog Description - ui.DescriptiontextEdit->setText(QString::fromStdWString(bi.blogDesc)); - - - - } - -} - -void BlogDetails::applyDialog() -{ - - /* reload now */ - loadBlog(); - - /* close the Dialog after the Changes applied */ - closeinfodlg(); - -} - - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.h b/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.h deleted file mode 100644 index f0e654d8c..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2009 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _BLOGDETAILS_H -#define _BLOGDETAILS_H - -#include - -#include "ui_BlogDetails.h" - -class BlogDetails : public QDialog -{ - Q_OBJECT - - public: - - /** Default constructor */ - BlogDetails(QWidget *parent = 0, Qt::WFlags flags = 0); - /** Default destructor */ - - void showDetails(std::string mChannelId); - -signals: - void configChanged() ; - -public slots: - /** Overloaded QWidget.show */ - void show(); - -protected: - void closeEvent (QCloseEvent * event); - -private slots: - - void closeinfodlg(); - void applyDialog(); - - -private: - - void loadBlog(); - - std::string bId; - /** Qt Designer generated object */ - Ui::BlogDetails ui; - -}; - -#endif - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.ui b/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.ui deleted file mode 100644 index 2315161fe..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogDetails.ui +++ /dev/null @@ -1,151 +0,0 @@ - - - BlogDetails - - - - 0 - 0 - 436 - 355 - - - - Blog Details - - - - :/images/rstray3.png:/images/rstray3.png - - - - - - 0 - - - - - :/images/info16.png:/images/info16.png - - - Blog Details - - - - - - Blog Info - - - - - - Blog Name - - - - - - - - - - Popularity - - - - - - - true - - - - - - - Last Post - - - - - - - true - - - - - - - Blog ID - - - - - - - - - - Blog Description - - - - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 311 - 20 - - - - - - - - Cancel - - - - - - - OK - - - false - - - true - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.cpp b/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.cpp deleted file mode 100644 index cc7eeb77a..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include -#include - -#include - -#include -#include //to retrieve peer/usrId info - -#include "BlogsDialog.h" - -#include "BlogsMsgItem.h" -#include "CreateBlog.h" -#include "CreateBlogMsg.h" -#include "BlogDetails.h" - -#include "gui/ChanGroupDelegate.h" - -#define BLOG_DEFAULT_IMAGE ":/images/hi64-app-kblogger.png" - -/** Constructor */ -BlogsDialog::BlogsDialog(QWidget *parent) -: MainPage (parent) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - connect(actionCreate_Blog, SIGNAL(triggered()), this, SLOT(createBlog())); - connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg())); - connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) ); - connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeBlog ( void ) ) ); - - connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectBlog(const QModelIndex &))); - connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(toggleSelection(const QModelIndex &))); - connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( blogListCustomPopupMenu( QPoint ) ) ); - - mBlogId = ""; - mPeerId = rsPeers->getOwnId(); // add your id - - model = new QStandardItemModel(0, 2, this); - model->setHeaderData(0, Qt::Horizontal, tr("Name"), Qt::DisplayRole); - model->setHeaderData(1, Qt::Horizontal, tr("ID"), Qt::DisplayRole); - - treeView->setModel(model); - treeView->setEditTriggers(QAbstractItemView::NoEditTriggers); - - treeView->setItemDelegate(new ChanGroupDelegate()); - - // hide header and id column - treeView->setHeaderHidden(true); - treeView->hideColumn(1); - - itemFont = QFont("ARIAL", 10); - itemFont.setBold(true); - - QStandardItem *OwnBlogs = new QStandardItem(tr("My Blogs")); - OwnBlogs->setForeground(QBrush(QColor(79, 79, 79))); - OwnBlogs->setFont(itemFont); - - QStandardItem *SubscribedBlogs = new QStandardItem(tr("Subscribed Blogs")); - SubscribedBlogs->setForeground(QBrush(QColor(79, 79, 79))); - SubscribedBlogs->setFont(itemFont); - - QStandardItem *PopularBlogs = new QStandardItem(tr("Popular Blogs")); - PopularBlogs->setForeground(QBrush(QColor(79, 79, 79))); - PopularBlogs->setFont(itemFont); - - QStandardItem *OtherBlogs = new QStandardItem(tr("Other Blogs")); - OtherBlogs->setForeground(QBrush(QColor(79, 79, 79))); - OtherBlogs->setFont(itemFont); - - model->appendRow(OwnBlogs); - model->appendRow(SubscribedBlogs); - model->appendRow(PopularBlogs); - model->appendRow(OtherBlogs); - - //added from ahead - updateBlogList(); - - mBlogFont = QFont("MS SANS SERIF", 22); - nameLabel->setFont(mBlogFont); - nameLabel->setMinimumWidth(20); - - QMenu *blogmenu = new QMenu(); - blogmenu->addAction(actionCreate_Blog); - blogmenu->addSeparator(); - blogpushButton->setMenu(blogmenu); - - QTimer *timer = new QTimer(this); - timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); - timer->start(1000); -} - -void BlogsDialog::blogListCustomPopupMenu( QPoint point ) -{ - BlogInfo bi; - if (!rsBlogs->getBlogInfo(mBlogId, bi)) - { - return; - } - - QMenu contextMnu( this ); - - QAction *createblogpostAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Blog" ), this ); - connect( createblogpostAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) ); - - QAction *subscribeblogAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Blog" ), this ); - connect( subscribeblogAct , SIGNAL( triggered() ), this, SLOT( subscribeBlog() ) ); - - QAction *unsubscribeblogAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Blog" ), this ); - connect( unsubscribeblogAct , SIGNAL( triggered() ), this, SLOT( unsubscribeBlog() ) ); - - QAction *blogdetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Blog Details" ), this ); - connect( blogdetailsAct , SIGNAL( triggered() ), this, SLOT( showBlogDetails() ) ); - - contextMnu.clear(); - - if (bi.blogFlags & RS_DISTRIB_PUBLISH) - { - contextMnu.addAction( createblogpostAct ); - contextMnu.addSeparator(); - contextMnu.addAction( blogdetailsAct ); - } - else if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED) - { - contextMnu.addAction( unsubscribeblogAct ); - contextMnu.addSeparator(); - contextMnu.addAction( blogdetailsAct );; - } - else - { - contextMnu.addAction( subscribeblogAct ); - contextMnu.addSeparator(); - contextMnu.addAction( blogdetailsAct ); - } - - contextMnu.exec(QCursor::pos()); -} - -void BlogsDialog::createBlog() -{ - CreateBlog cf (this, false); - - cf.setWindowTitle(tr("Create a new Blog")); - cf.exec(); -} - -void BlogsDialog::blogSelection() -{ - /* which item was selected? */ - - - /* update mBlogId */ - - updateBlogMsgs(); -} - - -/*************************************************************************************/ -/*************************************************************************************/ -/*************************************************************************************/ - -void BlogsDialog::deleteFeedItem(QWidget *item, uint32_t type) -{ - return; -} - -void BlogsDialog::openChat(std::string peerId) -{ - return; -} - -void BlogsDialog::createMsg() -{ - if (mBlogId == "") - { - return; - } - - CreateBlogMsg *msgDialog = new CreateBlogMsg(mBlogId); - - msgDialog->show(); - - /* window will destroy itself! */ -} - -void BlogsDialog::selectBlog( std::string bId) -{ - mBlogId = bId; - - updateBlogMsgs(); -} - -void BlogsDialog::selectBlog(const QModelIndex &index) -{ - int row = index.row(); - int col = index.column(); - if (col != 1) { - QModelIndex sibling = index.sibling(row, 1); - if (sibling.isValid()) - mBlogId = sibling.data().toString().toStdString(); - } else - mBlogId = index.data().toString().toStdString(); - updateBlogMsgs(); -} - -void BlogsDialog::checkUpdate() -{ - std::list blogIds; - std::list::iterator it; - if (!rsBlogs) - return; - - if (rsBlogs->blogsChanged(blogIds)) - { - /* update Blogs List */ - updateBlogList(); - - it = std::find(blogIds.begin(), blogIds.end(), mBlogId); - if (it != blogIds.end()) - { - updateBlogMsgs(); - } - } -} - -void BlogsDialog::updateBlogList() -{ - - std::list channelList; - std::list::iterator it; - if (!rsBlogs) - { - return; - } - - rsBlogs->getBlogList(channelList); - - /* get the ids for our lists */ - std::list adminIds; - std::list subIds; - std::list popIds; - std::list otherIds; - std::multimap popMap; - - for(it = channelList.begin(); it != channelList.end(); it++) - { - /* sort it into Publish (Own), Subscribed, Popular and Other */ - uint32_t flags = it->blogFlags; - - if (flags & RS_DISTRIB_ADMIN) - { - adminIds.push_back(it->blogId); - } - else if (flags & RS_DISTRIB_SUBSCRIBED) - { - subIds.push_back(it->blogId); - } - else - { - /* rate the others by popularity */ - popMap.insert(std::make_pair(it->pop, it->blogId)); - } - } - - /* iterate backwards through popMap - take the top 5 or 10% of list */ - uint32_t popCount = 5; - if (popCount < popMap.size() / 10) - { - popCount = popMap.size() / 10; - } - - uint32_t i = 0; - std::multimap::reverse_iterator rit; - for(rit = popMap.rbegin(); rit != popMap.rend(); rit++) - { - if(i < popCount){ - popIds.push_back(rit->second); - i++; - }else{ - otherIds.push_back(rit->second); - } - } - - /* now we have our lists ---> update entries */ - - updateBlogListOwn(adminIds); - updateBlogListSub(subIds); - updateBlogListPop(popIds); - updateBlogListOther(otherIds); -} - -void BlogsDialog::updateBlogListOwn(std::list &ids) -{ - std::list::iterator iit; - - /* remove rows with groups before adding new ones */ - model->item(OWN)->removeRows(0, model->item(OWN)->rowCount()); - - for (iit = ids.begin(); iit != ids.end(); iit ++) { -#ifdef BLOG_DEBUG - std::cerr << "BlogsDialog::updateBlogListOwn(): " << *iit << std::endl; -#endif - QStandardItem *ownGroup = model->item(OWN); - QList blog; - QStandardItem *blogNameitem = new QStandardItem(); - QStandardItem *blogIditem = new QStandardItem(); - - BlogInfo bi; - if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { - blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); - blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" - ).arg(QString::number(bi.pop)).arg(9999).arg(9999)); - } else { - blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); - blogNameitem->setToolTip("Unknown Blog\nNo Description"); - } - - blog.append(blogNameitem); - blog.append(blogIditem); - ownGroup->appendRow(blog); - } -} - -void BlogsDialog::updateBlogListSub(std::list &ids) -{ - std::list::iterator iit; - - /* remove rows with groups before adding new ones */ - model->item(SUBSCRIBED)->removeRows(0, model->item(SUBSCRIBED)->rowCount()); - - for (iit = ids.begin(); iit != ids.end(); iit ++) { -#ifdef BLOG_DEBUG - std::cerr << "BlogsDialog::updateBlogListSub(): " << *iit << std::endl; -#endif - QStandardItem *ownGroup = model->item(SUBSCRIBED); - QList blog; - QStandardItem *blogNameitem = new QStandardItem(); - QStandardItem *blogIditem = new QStandardItem(); - - BlogInfo bi; - if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { - blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); - blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" - ).arg(QString::number(bi.pop)).arg(9999).arg(9999)); - } else { - blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); - blogNameitem->setToolTip("Unknown Blog\nNo Description"); - } - - blog.append(blogNameitem); - blog.append(blogIditem); - ownGroup->appendRow(blog); - } - -} - -void BlogsDialog::updateBlogListPop(std::list &ids) -{ - std::list::iterator iit; - - /* remove rows with groups before adding new ones */ - model->item(POPULAR)->removeRows(0, model->item(POPULAR)->rowCount()); - - for (iit = ids.begin(); iit != ids.end(); iit ++) { -#ifdef BLOG_DEBUG - std::cerr << "BlogsDialog::updateBlogListPop(): " << *iit << std::endl; -#endif - QStandardItem *ownGroup = model->item(POPULAR); - QList blog; - QStandardItem *blogNameitem = new QStandardItem(); - QStandardItem *blogIditem = new QStandardItem(); - - BlogInfo bi; - if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { - blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); - blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" - ).arg(QString::number(bi.pop)).arg(9999).arg(9999)); - } else { - blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); - blogNameitem->setToolTip("Unknown Blog\nNo Description"); - } - - blog.append(blogNameitem); - blog.append(blogIditem); - ownGroup->appendRow(blog); - } -} - -void BlogsDialog::updateBlogListOther(std::list &ids) -{ - std::list::iterator iit; - - /* remove rows with groups before adding new ones */ - model->item(OTHER)->removeRows(0, model->item(OTHER)->rowCount()); - - for (iit = ids.begin(); iit != ids.end(); iit ++) { -#ifdef BLOG_DEBUG - std::cerr << "BlogsDialog::updateBlogListOther(): " << *iit << std::endl; -#endif - QStandardItem *ownGroup = model->item(OTHER); - QList blog; - QStandardItem *blogNameitem = new QStandardItem(); - QStandardItem *blogIditem = new QStandardItem(); - - BlogInfo bi; - if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { - blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); - blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" - ).arg(QString::number(bi.pop)).arg(9999).arg(9999)); - } else { - blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); - blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); - blogNameitem->setToolTip("Unknown Blog\nNo Description"); - } - - blog.append(blogNameitem); - blog.append(blogIditem); - ownGroup->appendRow(blog); - } -} - -void BlogsDialog::updateBlogMsgs() -{ - if (!rsBlogs) - return; - - BlogInfo bi; - if (!rsBlogs->getBlogInfo(mBlogId, bi)) - { - postButton->setEnabled(false); - subscribeButton->setEnabled(false); - unsubscribeButton->setEnabled(false); - nameLabel->setText("No Blog Selected"); - iconLabel->setPixmap(QPixmap(":/images/hi64-app-kblogger.png")); - iconLabel->setEnabled(false); - frame->setStyleSheet("QFrame#frame{ border: 2px solid #808080;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #C0C0C0, stop:1 #A0A0A0); }"); - return; - } - - if(bi.pngImageLen != 0){ - - QPixmap blogImage; - blogImage.loadFromData(bi.pngChanImage, bi.pngImageLen, "PNG"); - iconLabel->setPixmap(blogImage); - iconLabel->setStyleSheet("QLabel{border: 2px solid white;}"); - }else{ - QPixmap defaultImage(BLOG_DEFAULT_IMAGE); - iconLabel->setPixmap(defaultImage); - iconLabel->setStyleSheet("QLabel{border: 2px solid white;border-radius: 10px;}"); - } - - iconLabel->setEnabled(true); - - - /* set textcolor for Blog name */ - QString blogStr("%1"); - - /* set Blog name */ - QString bname = QString::fromStdWString(bi.blogName); - nameLabel->setText(blogStr.arg(bname)); - - /* do buttons */ - if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED) - { - subscribeButton->setEnabled(false); - unsubscribeButton->setEnabled(true); - frame->setStyleSheet("QFrame#frame{ border: 2px solid #FF0000;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #B61407, stop:1 #A91106); }"); - - } - else - { - subscribeButton->setEnabled(true); - unsubscribeButton->setEnabled(false); - frame->setStyleSheet("QFrame#frame{ border: 2px solid #267F00;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #89D51D, stop:1 #579E10); }"); - } - - if (bi.blogFlags & RS_DISTRIB_PUBLISH) - { - postButton->setEnabled(true); - frame->setStyleSheet("QFrame#frame{ border: 2px solid #6ACEFF;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #0076B1, stop:1 #12A3EB); }"); - } - else - { - postButton->setEnabled(false); - } - - /* replace all the messages with new ones */ - std::list::iterator mit; - for(mit = mBlogMsgItems.begin(); mit != mBlogMsgItems.end(); mit++) - { - delete (*mit); - } - mBlogMsgItems.clear(); - - std::list msgs; - std::list::iterator it; - - rsBlogs->getBlogMsgList(mBlogId, msgs); - - for(it = msgs.begin(); it != msgs.end(); it++) - { - BlogsMsgItem *cmi = new BlogsMsgItem(this, 0, mPeerId, mBlogId, it->msgId, true); - - mBlogMsgItems.push_back(cmi); - verticalLayout_2->addWidget(cmi); - } -} - -void BlogsDialog::unsubscribeBlog() -{ -#ifdef BLOG_DEBUG - std::cerr << "BlogsDialog::unsubscribeBlog()"; - std::cerr << std::endl; -#endif - if (rsBlogs) - { - rsBlogs->blogSubscribe(mBlogId, false); - } - updateBlogMsgs(); -} - -void BlogsDialog::subscribeBlog() -{ -#ifdef BLOG_DEBUG - std::cerr << "BlogsDialog::subscribeBlog()"; - std::cerr << std::endl; -#endif - if (rsBlogs) - { - rsBlogs->blogSubscribe(mBlogId, true); - } - updateBlogMsgs(); -} - -void BlogsDialog::toggleSelection(const QModelIndex &index) -{ - QItemSelectionModel *selectionModel = treeView->selectionModel(); - if (index.child(0, 0).isValid()) - selectionModel->select(index, QItemSelectionModel::Toggle); -} - -void BlogsDialog::showBlogDetails() -{ - if (mBlogId == "") - { - return; - } - - if (!rsBlogs) - return; - - BlogDetails *blogui = new BlogDetails(); - - blogui->showDetails(mBlogId); - blogui->show(); - - /* window will destroy itself! */ -} diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.h b/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.h deleted file mode 100644 index 2366d317b..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _BLOGSDIALOG_H -#define _BLOGSDIALOG_H - -#include "gui/mainpage.h" -#include "ui_BlogsDialog.h" - -#include "gui/feeds/FeedHolder.h" - -class QStandardItemModel; - -#define OWN 0 -#define SUBSCRIBED 1 -#define POPULAR 2 -#define OTHER 3 - -class BlogsMsgItem; - - -class BlogsDialog : public MainPage, public FeedHolder, private Ui::BlogsDialog -{ - Q_OBJECT - -public: - /** Default Constructor */ - BlogsDialog(QWidget *parent = 0); - /** Default Destructor */ - - -virtual void deleteFeedItem(QWidget *item, uint32_t type); -virtual void openChat(std::string peerId); - -public slots: - - void selectBlog( std::string ); - void selectBlog(const QModelIndex &); - void toggleSelection(const QModelIndex &); - -private slots: - - void blogListCustomPopupMenu( QPoint point ); - - void checkUpdate(); - - void createBlog(); - //void sendMsg(); - - void blogSelection(); - - void subscribeBlog(); - void unsubscribeBlog(); - - void createMsg(); - - void showBlogDetails(); - -private: - - void updateBlogList(); - void updateBlogListOwn(std::list &ids); - void updateBlogListSub(std::list &ids); - void updateBlogListPop(std::list &ids); - void updateBlogListOther(std::list &ids); - - void updateBlogMsgs(); - - QStandardItemModel *model; - - std::string mBlogId; /* current Blog */ - std::string mPeerId; - - /* Layout Pointers */ - QBoxLayout *mMsgLayout; - - - - std::list mBlogMsgItems; - - QFont mBlogFont; - QFont itemFont; - -}; - - - -#endif - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.ui b/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.ui deleted file mode 100644 index 6d1cc316f..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogsDialog.ui +++ /dev/null @@ -1,568 +0,0 @@ - - - BlogsDialog - - - - 0 - 0 - 681 - 476 - - - - - 0 - 0 - - - - - 0 - 0 - - - - Form - - - - - - - 0 - 0 - - - - - 222 - 0 - - - - - 222 - 16777215 - - - - - 0 - 0 - - - - - 221 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - - 220 - 0 - - - - - 220 - 38 - - - - - 220 - 0 - - - - QFrame#chheaderframe{ -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #FEFEFE, stop:1 #E8E8E8); - -border: 1px solid #CCCCCC;} - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - - - 0 - - - - - - 24 - 24 - - - - - - - :/images/kblogger.png - - - true - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:10pt; font-weight:600;">Blogs</span></p></body></html> - - - - - - - - - Qt::Horizontal - - - - 123 - 13 - - - - - - - - Add - - - QPushButton::menu-indicator { - subcontrol-origin: padding; - subcontrol-position: bottom right; - } - - QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open { - position: relative; - top: 2px; left: 2px; /* shift the arrow by 2 px */ - } - - QPushButton:hover { - border: 1px solid #CCCCCC; - } - - - - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - 16 - 16 - - - - false - - - true - - - - - - - - 0 - 0 - - - - - 0 - 25 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Post To Blog</span></p></body></html> - - - - - - - - - - :/images/mail_send.png:/images/mail_send.png - - - true - - - - - - - - - - Qt::CustomContextMenu - - - - - - - - - - - - QFrame#frame{ -border: 2px solid #6ACEFF; -border-radius: 10px; -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #0076B1, stop:1 #12A3EB);} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - 16 - - - 9 - - - - - - 64 - 64 - - - - - 64 - 64 - - - - QLabel{ -border: 2px solid white; -border-radius: 10px; -} - - - - - - :/images/hi64-app-kblogger.png - - - false - - - Qt::AlignCenter - - - - - - - - 75 - true - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:14pt; color:#ffffff;">Blog Name</span></p></body></html> - - - true - - - - - - - - - 9 - - - 9 - - - - - - 0 - 0 - - - - - 26 - 26 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Unsubscribe To Blog</span></p></body></html> - - - QToolButton, QPushButton, QComboBox { -border-image: url(:/images/btn_26.png) 4; -border-width: 4; -padding: 0px 6px; -font-size: 12px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { -border-image: url(:/images/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { -color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ -border-image: url(:/images/btn_26_pressed.png) 4; -} - - - Unsubscribe - - - - - - - - 0 - 0 - - - - - 26 - 26 - - - - - 16777215 - 26 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Subscribe To Blog</span></p></body></html> - - - QToolButton, QPushButton, QComboBox { -border-image: url(:/images/btn_26.png) 4; -border-width: 4; -padding: 0px 6px; -font-size: 12px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { -border-image: url(:/images/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { -color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ -border-image: url(:/images/btn_26_pressed.png) 4; -} - - - Subscribe - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - 1 - 0 - - - - - 0 - 0 - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - true - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - 0 - 0 - 429 - 332 - - - - QWidget#scrollAreaWidgetContents{border: none;} - - - - 0 - - - 0 - - - - - - - - Qt::Vertical - - - - 391 - 266 - - - - - - - - - - - - - - - - - - :/images/kblogger.png:/images/kblogger.png - - - Create New Blog - - - Create New Blog - - - - - - - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.cpp b/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.cpp deleted file mode 100644 index beba2bb87..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include - -#include "BlogsMsgItem.h" -#include "gui/feeds/FeedHolder.h" - -#include -#include "rshare.h" - -/**** - * #define DEBUG_ITEM 1 - ****/ - -/** Constructor */ -BlogsMsgItem::BlogsMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string blogId, std::string msgId, bool isHome) -:QWidget(NULL), mParent(parent), mFeedId(feedId), - mPeerId(peerId), mBlogId(blogId), mMsgId(msgId), mIsHome(isHome) -{ - /* Invoke the Qt Designer generated object setup routine */ - setupUi(this); - - /* general ones */ - connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); - connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); - //connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) ); - - /* specific ones */ - //connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) ); - connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) ); - - small(); - updateItemStatic(); - updateItem(); - -} - - -void BlogsMsgItem::updateItemStatic() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::updateItemStatic()"; - std::cerr << std::endl; -#endif - - BlogMsgInfo cmi; - - if (!rsBlogs) - return; - - if (!rsBlogs->getBlogMessage(mBlogId, mMsgId, cmi)) - return; - - QString title; - - if (!mIsHome) - { - BlogInfo ci; - rsBlogs->getBlogInfo(mBlogId, ci); - title = "Channel Feed: "; - title += QString::fromStdWString(ci.blogName); - titleLabel->setText(title); - //subjectLabel->setText(QString::fromStdWString(cmi.subject)); - } - else - { - /* subject */ - titleLabel->setText(QString::fromStdWString(cmi.subject)); - /* Blog Message */ - textBrowser->setHtml( QString::fromStdWString(cmi.msg)); - } - - //msgLabel->setText(QString::fromStdWString(cmi.msg)); - //msgcommentstextEdit->setHtml(QString::fromStdWString(cmi.msg)); - - datetimelabel->setText(Rshare::customDate(cmi.ts)); - - //playButton->setEnabled(false); - - if (mIsHome) - { - /* disable buttons */ - clearButton->setEnabled(false); - //gotoButton->setEnabled(false); - unsubscribeButton->setEnabled(false); - - clearButton->hide(); - } - - /* don't really want this at all! */ - unsubscribeButton->hide(); - //playButton->hide(); -} - - -void BlogsMsgItem::updateItem() -{ - /* fill in */ -#ifdef DEBUG_ITEM - std::cerr << "BlogMsgItem::updateItem()"; - std::cerr << std::endl; -#endif - - -} - - -void BlogsMsgItem::small() -{ - expandFrame->hide(); -} - -void BlogsMsgItem::toggle() -{ - if (expandFrame->isHidden()) - { - expandFrame->show(); - expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); - expandButton->setToolTip(tr("Hide")); - } - else - { - expandFrame->hide(); - expandButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); - expandButton->setToolTip(tr("Expand")); - } -} - - -void BlogsMsgItem::removeItem() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::removeItem()"; - std::cerr << std::endl; -#endif - hide(); - if (mParent) - { - mParent->deleteFeedItem(this, mFeedId); - } -} - - -void BlogsMsgItem::gotoHome() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::gotoHome()"; - std::cerr << std::endl; -#endif -} - -/*********** SPECIFIC FUNCTIOSN ***********************/ - - -void BlogsMsgItem::unsubscribeChannel() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::unsubscribeChannel()"; - std::cerr << std::endl; -#endif -} - - -void BlogsMsgItem::playMedia() -{ -#ifdef DEBUG_ITEM - std::cerr << "ChanMsgItem::playMedia()"; - std::cerr << std::endl; -#endif -} - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.h b/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.h deleted file mode 100644 index ee307daae..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _BLOGS_MSG_ITEM_DIALOG_H -#define _BLOGS_MSG_ITEM_DIALOG_H - -#include "ui_BlogsMsgItem.h" -#include - - -class FeedHolder; -class SubFileItem; - -class BlogsMsgItem : public QWidget, private Ui::BlogsMsgItem -{ - Q_OBJECT - -public: - /** Default Constructor */ - BlogsMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string blogId, std::string msgId, bool isHome); - - /** Default Destructor */ - - void updateItemStatic(); - void small(); - -private slots: - /* default stuff */ - void gotoHome(); - void removeItem(); - void toggle(); - - void playMedia(); - void unsubscribeChannel(); - - void updateItem(); - -private: - FeedHolder *mParent; - uint32_t mFeedId; - - std::string mBlogId; - std::string mMsgId; - std::string mPeerId; - - bool mIsHome; - -}; - - - -#endif - diff --git a/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.ui b/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.ui deleted file mode 100644 index 4972df312..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/BlogsMsgItem.ui +++ /dev/null @@ -1,274 +0,0 @@ - - - BlogsMsgItem - - - - 0 - 0 - 516 - 294 - - - - Form - - - QToolButton, QPushButton, QComboBox { -border-image: url(:/images/btn_26.png) 4; -border-width: 4; -padding: 0px 6px; -font-size: 12px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { -border-image: url(:/images/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { -color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ -border-image: url(:/images/btn_26_pressed.png) 4; -} - - - - 0 - - - 6 - - - - - - 0 - 0 - - - - QFrame#frame{border: 3px solid #407AC1; -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, -stop:0 #FFFFFF, stop:1 #F2F2F2);; -border-radius: 10px;} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 0 - 0 - - - - - 11 - 75 - true - true - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#656565;">Blog Subject</span></p></body></html> - - - - - - - - 75 - true - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">DateTime</span></p></body></html> - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 288 - 21 - - - - - - - - - 0 - 0 - - - - Expand - - - - - - - - - - :/images/edit_add24.png:/images/edit_add24.png - - - - - - - - 0 - 0 - - - - Remove Item - - - - - - - :/images/close_normal.png:/images/close_normal.png - - - - - - - - 0 - 0 - - - - Unsubscribe From Channel - - - - - - - :/images/mail_delete.png:/images/mail_delete.png - - - - - - - - 0 - 0 - - - - QTextBrowser#textBrowser{border: 2px solid #D3D3D3; -background-color: transparent; -border-radius: 10px;} - - - - - - - - - QFrame#expandFrame{border: 2px solid #D3D3D3; -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, -stop:0 #FFFFFF, stop:1 #F2F2F2);; -border-radius: 10px;} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - 0 - - - - Comments here - - - - - - - - - - - 16777215 - 60 - - - - - - - - Qt::Horizontal - - - - 398 - 20 - - - - - - - - Comment - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp deleted file mode 100644 index 3798041af..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include - -#include "CreateBlog.h" -#include "util/misc.h" - -#include - -/** Constructor */ -CreateBlog::CreateBlog(QWidget *parent, bool isForum) -: QDialog(parent), mIsForum(isForum) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - // connect up the buttons. - connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelBlog( ) ) ); - connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createBlog( ) ) ); - connect( ui.LogoButton, SIGNAL(clicked() ), this , SLOT(addBlogLogo())); - connect( ui.blogLogoButton, SIGNAL(clicked() ), this , SLOT(addBlogLogo())); - - newBlog(); - -} - -void CreateBlog::show() -{ - //loadSettings(); - if(!this->isVisible()) { - QWidget::show(); - - } -} - - -void CreateBlog::newBlog() -{ - - if (mIsForum) - { - /* enforce Public for the moment */ - ui.typePublic->setChecked(true); - - ui.typePrivate->setEnabled(false); - ui.typeEncrypted->setEnabled(false); - - ui.msgAnon->setChecked(true); - //ui.msgAuth->setEnabled(false); - } - else - { - /* enforce Private for the moment */ - ui.typePrivate->setChecked(true); - - ui.typePublic->setEnabled(false); - ui.typeEncrypted->setEnabled(false); - - ui.msgAnon->setChecked(true); - ui.msgAuth->setEnabled(false); - ui.msgGroupBox->hide(); - } -} - -void CreateBlog::createBlog() -{ - QString name = ui.forumName->text(); - QString desc = ui.forumDesc->toPlainText(); //toHtml(); - uint32_t flags = 0; - - if(name.isEmpty()) - { /* error message */ - QMessageBox::warning(this, tr("RetroShare"), - tr("Please add a Name"), - QMessageBox::Ok, QMessageBox::Ok); - - return; //Don't add a empty name!! - } - else - - if (ui.typePublic->isChecked()) - { - flags |= RS_DISTRIB_PUBLIC; - } - else if (ui.typePrivate->isChecked()) - { - flags |= RS_DISTRIB_PRIVATE; - } - else if (ui.typeEncrypted->isChecked()) - { - flags |= RS_DISTRIB_ENCRYPTED; - } - - if (ui.msgAuth->isChecked()) - { - flags |= RS_DISTRIB_AUTHEN_REQ; - } - else if (ui.msgAnon->isChecked()) - { - flags |= RS_DISTRIB_AUTHEN_ANON; - } - - QByteArray ba; - QBuffer buffer(&ba); - - if(!picture.isNull()){ - // send chan image - - buffer.open(QIODevice::WriteOnly); - picture.save(&buffer, "PNG"); // writes image into ba in PNG format - } - - if (rsBlogs) - { - rsBlogs->createBlog(name.toStdWString(), desc.toStdWString(), flags, - (unsigned char*) ba.data(), ba.size()); - } - - - close(); - return; -} - -void CreateBlog::addBlogLogo(){ - - QString fileName; - if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg)"), fileName)) - { - picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation); - - // to show the selected - ui.blogLogoButton->setIcon(picture); - - std::cerr << "Sending avatar image down the pipe" << std::endl ; - - // send avatar down the pipe for other peers to get it. - QByteArray ba; - QBuffer buffer(&ba); - buffer.open(QIODevice::WriteOnly); - picture.save(&buffer, "PNG"); // writes image into ba in PNG format - - std::cerr << "Image size = " << ba.size() << std::endl ; - } - -} - -void CreateBlog::cancelBlog() -{ - close(); - return; -} - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h deleted file mode 100644 index 842987053..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CREATE_BLOG_DIALOG_H -#define _CREATE_BLOG_DIALOG_H - -#include "ui_CreateBlog.h" - -class CreateBlog : public QDialog -{ - Q_OBJECT - -public: - CreateBlog(QWidget *parent = 0, bool isForum = true); - -void newBlog(); /* cleanup */ - - /** Qt Designer generated object */ - Ui::CreateBlog ui; - - QPixmap picture; - -public slots: - /** Overloaded QWidget.show */ - void show(); - -private slots: - - /* actions to take.... */ -void createBlog(); -void cancelBlog(); -void addBlogLogo(); - - -private: - - - bool mIsForum; -}; - -#endif - diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui deleted file mode 100644 index 06e3c3f03..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui +++ /dev/null @@ -1,329 +0,0 @@ - - - CreateBlog - - - - 0 - 0 - 534 - 545 - - - - Create new Blog - - - - :/images/rstray3.png:/images/rstray3.png - - - - 0 - - - 0 - - - - - - 16777215 - 64 - - - - QFrame#frame_2{background-image: url(:/images/connect/connectFriendBanner.png);} - - - QFrame::NoFrame - - - QFrame::Raised - - - - 6 - - - 6 - - - - - - 48 - 48 - - - - - - - - - - :/images/hi48-app-kblogger.png - - - true - - - - - - - color: rgb(255, 255, 255); - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;">New Blog</span></p></body></html> - - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - - Name - - - - - - - - - - - - Description - - - - - - - - - - Type: - - - - 0 - - - 6 - - - - - Public - Anyone can read and publish (Shared Publish Key) - - - - - - - Restricted - Anyone can read, limited publishing (Private Publish Key) - - - - - - - Private - (Private Publish Key required to view Messages) - - - - - - - - - - Allowed Messages - - - - 0 - - - 6 - - - - - Authenticated Messages - - - - - - - Anonymous Messages - - - - - - - - - - Blog Logo - - - - 6 - - - 6 - - - 6 - - - 2 - - - 6 - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - -border: 2px solid white; -border-radius: 10px; - - - - - - - - :/images/hi64-app-kblogger.png:/images/hi64-app-kblogger.png - - - - 64 - 64 - - - - - - - - Add Blog Logo - - - - :/images/add_image24.png:/images/add_image24.png - - - - - - - Qt::Horizontal - - - - 118 - 20 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Horizontal - - - - 238 - 20 - - - - - - - - Cancel - - - - - - - Create - - - true - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.cpp b/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.cpp deleted file mode 100644 index 201c0c971..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.cpp +++ /dev/null @@ -1,923 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "CreateBlogMsg.h" -#include "gui/msgs/textformat.h" -#include "util/misc.h" - -#include - -/** Constructor */ -CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags) -: mBlogId(cId), QMainWindow (parent, flags) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - setupFileActions(); - setupEditActions(); - setupViewActions(); - setupInsertActions(); - setupParagraphActions(); - - setAcceptDrops(true); - setStartupText(); - - newBlogMsg(); - - ui.toolBar_2->addAction(ui.actionIncreasefontsize); - ui.toolBar_2->addAction(ui.actionDecreasefontsize); - ui.toolBar_2->addAction(ui.actionBlockquoute); - ui.toolBar_2->addAction(ui.actionOrderedlist); - ui.toolBar_2->addAction(ui.actionUnorderedlist); - ui.toolBar_2->addAction(ui.actionBlockquoute); - ui.toolBar_2->addAction(ui.actionCode); - ui.toolBar_2->addAction(ui.actionsplitPost); - - setupTextActions(); - - connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg())); - connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew())); - - connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease())); - connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease())); - connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote())); - connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode())); - connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter())); - connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList())); - connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList())); - - //connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit())); - connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit())); - - connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), - this, SLOT(currentCharFormatChanged(QTextCharFormat))); - connect( ui.msgEdit, SIGNAL(cursorPositionChanged()), - this, SLOT(cursorPositionChanged())); - - QPalette palette = QApplication::palette(); - codeBackground = palette.color( QPalette::Active, QPalette::Midlight ); - - fontChanged(ui.msgEdit->font()); - colorChanged(ui.msgEdit->textColor()); - alignmentChanged(ui.msgEdit->alignment()); - - connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), - actionSave, SLOT(setEnabled(bool))); - connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), - this, SLOT(setWindowModified(bool))); - connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), - actionUndo, SLOT(setEnabled(bool))); - connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), - ui.actionUndo, SLOT(setEnabled(bool))); - connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)), - actionRedo, SLOT(setEnabled(bool))); - - setWindowModified( ui.msgEdit->document()->isModified()); - actionSave->setEnabled( ui.msgEdit->document()->isModified()); - actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); - ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); - actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable()); - - connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); - connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); - connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo())); - - actionCut->setEnabled(false); - actionCopy->setEnabled(false); - - connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut())); - connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy())); - connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste())); - - connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); - connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); - -#ifndef QT_NO_CLIPBOARD - connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); -#endif - - //defaultCharFormat - defaultCharFormat = ui.msgEdit->currentCharFormat(); - - const QFont defaultFont = ui.msgEdit->document()->defaultFont(); - defaultCharFormat.setFont( defaultFont ); - defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() ); - defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) ); - defaultCharFormat.setBackground( palette.color( QPalette::Active, - QPalette::Base ) ); - defaultCharFormat.setProperty( TextFormat::HasCodeStyle, QVariant( false ) ); - - //defaultBlockFormat - defaultBlockFormat = ui.msgEdit->textCursor().blockFormat(); - -} - - -void CreateBlogMsg::cancelMsg() -{ - std::cerr << "CreateBlogMsg::cancelMsg()"; - std::cerr << std::endl; - close(); - return; -} - -void CreateBlogMsg::newBlogMsg() -{ - - if (!rsBlogs) - return; - - BlogInfo ci; - if (!rsBlogs->getBlogInfo(mBlogId, ci)) - { - - return; - } - - ui.channelName->setText(QString::fromStdWString(ci.blogName)); - -} - - -void CreateBlogMsg::sendMsg() -{ - std::cerr << "CreateBlogMsg::sendMsg()"; - std::cerr << std::endl; - - /* construct message bits */ - std::wstring subject = ui.subjectEdit->text().toStdWString(); - std::wstring msg = ui.msgEdit->toHtml().toStdWString(); - - sendMessage(subject, msg); - -} - -void CreateBlogMsg::sendMessage(std::wstring subject, std::wstring msg) -{ - std::cerr << "CreateBlogMsg::sendMessage()" << std::endl; - - QString name = ui.subjectEdit->text(); - - if(name.isEmpty()) - { /* error message */ - QMessageBox::warning(this, tr("RetroShare"), - tr("Please add a Subject"), - QMessageBox::Ok, QMessageBox::Ok); - - return; //Don't add a empty Subject!! - } - else - - /* rsChannels */ - if (rsBlogs) - { - BlogMsgInfo msgInfo; - - msgInfo.blogId = mBlogId; - msgInfo.msgId = ""; - - msgInfo.subject = subject; - msgInfo.msg = msg; - msgInfo.msgIdReply = "nothing"; - rsBlogs->BlogMessageSend(msgInfo); - } - - close(); - return; - -} - -void CreateBlogMsg::fontSizeIncrease() -{ - if ( !( ui.msgEdit->textCursor().blockFormat().hasProperty( TextFormat::HtmlHeading ) && - ui.msgEdit->textCursor().blockFormat().intProperty( TextFormat::HtmlHeading ) ) ) { - QTextCharFormat format; - int idx = ui.msgEdit->currentCharFormat().intProperty( QTextFormat::FontSizeAdjustment ); - if ( idx < 3 ) { - format.setProperty( QTextFormat::FontSizeAdjustment, QVariant( ++idx ) ); - ui.msgEdit->textCursor().mergeCharFormat( format ); - } - } - ui.msgEdit->setFocus( Qt::OtherFocusReason ); -} - -void CreateBlogMsg::fontSizeDecrease() -{ - if ( !( ui.msgEdit->textCursor().blockFormat().hasProperty( TextFormat::HtmlHeading ) && - ui.msgEdit->textCursor().blockFormat().intProperty( TextFormat::HtmlHeading ) ) ) { - QTextCharFormat format; - int idx = ui.msgEdit->currentCharFormat().intProperty( QTextFormat::FontSizeAdjustment ); - if ( idx > -1 ) { - format.setProperty( QTextFormat::FontSizeAdjustment, QVariant( --idx ) ); - ui.msgEdit->textCursor().mergeCharFormat( format ); - } - } - ui.msgEdit->setFocus( Qt::OtherFocusReason ); -} - -void CreateBlogMsg::blockQuote() -{ - QTextBlockFormat blockFormat = ui.msgEdit->textCursor().blockFormat(); - QTextBlockFormat f; - - if ( blockFormat.hasProperty( TextFormat::IsBlockQuote ) && - blockFormat.boolProperty( TextFormat::IsBlockQuote ) ) { - f.setProperty( TextFormat::IsBlockQuote, QVariant( false ) ); - f.setLeftMargin( 0 ); - f.setRightMargin( 0 ); - } else { - f.setProperty( TextFormat::IsBlockQuote, QVariant( true ) ); - f.setLeftMargin( 40 ); - f.setRightMargin( 40 ); - } - ui.msgEdit->textCursor().mergeBlockFormat( f ); -} - -void CreateBlogMsg::toggleCode() -{ - static QString preFontFamily; - - QTextCharFormat charFormat = ui.msgEdit->currentCharFormat(); - QTextCharFormat f; - - if ( charFormat.hasProperty( TextFormat::HasCodeStyle ) && - charFormat.boolProperty( TextFormat::HasCodeStyle ) ) { - f.setProperty( TextFormat::HasCodeStyle, QVariant( false ) ); - f.setBackground( defaultCharFormat.background() ); - f.setFontFamily( preFontFamily ); - ui.msgEdit->textCursor().mergeCharFormat( f ); - - } else { - preFontFamily = ui.msgEdit->fontFamily(); - f.setProperty( TextFormat::HasCodeStyle, QVariant( true ) ); - f.setBackground( codeBackground ); - f.setFontFamily( "Dejavu Sans Mono" ); - ui.msgEdit->textCursor().mergeCharFormat( f ); - } - ui.msgEdit->setFocus( Qt::OtherFocusReason ); -} - -void CreateBlogMsg::addPostSplitter() -{ - QTextBlockFormat f = ui.msgEdit->textCursor().blockFormat(); - QTextBlockFormat f1 = f; - - f.setProperty( TextFormat::IsHtmlTagSign, true ); - f.setProperty( QTextFormat::BlockTrailingHorizontalRulerWidth, - QTextLength( QTextLength::PercentageLength, 80 ) ); - if ( ui.msgEdit->textCursor().block().text().isEmpty() ) { - ui.msgEdit->textCursor().mergeBlockFormat( f ); - } else { - ui.msgEdit->textCursor().insertBlock( f ); - } - ui.msgEdit->textCursor().insertBlock( f1 ); -} - -void CreateBlogMsg::setStartupText() -{ - QString string = "

HTML Previewer

" - "

This example shows you how to use QWebView to" - " preview HTML data written in a QPlainTextEdit.

" - " "; - //webView->setHtml(string); -} - -void CreateBlogMsg::updateTextEdit() -{ - //QWebFrame *mainFrame = webView->page()->mainFrame(); - QString frameText = ui.msgEdit->toHtml(); - ui.plainTextEdit->setPlainText(frameText); - //QString text = plainTextEdit->toPlainText(); -} - -void CreateBlogMsg::textBold() -{ - QTextCharFormat fmt; - fmt.setFontWeight(actionTextBold->isChecked() ? QFont::Bold : QFont::Normal); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateBlogMsg::textUnderline() -{ - QTextCharFormat fmt; - fmt.setFontUnderline(actionTextUnderline->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateBlogMsg::textItalic() -{ - QTextCharFormat fmt; - fmt.setFontItalic(actionTextItalic->isChecked()); - mergeFormatOnWordOrSelection(fmt); -} - - -void CreateBlogMsg::textAlign(QAction *a) -{ - if (a == actionAlignLeft) - ui.msgEdit->setAlignment(Qt::AlignLeft | Qt::AlignAbsolute); - else if (a == actionAlignCenter) - ui.msgEdit->setAlignment(Qt::AlignHCenter | Qt::AlignAbsolute); - else if (a == actionAlignRight) - ui.msgEdit->setAlignment(Qt::AlignRight | Qt::AlignAbsolute); - else if (a == actionAlignJustify) - ui.msgEdit->setAlignment(Qt::AlignJustify | Qt::AlignAbsolute); - -} - -void CreateBlogMsg::alignmentChanged(Qt::Alignment a) -{ - if (a & Qt::AlignLeft) { - actionAlignLeft->setChecked(true); - } else if (a & Qt::AlignHCenter) { - actionAlignCenter->setChecked(true); - } else if (a & Qt::AlignRight) { - actionAlignRight->setChecked(true); - } else if (a & Qt::AlignJustify) { - actionAlignJustify->setChecked(true); - } -} - -void CreateBlogMsg::textFamily(const QString &f) -{ - QTextCharFormat fmt; - fmt.setFontFamily(f); - mergeFormatOnWordOrSelection(fmt); -} - -void CreateBlogMsg::textSize(const QString &p) -{ - qreal pointSize = p.toFloat(); - if (p.toFloat() > 0) { - QTextCharFormat fmt; - fmt.setFontPointSize(pointSize); - mergeFormatOnWordOrSelection(fmt); - } -} - -void CreateBlogMsg::changeFormatType(int styleIndex ) -{ - ui.msgEdit->setFocus( Qt::OtherFocusReason ); - - QTextCursor cursor = ui.msgEdit->textCursor(); - //QTextBlockFormat bformat = cursor.blockFormat(); - QTextBlockFormat bformat; - QTextCharFormat cformat; - - switch (styleIndex) { - default: - case 0: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 0 ) ); - cformat.setFontWeight( QFont::Normal ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) ); - break; - case 1: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 1 ) ); - cformat.setFontWeight( QFont::Bold ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 3 ) ); - break; - case 2: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 2 ) ); - cformat.setFontWeight( QFont::Bold ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 2 ) ); - break; - case 3: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 3 ) ); - cformat.setFontWeight( QFont::Bold ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 1 ) ); - break; - case 4: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 4 ) ); - cformat.setFontWeight( QFont::Bold ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) ); - break; - case 5: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 5 ) ); - cformat.setFontWeight( QFont::Bold ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -1 ) ); - break; - case 6: - bformat.setProperty( TextFormat::HtmlHeading, QVariant( 6 ) ); - cformat.setFontWeight( QFont::Bold ); - cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -2 ) ); - break; - } - //cformat.clearProperty( TextFormat::HasCodeStyle ); - - cursor.beginEditBlock(); - cursor.mergeBlockFormat( bformat ); - cursor.select( QTextCursor::BlockUnderCursor ); - cursor.mergeCharFormat( cformat ); - cursor.endEditBlock(); -} - - -void CreateBlogMsg::textColor() -{ - QColor col = QColorDialog::getColor(ui.msgEdit->textColor(), this); - if (!col.isValid()) - return; - QTextCharFormat fmt; - fmt.setForeground(col); - mergeFormatOnWordOrSelection(fmt); - colorChanged(col); -} - -void CreateBlogMsg::fontChanged(const QFont &f) -{ - comboFont->setCurrentIndex(comboFont->findText(QFontInfo(f).family())); - comboSize->setCurrentIndex(comboSize->findText(QString::number(f.pointSize()))); - actionTextBold->setChecked(f.bold()); - actionTextItalic->setChecked(f.italic()); - actionTextUnderline->setChecked(f.underline()); -} - -void CreateBlogMsg::colorChanged(const QColor &c) -{ - QPixmap pix(16, 16); - pix.fill(c); - //ui.colorbtn->setIcon(pix); - actionTextColor->setIcon(pix); -} - -void CreateBlogMsg::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - QTextCursor cursor = ui.msgEdit->textCursor(); - if (!cursor.hasSelection()) - cursor.select(QTextCursor::WordUnderCursor); - cursor.mergeCharFormat(format); - ui.msgEdit->mergeCurrentCharFormat(format); -} - -void CreateBlogMsg::currentCharFormatChanged(const QTextCharFormat &format) -{ - fontChanged(format.font()); - colorChanged(format.foreground().color()); -} - -void CreateBlogMsg::cursorPositionChanged() -{ - alignmentChanged(ui.msgEdit->alignment()); -} - -void CreateBlogMsg::clipboardDataChanged() -{ -#ifndef QT_NO_CLIPBOARD - actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); -#endif -} - - -void CreateBlogMsg::addOrderedList() -{ - ui.msgEdit->textCursor().createList( QTextListFormat::ListDecimal ); - -} - -void CreateBlogMsg::addUnorderedList() -{ - ui.msgEdit->textCursor().createList( QTextListFormat::ListDisc ); -} - -void CreateBlogMsg::setupFileActions() -{ - QMenu *menu = new QMenu(tr("&File"), this); - menuBar()->addMenu(menu); - - QAction *a; - - a = new QAction(QIcon(":/images/textedit/filenew.png"), tr("&New"), this); - a->setShortcut(QKeySequence::New); - connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); - menu->addAction(a); - - a = new QAction(QIcon(":/images/textedit/fileopen.png"), tr("&Open..."), this); - a->setShortcut(QKeySequence::Open); - connect(a, SIGNAL(triggered()), this, SLOT(fileOpen())); - menu->addAction(a); - - menu->addSeparator(); - - actionSave = a = new QAction(QIcon(":/images/textedit/filesave.png"), tr("&Save"), this); - a->setShortcut(QKeySequence::Save); - connect(a, SIGNAL(triggered()), this, SLOT(fileSave())); - a->setEnabled(false); - menu->addAction(a); - - a = new QAction(tr("Save &As..."), this); - connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs())); - menu->addAction(a); - menu->addSeparator(); - - a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("&Print..."), this); - a->setShortcut(QKeySequence::Print); - connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); - menu->addAction(a); - - a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("Print Preview..."), this); - connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview())); - menu->addAction(a); - - a = new QAction(QIcon(":/images/textedit/exportpdf.png"), tr("&Export PDF..."), this); - a->setShortcut(Qt::CTRL + Qt::Key_D); - connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); - menu->addAction(a); - - menu->addSeparator(); - - a = new QAction(tr("&Quit"), this); - a->setShortcut(Qt::CTRL + Qt::Key_Q); - connect(a, SIGNAL(triggered()), this, SLOT(cancelMsg())); - menu->addAction(a); -} - -void CreateBlogMsg::setupEditActions() -{ - QMenu *menu = new QMenu(tr("&Edit"), this); - menuBar()->addMenu(menu); - - QAction *a; - a = actionUndo = new QAction(QIcon(":/images/textedit/editundo.png"), tr("&Undo"), this); - a->setShortcut(QKeySequence::Undo); - menu->addAction(a); - a = actionRedo = new QAction(QIcon(":/images/textedit/editredo.png"), tr("&Redo"), this); - a->setShortcut(QKeySequence::Redo); - menu->addAction(a); - menu->addSeparator(); - a = actionCut = new QAction(QIcon(":/images/textedit/editcut.png"), tr("Cu&t"), this); - a->setShortcut(QKeySequence::Cut); - menu->addAction(a); - a = actionCopy = new QAction(QIcon(":/images/textedit/editcopy.png"), tr("&Copy"), this); - a->setShortcut(QKeySequence::Copy); - menu->addAction(a); - a = actionPaste = new QAction(QIcon(":/images/textedit/editpaste.png"), tr("&Paste"), this); - a->setShortcut(QKeySequence::Paste); - menu->addAction(a); - actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); -} - -void CreateBlogMsg::setupViewActions() -{ - QMenu *menu = new QMenu(tr("&View"), this); - menuBar()->addMenu(menu); - - QAction *a; - - -} - -void CreateBlogMsg::setupInsertActions() -{ - QMenu *menu = new QMenu(tr("&Insert"), this); - menuBar()->addMenu(menu); - - QAction *a; - - a = new QAction(QIcon(""), tr("&Image"), this); - connect(a, SIGNAL(triggered()), this, SLOT(addImage())); - menu->addAction(a); - -} - -void CreateBlogMsg::setupParagraphActions() -{ - comboStyle = new QComboBox(ui.toolBar_2); - ui.toolBar_2->addWidget(comboStyle); - comboStyle->addItem("Paragraph"); - comboStyle->addItem("Heading 1"); - comboStyle->addItem("Heading 2"); - comboStyle->addItem("Heading 3"); - comboStyle->addItem("Heading 4"); - comboStyle->addItem("Heading 5"); - comboStyle->addItem("Heading 6"); - - connect(comboStyle, SIGNAL(activated(int)), - this, SLOT(changeFormatType(int))); -} - -void CreateBlogMsg::setupTextActions() -{ - - QMenu *menu = new QMenu(tr("F&ormat"), this); - menuBar()->addMenu(menu); - - actionTextBold = new QAction(QIcon(":/images/textedit/textbold.png"),tr("&Bold"), this); - actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); - //actionTextBold->setPriority(QAction::LowPriority); - QFont bold; - bold.setBold(true); - actionTextBold->setFont(bold); - connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold())); - - ui.toolBar_2->addAction(actionTextBold); - menu->addAction(actionTextBold); - actionTextBold->setCheckable(true); - - actionTextItalic = new QAction(QIcon(":/images/textedit/textitalic.png"),tr("&Italic"), this); - //actionTextItalic->setPriority(QAction::LowPriority); - actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); - QFont italic; - italic.setItalic(true); - actionTextItalic->setFont(italic); - connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic())); - - ui.toolBar_2->addAction(actionTextItalic); - menu->addAction(actionTextItalic); - actionTextItalic->setCheckable(true); - - actionTextUnderline = new QAction(QIcon(":/images/textedit/textunder.png"),tr("&Underline"), this); - actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); - //actionTextUnderline->setPriority(QAction::LowPriority); - QFont underline; - underline.setUnderline(true); - actionTextUnderline->setFont(underline); - connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline())); - - ui.toolBar_2->addAction(actionTextUnderline); - menu->addAction(actionTextUnderline); - actionTextUnderline->setCheckable(true); - - menu->addSeparator(); - - QActionGroup *grp = new QActionGroup(this); - connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*))); - - // Make sure the alignLeft is always left of the alignRight - if (QApplication::isLeftToRight()) { - actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"),tr("&Left"), grp); - actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp); - actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp); - } else { - actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp); - actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp); - actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"), tr("&Left"), grp); - } - actionAlignJustify = new QAction(QIcon(":/images/textedit/textjustify.png"), tr("&Justify"), grp); - - actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); - actionAlignLeft->setCheckable(true); - //actionAlignLeft->setPriority(QAction::LowPriority); - actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); - actionAlignCenter->setCheckable(true); - //actionAlignCenter->setPriority(QAction::LowPriority); - actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); - actionAlignRight->setCheckable(true); - //actionAlignRight->setPriority(QAction::LowPriority); - actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); - actionAlignJustify->setCheckable(true); - //actionAlignJustify->setPriority(QAction::LowPriority); - - ui.toolBar_2->addActions(grp->actions()); - menu->addActions(grp->actions()); - - menu->addSeparator(); - - QPixmap pix(16, 16); - pix.fill(Qt::black); - actionTextColor = new QAction(pix, tr("&Text Color..."), this); - connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); - - ui.toolBar_2->addAction(actionTextColor); - menu->addAction(actionTextColor); - - menu->addAction(ui.actionOrderedlist); - menu->addAction(ui.actionUnorderedlist); - menu->addAction(ui.actionBlockquoute); - - - /*comboStyle = new QComboBox(ui.toolBar_2); - ui.toolBar_2->addWidget(comboStyle); - comboStyle->addItem("Paragraph"); - comboStyle->addItem("Heading 1"); - comboStyle->addItem("Heading 2"); - comboStyle->addItem("Heading 3"); - comboStyle->addItem("Heading 4"); - comboStyle->addItem("Heading 5"); - comboStyle->addItem("Heading 6"); - - connect(comboStyle, SIGNAL(activated(int)), - this, SLOT(changeFormatType(int)));*/ - - comboFont = new QFontComboBox(ui.toolBar_2); - ui.toolBar_2->addWidget(comboFont); - connect(comboFont, SIGNAL(activated(QString)), - this, SLOT(textFamily(QString))); - - comboSize = new QComboBox(ui.toolBar_2); - comboSize->setObjectName("comboSize"); - ui.toolBar_2->addWidget(comboSize); - comboSize->setEditable(true); - - QFontDatabase db; - foreach(int size, db.standardSizes()) - comboSize->addItem(QString::number(size)); - - connect(comboSize, SIGNAL(activated(QString)), - this, SLOT(textSize(QString))); - comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font() - .pointSize()))); -} - -bool CreateBlogMsg::load(const QString &f) -{ - if (!QFile::exists(f)) - return false; - QFile file(f); - if (!file.open(QFile::ReadOnly)) - return false; - - QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); - if (Qt::mightBeRichText(str)) { - ui.msgEdit->setHtml(str); - } else { - str = QString::fromLocal8Bit(data); - ui.msgEdit->setPlainText(str); - } - - setCurrentFileName(f); - return true; -} - -bool CreateBlogMsg::maybeSave() -{ - if (!ui.msgEdit->document()->isModified()) - return true; - if (fileName.startsWith(QLatin1String(":/"))) - return true; - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("Application"), - tr("The document has been modified.\n" - "Do you want to save your changes?"), - QMessageBox::Save | QMessageBox::Discard - | QMessageBox::Cancel); - if (ret == QMessageBox::Save) - return fileSave(); - else if (ret == QMessageBox::Cancel) - return false; - return true; -} - -void CreateBlogMsg::fileNew() -{ - if (maybeSave()) { - ui.msgEdit->clear(); - setCurrentFileName(QString()); - } -} - -void CreateBlogMsg::fileOpen() -{ - QString fn; - if (misc::getOpenFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Open File..."), tr("HTML-Files (*.htm *.html);;All Files (*)"), fn)) - load(fn); -} - -bool CreateBlogMsg::fileSave() -{ - if (fileName.isEmpty()) - return fileSaveAs(); - - QTextDocumentWriter writer(fileName); - bool success = writer.write(ui.msgEdit->document()); - if (success) - ui.msgEdit->document()->setModified(false); - return success; -} - -bool CreateBlogMsg::fileSaveAs() -{ - QString fn; - if (misc::getSaveFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Save as..."), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"), fn)) { - if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) ) - fn += ".odt"; // default - setCurrentFileName(fn); - return fileSave(); - } - - return false; -} - -void CreateBlogMsg::filePrint() -{ -#ifndef QT_NO_PRINTER - QPrinter printer(QPrinter::HighResolution); - QPrintDialog *dlg = new QPrintDialog(&printer, this); - if (ui.msgEdit->textCursor().hasSelection()) - dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection); - dlg->setWindowTitle(tr("Print Document")); - if (dlg->exec() == QDialog::Accepted) { - ui.msgEdit->print(&printer); - } - delete dlg; -#endif -} - -void CreateBlogMsg::filePrintPreview() -{ -#ifndef QT_NO_PRINTER - QPrinter printer(QPrinter::HighResolution); - QPrintPreviewDialog preview(&printer, this); - connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(printPreview(QPrinter*))); - preview.exec(); -#endif -} - -void CreateBlogMsg::printPreview(QPrinter *printer) -{ -#ifdef QT_NO_PRINTER - Q_UNUSED(printer); -#else - ui.msgEdit->print(printer); -#endif -} - - -void CreateBlogMsg::filePrintPdf() -{ -#ifndef QT_NO_PRINTER -//! [0] - QString fileName; - if (misc::getSaveFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Export PDF"), "*.pdf", fileName)) { - if (QFileInfo(fileName).suffix().isEmpty()) - fileName.append(".pdf"); - QPrinter printer(QPrinter::HighResolution); - printer.setOutputFormat(QPrinter::PdfFormat); - printer.setOutputFileName(fileName); - ui.msgEdit->document()->print(&printer); - } -//! [0] -#endif -} - -void CreateBlogMsg::setCurrentFileName(const QString &fileName) -{ - this->fileName = fileName; - ui.msgEdit->document()->setModified(false); - - QString shownName; - if (fileName.isEmpty()) - shownName = "untitled.txt"; - else - shownName = QFileInfo(fileName).fileName(); - - //setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Rich Text"))); - setWindowModified(false); -} - -void CreateBlogMsg::addImage() -{ - QString fileimg; - if (misc::getOpenFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Choose Image"), tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"), fileimg)) { - QImage base(fileimg); - - Create_New_Image_Tag(fileimg); - } -} - -void CreateBlogMsg::Create_New_Image_Tag( const QString urlremoteorlocal ) -{ - /*if (image_extension(urlremoteorlocal)) {*/ - QString subtext = QString("

").arg(urlremoteorlocal); - ///////////subtext.append("

Description on image.

"); - QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext); - ui.msgEdit->textCursor().insertFragment(fragment); - //emit statusMessage(QString("Image new :").arg(urlremoteorlocal)); - //} -} diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h b/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h deleted file mode 100644 index 91a3c9610..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2008 Robert Fernie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef _CREATEBLOGMSG_H -#define _CREATEBLOGMSG_H - -#include - -#include "ui_CreateBlogMsg.h" -#include - -class SubFileItem; -class FileInfo; - -QT_FORWARD_DECLARE_CLASS(QAction) -QT_FORWARD_DECLARE_CLASS(QComboBox) -QT_FORWARD_DECLARE_CLASS(QFontComboBox) -QT_FORWARD_DECLARE_CLASS(QTextEdit) -QT_FORWARD_DECLARE_CLASS(QTextCharFormat) -QT_FORWARD_DECLARE_CLASS(QMenu) - -class CreateBlogMsg : public QMainWindow -{ - Q_OBJECT - -public: - /** Default Constructor */ - CreateBlogMsg(std::string cId, QWidget *parent = 0, Qt::WFlags flags = 0); - /** Default Destructor */ - - void addAttachment(std::string path); - void addAttachment(std::string hash, std::string fname, uint64_t size, - bool local, std::string srcId); - - void newBlogMsg(); - - QPixmap picture; - QSettings setter; - - void Create_New_Image_Tag( const QString urlremoteorlocal ); - -private slots: - - void cancelMsg(); - void sendMsg(); - void addImage(); - - void fontSizeIncrease(); - void fontSizeDecrease(); - void blockQuote(); - void toggleCode(); - void addPostSplitter(); - - void setStartupText(); - void updateTextEdit(); - - void fileNew(); - void fileOpen(); - bool fileSave(); - bool fileSaveAs(); - void filePrint(); - void filePrintPreview(); - void filePrintPdf(); - void printPreview(QPrinter *); - - void textBold(); - void textUnderline(); - void textItalic(); - void textFamily(const QString &f); - void textSize(const QString &p); - void changeFormatType(int styleIndex ); - - - void textColor(); - void textAlign(QAction *a); - - void addOrderedList(); - void addUnorderedList(); - - void currentCharFormatChanged(const QTextCharFormat &format); - void cursorPositionChanged(); - - void clipboardDataChanged(); - - -private: - void setupFileActions(); - void setupEditActions(); - void setupViewActions(); - void setupInsertActions(); - void setupParagraphActions(); - void setupTextActions(); - - void setCurrentFileName(const QString &fileName); - bool load(const QString &f); - bool maybeSave(); - - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - - void fontChanged(const QFont &f); - void colorChanged(const QColor &c); - void alignmentChanged(Qt::Alignment a); - - - void sendMessage(std::wstring subject, std::wstring msg); - - std::string mBlogId; - - QAction *actionSave, - *actionTextBold, - *actionTextUnderline, - *actionTextItalic, - *actionTextColor, - *actionAlignLeft, - *actionAlignCenter, - *actionAlignRight, - *actionAlignJustify, - *actionUndo, - *actionRedo, - *actionCut, - *actionCopy, - *actionPaste; - - QComboBox *comboStyle; - QFontComboBox *comboFont; - QComboBox *comboSize; - - QString fileName; - - QColor codeBackground; - QTextCharFormat defaultCharFormat; - QTextBlockFormat defaultBlockFormat; - QTextCharFormat lastCharFormat; - QTextBlockFormat lastBlockFormat; - - /** Qt Designer generated object */ - Ui::CreateBlogMsg ui; -}; - - - -#endif - diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.ui b/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.ui deleted file mode 100644 index bd169b710..000000000 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.ui +++ /dev/null @@ -1,343 +0,0 @@ - - - CreateBlogMsg - - - - 0 - 0 - 666 - 515 - - - - New Blog Post - - - - :/images/rstray3.png:/images/rstray3.png - - - QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png); -} - -QToolButton { - color: white; -} - -QToolBar#toolBar_2{ -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, -stop:0 #FEFEFE, stop:1 #E8E8E8); - -border: 1px solid #CCCCCC;} - - - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - QTabWidget::South - - - 0 - - - - Blog Post - - - - - - - - - 75 - true - - - - Blog Post to: - - - - - - - true - - - true - - - - - - - - - 1 - - - - Visual Editor - - - - - - Blog Message - - - - - - - - - 75 - true - - - - Subject : - - - - - - - - - - - - - - - - - - - Html Editor - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - 666 - 25 - - - - - - - - 0 - 32 - - - - - 9 - - - - toolBar - - - TopToolBarArea - - - false - - - - - - - - toolBar_2 - - - TopToolBarArea - - - true - - - - - - true - - - - :/images/textedit/hi22-action-format-text-blockquote.png:/images/textedit/hi22-action-format-text-blockquote.png - - - blockquote - - - - - - :/images/textedit/format_font_size_more.png:/images/textedit/format_font_size_more.png - - - Increase font Size - - - - - - :/images/textedit/format_font_size_less.png:/images/textedit/format_font_size_less.png - - - Decrease font size - - - - - - :/images/textedit/textbold.png:/images/textedit/textbold.png - - - Bold - - - - - - :/images/textedit/textunder.png:/images/textedit/textunder.png - - - Underline - - - - - - :/images/textedit/textitalic.png:/images/textedit/textitalic.png - - - Italic - - - - - Publish - - - - - New - - - - - - :/images/textedit/hi22-action-format-text-code.png:/images/textedit/hi22-action-format-text-code.png - - - Code - - - - - - :/images/textedit/hi22-action-insert-more-mark.png:/images/textedit/hi22-action-insert-more-mark.png - - - splitPost - - - - - - :/images/textedit/format-list-ordered.png:/images/textedit/format-list-ordered.png - - - Ordered List - - - - - - :/images/textedit/format-list-unordered.png:/images/textedit/format-list-unordered.png - - - Unordered List - - - - - true - - - - :/images/textedit/editcut.png:/images/textedit/editcut.png - - - Clipboard - - - - - - :/images/textedit/editundo.png:/images/textedit/editundo.png - - - Undo - - - - - - - - - - - - - - - diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index d7c47a182..7e0a3fbd7 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -2,7 +2,7 @@ CONFIG += qt gui uic qrc resources uitools idle bitdht # Below is for GXS services. # Should be disabled for releases. -#CONFIG += gxs debug +CONFIG += gxs debug gxs { @@ -300,13 +300,7 @@ HEADERS += rshare.h \ gui/MainWindow.h \ gui/RSHumanReadableDelegate.h \ gui/AboutDialog.h \ - gui/ForumsDialog.h \ gui/CreateMsgLinkDialog.h \ - gui/forums/ForumDetails.h \ - gui/forums/EditForumDetails.h \ - gui/forums/CreateForum.h \ - gui/forums/CreateForumMsg.h \ - gui/forums/ForumUserNotify.h \ gui/NetworkView.h \ gui/TrustView.h \ gui/MessengerWindow.h \ @@ -377,12 +371,6 @@ HEADERS += rshare.h \ gui/chat/CreateLobbyDialog.h \ gui/chat/ChatStyle.h \ gui/chat/ChatUserNotify.h \ - gui/channels/CreateChannel.h \ - gui/channels/ChannelDetails.h \ - gui/channels/CreateChannelMsg.h \ - gui/channels/EditChanDetails.h \ - gui/channels/ShareKey.h \ - gui/channels/ChannelUserNotify.h \ gui/connect/ConfCertDialog.h \ gui/msgs/MessageComposer.h \ gui/msgs/MessageWindow.h \ @@ -403,7 +391,6 @@ HEADERS += rshare.h \ gui/settings/CryptoPage.h \ gui/settings/MessagePage.h \ gui/settings/NewTag.h \ - gui/settings/ForumPage.h \ gui/settings/PluginsPage.h \ gui/settings/PluginItem.h \ gui/settings/AppearancePage.h \ @@ -478,15 +465,10 @@ HEADERS += rshare.h \ gui/elastic/arrow.h \ gui/elastic/node.h \ gui/NewsFeed.h \ - gui/ChannelFeed.h \ gui/feeds/FeedHolder.h \ - gui/feeds/ForumNewItem.h \ - gui/feeds/ForumMsgItem.h \ gui/feeds/PeerItem.h \ gui/feeds/MsgItem.h \ gui/feeds/ChatMsgItem.h \ - gui/feeds/ChanNewItem.h \ - gui/feeds/ChanMsgItem.h \ gui/feeds/SubFileItem.h \ gui/feeds/AttachFileItem.h \ gui/feeds/SecurityItem.h \ @@ -496,8 +478,26 @@ HEADERS += rshare.h \ gui/groups/CreateGroup.h \ gui/dht/DhtWindow.h \ gui/bwctrl/BwCtrlWindow.h \ + gui/channels/ShareKey.h \ gui/GetStartedDialog.h +# gui/ForumsDialog.h \ +# gui/forums/ForumDetails.h \ +# gui/forums/EditForumDetails.h \ +# gui/forums/CreateForum.h \ +# gui/forums/CreateForumMsg.h \ +# gui/forums/ForumUserNotify.h \ +# gui/feeds/ForumNewItem.h \ +# gui/feeds/ForumMsgItem.h \ +# gui/ChannelFeed.h \ +# gui/feeds/ChanNewItem.h \ +# gui/feeds/ChanMsgItem.h \ +# gui/channels/CreateChannel.h \ +# gui/channels/ChannelDetails.h \ +# gui/channels/CreateChannelMsg.h \ +# gui/channels/EditChanDetails.h \ +# gui/channels/ChannelUserNotify.h \ +# gui/settings/ForumPage.h \ FORMS += gui/StartDialog.ui \ gui/GenCertDialog.ui \ @@ -508,13 +508,8 @@ FORMS += gui/StartDialog.ui \ gui/FileTransfer/TurtleRouterDialog.ui \ gui/FileTransfer/TurtleRouterStatistics.ui \ gui/FileTransfer/DetailsDialog.ui \ - gui/ForumsDialog.ui \ gui/MainWindow.ui \ gui/CreateMsgLinkDialog.ui \ - gui/forums/CreateForum.ui \ - gui/forums/CreateForumMsg.ui \ - gui/forums/ForumDetails.ui \ - gui/forums/EditForumDetails.ui \ gui/NetworkView.ui \ gui/TrustView.ui \ gui/MessengerWindow.ui \ @@ -532,11 +527,6 @@ FORMS += gui/StartDialog.ui \ gui/profile/ProfileWidget.ui \ gui/profile/StatusMessage.ui \ gui/profile/ProfileManager.ui \ - gui/channels/CreateChannel.ui \ - gui/channels/CreateChannelMsg.ui \ - gui/channels/ChannelDetails.ui \ - gui/channels/EditChanDetails.ui \ - gui/channels/ShareKey.ui \ gui/chat/PopupChatWindow.ui \ gui/chat/PopupChatDialog.ui \ gui/chat/ChatTabWidget.ui \ @@ -559,7 +549,6 @@ FORMS += gui/StartDialog.ui \ gui/settings/CryptoPage.ui \ gui/settings/MessagePage.ui \ gui/settings/NewTag.ui \ - gui/settings/ForumPage.ui \ gui/settings/PluginsPage.ui \ gui/settings/AppearancePage.ui \ gui/settings/TransferPage.ui \ @@ -577,14 +566,9 @@ FORMS += gui/StartDialog.ui \ gui/advsearch/AdvancedSearchDialog.ui \ gui/advsearch/expressionwidget.ui \ gui/NewsFeed.ui \ - gui/ChannelFeed.ui \ - gui/feeds/ForumNewItem.ui \ - gui/feeds/ForumMsgItem.ui \ gui/feeds/PeerItem.ui \ gui/feeds/MsgItem.ui \ gui/feeds/ChatMsgItem.ui \ - gui/feeds/ChanNewItem.ui \ - gui/feeds/ChanMsgItem.ui \ gui/feeds/SubFileItem.ui \ gui/feeds/AttachFileItem.ui \ gui/feeds/SecurityItem.ui \ @@ -600,8 +584,25 @@ FORMS += gui/StartDialog.ui \ gui/style/StyleDialog.ui \ gui/dht/DhtWindow.ui \ gui/bwctrl/BwCtrlWindow.ui \ + gui/channels/ShareKey.ui \ gui/GetStartedDialog.ui +# gui/ForumsDialog.ui \ +# gui/forums/CreateForum.ui \ +# gui/forums/CreateForumMsg.ui \ +# gui/forums/ForumDetails.ui \ +# gui/forums/EditForumDetails.ui \ +# gui/feeds/ForumNewItem.ui \ +# gui/feeds/ForumMsgItem.ui \ +# gui/ChannelFeed.ui \ +# gui/channels/CreateChannel.ui \ +# gui/channels/CreateChannelMsg.ui \ +# gui/channels/ChannelDetails.ui \ +# gui/channels/EditChanDetails.ui \ +# gui/feeds/ChanNewItem.ui \ +# gui/feeds/ChanMsgItem.ui \ +# gui/settings/ForumPage.ui \ + SOURCES += main.cpp \ rshare.cpp \ gui/notifyqt.cpp \ @@ -613,13 +614,7 @@ SOURCES += main.cpp \ gui/graphframe.cpp \ gui/mainpagestack.cpp \ gui/MainWindow.cpp \ - gui/ForumsDialog.cpp \ gui/CreateMsgLinkDialog.cpp \ - gui/forums/ForumDetails.cpp \ - gui/forums/EditForumDetails.cpp \ - gui/forums/CreateForum.cpp \ - gui/forums/CreateForumMsg.cpp \ - gui/forums/ForumUserNotify.cpp \ gui/NetworkView.cpp \ gui/TrustView.cpp \ gui/MessengerWindow.cpp \ @@ -678,12 +673,6 @@ SOURCES += main.cpp \ gui/profile/ProfileWidget.cpp \ gui/profile/StatusMessage.cpp \ gui/profile/ProfileManager.cpp \ - gui/channels/CreateChannel.cpp \ - gui/channels/CreateChannelMsg.cpp \ - gui/channels/ChannelDetails.cpp \ - gui/channels/EditChanDetails.cpp \ - gui/channels/ShareKey.cpp \ - gui/channels/ChannelUserNotify.cpp \ gui/chat/PopupChatWindow.cpp \ gui/chat/PopupChatDialog.cpp \ gui/chat/PopupDistantChatDialog.cpp \ @@ -752,7 +741,6 @@ SOURCES += main.cpp \ gui/settings/CryptoPage.cpp \ gui/settings/MessagePage.cpp \ gui/settings/NewTag.cpp \ - gui/settings/ForumPage.cpp \ gui/settings/PluginsPage.cpp \ gui/settings/PluginItem.cpp \ gui/settings/AppearancePage.cpp \ @@ -785,15 +773,10 @@ SOURCES += main.cpp \ gui/elastic/arrow.cpp \ gui/elastic/node.cpp \ gui/NewsFeed.cpp \ - gui/ChannelFeed.cpp \ gui/feeds/FeedHolder.cpp \ - gui/feeds/ForumNewItem.cpp \ - gui/feeds/ForumMsgItem.cpp \ gui/feeds/PeerItem.cpp \ gui/feeds/MsgItem.cpp \ gui/feeds/ChatMsgItem.cpp \ - gui/feeds/ChanNewItem.cpp \ - gui/feeds/ChanMsgItem.cpp \ gui/feeds/SubFileItem.cpp \ gui/feeds/AttachFileItem.cpp \ gui/feeds/SecurityItem.cpp \ @@ -803,8 +786,27 @@ SOURCES += main.cpp \ gui/groups/CreateGroup.cpp \ gui/dht/DhtWindow.cpp \ gui/bwctrl/BwCtrlWindow.cpp \ + gui/channels/ShareKey.cpp \ gui/GetStartedDialog.cpp +# gui/ForumsDialog.cpp \ +# gui/forums/ForumDetails.cpp \ +# gui/forums/EditForumDetails.cpp \ +# gui/forums/CreateForum.cpp \ +# gui/forums/CreateForumMsg.cpp \ +# gui/forums/ForumUserNotify.cpp \ +# gui/feeds/ForumNewItem.cpp \ +# gui/feeds/ForumMsgItem.cpp \ +# gui/ChannelFeed.cpp \ +# gui/channels/CreateChannel.cpp \ +# gui/channels/CreateChannelMsg.cpp \ +# gui/channels/ChannelDetails.cpp \ +# gui/channels/EditChanDetails.cpp \ +# gui/channels/ChannelUserNotify.cpp \ +# gui/feeds/ChanNewItem.cpp \ +# gui/feeds/ChanMsgItem.cpp \ +# gui/settings/ForumPage.cpp \ + RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc TRANSLATIONS += \ @@ -856,36 +858,36 @@ pluginmgr { } -blogs { - -DEPENDPATH += gui/unfinished \ - -HEADERS += gui/unfinished/blogs/BlogsDialog.h \ - gui/unfinished/blogs/CreateBlog.h \ - gui/unfinished/blogs/CreateBlogMsg.h \ - gui/unfinished/blogs/BlogsMsgItem.h \ - gui/unfinished/blogs/BlogDetails.h \ - gui/feeds/BlogNewItem.h \ - gui/feeds/BlogMsgItem.h \ - -FORMS += gui/unfinished/blogs/BlogsDialog.ui \ - gui/unfinished/blogs/CreateBlog.ui \ - gui/unfinished/blogs/CreateBlogMsg.ui \ - gui/unfinished/blogs/BlogsMsgItem.ui \ - gui/unfinished/blogs/BlogDetails.ui \ - gui/feeds/BlogNewItem.ui \ - gui/feeds/BlogMsgItem.ui \ - -SOURCES += gui/unfinished/blogs/BlogsDialog.cpp \ - gui/unfinished/blogs/CreateBlog.cpp \ - gui/unfinished/blogs/CreateBlogMsg.cpp \ - gui/unfinished/blogs/BlogsMsgItem.cpp \ - gui/unfinished/blogs/BlogDetails.cpp \ - gui/feeds/BlogNewItem.cpp \ - gui/feeds/BlogMsgItem.cpp \ - -DEFINES += BLOGS -} +#blogs { +# +#DEPENDPATH += gui/unfinished \ +# +#HEADERS += gui/unfinished/blogs/BlogsDialog.h \ +# gui/unfinished/blogs/CreateBlog.h \ +# gui/unfinished/blogs/CreateBlogMsg.h \ +# gui/unfinished/blogs/BlogsMsgItem.h \ +# gui/unfinished/blogs/BlogDetails.h \ +# gui/feeds/BlogNewItem.h \ +# gui/feeds/BlogMsgItem.h \ +# +#FORMS += gui/unfinished/blogs/BlogsDialog.ui \ +# gui/unfinished/blogs/CreateBlog.ui \ +# gui/unfinished/blogs/CreateBlogMsg.ui \ +# gui/unfinished/blogs/BlogsMsgItem.ui \ +# gui/unfinished/blogs/BlogDetails.ui \ +# gui/feeds/BlogNewItem.ui \ +# gui/feeds/BlogMsgItem.ui \ +# +#SOURCES += gui/unfinished/blogs/BlogsDialog.cpp \ +# gui/unfinished/blogs/CreateBlog.cpp \ +# gui/unfinished/blogs/CreateBlogMsg.cpp \ +# gui/unfinished/blogs/BlogsMsgItem.cpp \ +# gui/unfinished/blogs/BlogDetails.cpp \ +# gui/feeds/BlogNewItem.cpp \ +# gui/feeds/BlogMsgItem.cpp \ +# +#DEFINES += BLOGS +#} # use_links { # HEADERS += gui/AddLinksDialog.h \ @@ -930,10 +932,10 @@ unfinished { DEPENDPATH += gui/unfinished \ HEADERS += gui/unfinished/ApplicationWindow.h \ - gui/unfinished/CalDialog.h \ - gui/unfinished/ExampleDialog.h \ - gui/unfinished/GamesDialog.h \ - + +# gui/unfinished/CalDialog.h \ +# gui/unfinished/ExampleDialog.h \ +# gui/unfinished/GamesDialog.h \ # gui/unfinished/profile/ProfileView.h \ # gui/unfinished/profile/ProfileEdit.h # gui/unfinished/StatisticDialog.h \ @@ -941,10 +943,10 @@ unfinished { # gui/unfinished/PhotoShow.h \ FORMS += gui/unfinished/ApplicationWindow.ui \ - gui/unfinished/CalDialog.ui \ - gui/unfinished/ExampleDialog.ui \ - gui/unfinished/GamesDialog.ui \ - + +# gui/unfinished/CalDialog.ui \ +# gui/unfinished/ExampleDialog.ui \ +# gui/unfinished/GamesDialog.ui \ # gui/unfinished/profile/ProfileView.ui \ # gui/unfinished/profile/ProfileEdit.ui # gui/unfinished/StatisticDialog.ui \ @@ -952,10 +954,10 @@ unfinished { # gui/unfinished/PhotoShow.ui \ SOURCES += gui/unfinished/ApplicationWindow.cpp \ - gui/unfinished/CalDialog.cpp \ - gui/unfinished/ExampleDialog.cpp \ - gui/unfinished/GamesDialog.cpp \ - + +# gui/unfinished/CalDialog.cpp \ +# gui/unfinished/ExampleDialog.cpp \ +# gui/unfinished/GamesDialog.cpp \ # gui/unfinished/profile/ProfileView.cpp \ # gui/unfinished/profile/ProfileEdit.cpp # gui/unfinished/StatisticDialog.cpp \