Merging branches/v0.6-initdev into trunk.

These split at 6672 -> 7075, so quite a bit merge.
libretroshare compiles - but untested.
retroshare-gui needs GenCertDialog.ui and IdEditDialog.ui to be properly merged. (compile errors).
some plugins will be broken.
retroshare-nogui is untested.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-02-01 14:16:15 +00:00
commit c0738eec7f
407 changed files with 23716 additions and 50779 deletions

View file

@ -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 <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsblogs.h>
#include <QTime>
#include <QDateTime>
#include <list>
#include <iostream>
#include <string>
/** Default constructor */
BlogDetails::BlogDetails(QWidget *parent, Qt::WindowFlags 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<BlogInfo> channelList;
std::list<BlogInfo>::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();
}

View file

@ -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 <QDialog>
#include "ui_BlogDetails.h"
class BlogDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
BlogDetails(QWidget *parent = 0, Qt::WindowFlags 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

View file

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogDetails</class>
<widget class="QDialog" name="BlogDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Blog Details</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Blog Details</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Blog Info</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Blog Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="popline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Last Post</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Blog ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="IDline"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Blog Description</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="applyButton">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -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 <QMenu>
#include <QTimer>
#include <QStandardItemModel>
#include <algorithm>
#include <retroshare/rsblogs.h>
#include <retroshare/rspeers.h> //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<std::string> blogIds;
std::list<std::string>::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<BlogInfo> channelList;
std::list<BlogInfo>::iterator it;
if (!rsBlogs)
{
return;
}
rsBlogs->getBlogList(channelList);
/* get the ids for our lists */
std::list<std::string> adminIds;
std::list<std::string> subIds;
std::list<std::string> popIds;
std::list<std::string> otherIds;
std::multimap<uint32_t, std::string> 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<uint32_t, std::string>::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<std::string> &ids)
{
std::list<std::string>::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<QStandardItem *> 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<std::string> &ids)
{
std::list<std::string>::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<QStandardItem *> 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<std::string> &ids)
{
std::list<std::string>::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<QStandardItem *> 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<std::string> &ids)
{
std::list<std::string>::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<QStandardItem *> 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("<span style=\"font-size:22pt; font-weight:500;"
"color:white;\">%1</span>");
/* 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<BlogsMsgItem *>::iterator mit;
for(mit = mBlogMsgItems.begin(); mit != mBlogMsgItems.end(); mit++)
{
delete (*mit);
}
mBlogMsgItems.clear();
std::list<BlogMsgSummary> msgs;
std::list<BlogMsgSummary>::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! */
}

View file

@ -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<std::string> &ids);
void updateBlogListSub(std::list<std::string> &ids);
void updateBlogListPop(std::list<std::string> &ids);
void updateBlogListOther(std::list<std::string> &ids);
void updateBlogMsgs();
QStandardItemModel *model;
std::string mBlogId; /* current Blog */
std::string mPeerId;
/* Layout Pointers */
QBoxLayout *mMsgLayout;
std::list<BlogsMsgItem *> mBlogMsgItems;
QFont mBlogFont;
QFont itemFont;
};
#endif

View file

@ -1,568 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogsDialog</class>
<widget class="QWidget" name="BlogsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>476</height>
</rect>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QFrame" name="chanFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>222</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>222</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>221</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="chheaderframe">
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>38</height>
</size>
</property>
<property name="baseSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"> QFrame#chheaderframe{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}
</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>2</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="_2">
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images.qrc">:/images/kblogger.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:10pt; font-weight:600;&quot;&gt;Blogs&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>123</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="blogpushButton">
<property name="toolTip">
<string>Add</string>
</property>
<property name="styleSheet">
<string notr="true">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;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="postButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Post To Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeView" name="treeView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">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);}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="horizontalSpacing">
<number>16</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{
border: 2px solid white;
border-radius: 10px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images.qrc">:/images/hi64-app-kblogger.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:14pt; color:#ffffff;&quot;&gt;Blog Name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item row="0" column="3">
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Unsubscribe To Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">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;
}</string>
</property>
<property name="text">
<string>Unsubscribe</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="subscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Subscribe To Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">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;
}</string>
</property>
<property name="text">
<string>Subscribe</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="msgFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>332</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>391</width>
<height>266</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
<action name="actionCreate_Blog">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/kblogger.png</normaloff>:/images/kblogger.png</iconset>
</property>
<property name="text">
<string>Create New Blog</string>
</property>
<property name="toolTip">
<string>Create New Blog</string>
</property>
</action>
</widget>
<resources>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -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 <QDateTime>
#include "BlogsMsgItem.h"
#include "gui/feeds/FeedHolder.h"
#include <retroshare/rsblogs.h>
#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
}

View file

@ -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 <stdint.h>
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

View file

@ -1,274 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogsMsgItem</class>
<widget class="QWidget" name="BlogsMsgItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>294</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">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;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">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;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#656565;&quot;&gt;Blog Subject&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="3" colspan="2">
<widget class="QLabel" name="datetimelabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;DateTime&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>288</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Unsubscribe From Channel</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5">
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QTextBrowser#textBrowser{border: 2px solid #D3D3D3;
background-color: transparent;
border-radius: 10px;}</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="expandFrame">
<property name="styleSheet">
<string notr="true">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;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="msgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Comments here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTextEdit" name="commentEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>398</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="commentButton">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -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 <QMessageBox>
#include <QBuffer>
#include "CreateBlog.h"
#include "util/misc.h"
#include <retroshare/rsblogs.h>
/** 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;
}

View file

@ -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

View file

@ -1,329 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBlog</class>
<widget class="QDialog" name="CreateBlog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>534</width>
<height>545</height>
</rect>
</property>
<property name="windowTitle">
<string>Create new Blog</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame_2{background-image: url(:/images/connect/connectFriendBanner.png);}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelicon">
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images.qrc">:/images/hi48-app-kblogger.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabelcreatforums">
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;&quot;&gt;New Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="forumName"/>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QTextEdit" name="forumDesc"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="tyoeGroupBox">
<property name="title">
<string>Type:</string>
</property>
<layout class="QVBoxLayout" name="_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="typePublic">
<property name="text">
<string>Public - Anyone can read and publish (Shared Publish Key)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typePrivate">
<property name="text">
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeEncrypted">
<property name="text">
<string>Private - (Private Publish Key required to view Messages)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QGroupBox" name="msgGroupBox">
<property name="title">
<string>Allowed Messages</string>
</property>
<layout class="QVBoxLayout" name="_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="msgAuth">
<property name="text">
<string>Authenticated Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="msgAnon">
<property name="text">
<string>Anonymous Messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QGroupBox" name="groupBoxLogo">
<property name="title">
<string>Blog Logo</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QToolButton" name="blogLogoButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">
border: 2px solid white;
border-radius: 10px;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/hi64-app-kblogger.png</normaloff>:/images/hi64-app-kblogger.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="LogoButton">
<property name="text">
<string>Add Blog Logo</string>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>118</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>238</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="createButton">
<property name="text">
<string>Create</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
<include location="../../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -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 <QClipboard>
#include <QColorDialog>
#include <QFontComboBox>
#include <QFile>
#include <QFileInfo>
#include <QPrintDialog>
#include <QPrinter>
#include <QTextCodec>
#include <QTextDocumentWriter>
#include <QTextDocumentFragment>
#include <QMessageBox>
#include <QPrintPreviewDialog>
#include <QTextBlock>
#include "CreateBlogMsg.h"
#include "gui/msgs/textformat.h"
#include "util/misc.h"
#include <retroshare/rsblogs.h>
/** Constructor */
CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WindowFlags 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><body><h1>HTML Previewer</h1>"
" <p>This example shows you how to use QWebView to"
" preview HTML data written in a QPlainTextEdit.</p>"
" </body></html>";
//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("<p><img src=\"%1\">").arg(urlremoteorlocal);
///////////subtext.append("<br><br>Description on image.</p>");
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext);
ui.msgEdit->textCursor().insertFragment(fragment);
//emit statusMessage(QString("Image new :").arg(urlremoteorlocal));
//}
}

View file

@ -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 <QSettings>
#include "ui_CreateBlogMsg.h"
#include <stdint.h>
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::WindowFlags 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

View file

@ -1,343 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBlogMsg</class>
<widget class="QMainWindow" name="CreateBlogMsg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>515</height>
</rect>
</property>
<property name="windowTitle">
<string>New Blog Post</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">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;}</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Blog Post</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Blog Post to:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="channelName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Visual Editor</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Blog Message</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="_3">
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="subjectEdit"/>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTextEdit" name="msgEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabHtml">
<attribute name="title">
<string>Html Editor</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainTextEdit"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionPublish"/>
<addaction name="separator"/>
<addaction name="actionNew"/>
</widget>
<widget class="QToolBar" name="toolBar_2">
<property name="windowTitle">
<string>toolBar_2</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>true</bool>
</attribute>
<addaction name="actionUndo"/>
</widget>
<action name="actionBlockquoute">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/hi22-action-format-text-blockquote.png</normaloff>:/images/textedit/hi22-action-format-text-blockquote.png</iconset>
</property>
<property name="text">
<string>blockquote</string>
</property>
</action>
<action name="actionIncreasefontsize">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format_font_size_more.png</normaloff>:/images/textedit/format_font_size_more.png</iconset>
</property>
<property name="text">
<string>Increase font Size</string>
</property>
</action>
<action name="actionDecreasefontsize">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format_font_size_less.png</normaloff>:/images/textedit/format_font_size_less.png</iconset>
</property>
<property name="text">
<string>Decrease font size</string>
</property>
</action>
<action name="actionBold">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/textbold.png</normaloff>:/images/textedit/textbold.png</iconset>
</property>
<property name="text">
<string>Bold</string>
</property>
</action>
<action name="actionUnderline">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/textunder.png</normaloff>:/images/textedit/textunder.png</iconset>
</property>
<property name="text">
<string>Underline</string>
</property>
</action>
<action name="actionItalic">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
</property>
<property name="text">
<string>Italic</string>
</property>
</action>
<action name="actionPublish">
<property name="text">
<string>Publish</string>
</property>
</action>
<action name="actionNew">
<property name="text">
<string>New</string>
</property>
</action>
<action name="actionCode">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/hi22-action-format-text-code.png</normaloff>:/images/textedit/hi22-action-format-text-code.png</iconset>
</property>
<property name="text">
<string>Code</string>
</property>
</action>
<action name="actionsplitPost">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/hi22-action-insert-more-mark.png</normaloff>:/images/textedit/hi22-action-insert-more-mark.png</iconset>
</property>
<property name="text">
<string>splitPost</string>
</property>
</action>
<action name="actionOrderedlist">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format-list-ordered.png</normaloff>:/images/textedit/format-list-ordered.png</iconset>
</property>
<property name="text">
<string>Ordered List</string>
</property>
</action>
<action name="actionUnorderedlist">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format-list-unordered.png</normaloff>:/images/textedit/format-list-unordered.png</iconset>
</property>
<property name="text">
<string>Unordered List</string>
</property>
</action>
<action name="actionClipboard">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/editcut.png</normaloff>:/images/textedit/editcut.png</iconset>
</property>
<property name="text">
<string>Clipboard</string>
</property>
</action>
<action name="actionUndo">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/editundo.png</normaloff>:/images/textedit/editundo.png</iconset>
</property>
<property name="text">
<string>Undo</string>
</property>
</action>
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../../images.qrc"/>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>