mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed Buttons layout,
Added save as, print, printpreview to context menu git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2112 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
51c2e5b642
commit
acca7d5c90
@ -35,7 +35,6 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
@ -87,7 +86,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
connect(ui.actionIconOnly, SIGNAL(triggered()), this, SLOT(buttonsicononly()));
|
||||
connect(ui.actionTextUnderIcon, SIGNAL(triggered()), this, SLOT(buttonstextundericon()));
|
||||
|
||||
|
||||
connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
|
||||
|
||||
mCurrCertId = "";
|
||||
mCurrMsgId = "";
|
||||
@ -192,7 +191,10 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
||||
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
||||
contextMnu.addAction( removemsgAct);
|
||||
}
|
||||
|
||||
contextMnu.addAction( ui.actionSave_as);
|
||||
contextMnu.addAction( ui.actionPrintPreview);
|
||||
contextMnu.addAction( ui.actionPrint);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction( newmsgAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
@ -963,6 +965,39 @@ void MessagesDialog::anchorClicked (const QUrl& link )
|
||||
}
|
||||
}
|
||||
|
||||
bool MessagesDialog::fileSave()
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return fileSaveAs();
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::WriteOnly))
|
||||
return false;
|
||||
QTextStream ts(&file);
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
ts << ui.msgText->document()->toHtml("UTF-8");
|
||||
ui.msgText->document()->setModified(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MessagesDialog::fileSaveAs()
|
||||
{
|
||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
||||
QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
|
||||
if (fn.isEmpty())
|
||||
return false;
|
||||
setCurrentFileName(fn);
|
||||
return fileSave();
|
||||
}
|
||||
|
||||
void MessagesDialog::setCurrentFileName(const QString &fileName)
|
||||
{
|
||||
this->fileName = fileName;
|
||||
ui.msgText->document()->setModified(false);
|
||||
|
||||
setWindowModified(false);
|
||||
}
|
||||
|
||||
void MessagesDialog::buttonsicononly()
|
||||
{
|
||||
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
|
@ -58,6 +58,9 @@ private slots:
|
||||
void print();
|
||||
void printpreview();
|
||||
|
||||
bool fileSave();
|
||||
bool fileSaveAs();
|
||||
|
||||
void removemessage();
|
||||
|
||||
void anchorClicked (const QUrl &);
|
||||
@ -76,6 +79,8 @@ private:
|
||||
|
||||
bool getCurrentMsg(std::string &cid, std::string &mid);
|
||||
void setMsgAsRead(QTreeWidgetItem *);
|
||||
|
||||
void setCurrentFileName(const QString &fileName);
|
||||
|
||||
std::string mCurrCertId;
|
||||
std::string mCurrMsgId;
|
||||
@ -92,6 +97,9 @@ private:
|
||||
|
||||
QAction* getRecAct;
|
||||
QAction* getAllRecAct;
|
||||
|
||||
QString fileName;
|
||||
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MessagesDialog ui;
|
||||
|
@ -550,7 +550,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="replymessageButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -772,7 +772,7 @@ p, li { white-space: pre-wrap; }
|
||||
<item row="0" column="7">
|
||||
<widget class="QToolButton" name="printbutton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -816,7 +816,7 @@ p, li { white-space: pre-wrap; }
|
||||
<item row="0" column="8">
|
||||
<widget class="QToolButton" name="viewtoolButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -1388,12 +1388,15 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
<action name="actionPrint">
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
<string>Print...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Print...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrintPreview">
|
||||
<property name="text">
|
||||
<string>PrintPreview</string>
|
||||
<string>Print Preview</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionIconOnly">
|
||||
@ -1420,6 +1423,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Set Text Under Icon</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_as">
|
||||
<property name="text">
|
||||
<string>Save As...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>newmessageButton</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user