Source code maintenance

Memory leaks:
- SharedFilesDialog::sendLinkToCloud -> new AddLinksDialog
- SharedFilesDialog::addLinkToCloud -> new AddLinksDialog
- ChannelFeed::channelListCustomPopupMenu -> new QAction
- ChannelFeed::createChannel -> new CreateChannel
- ChannelFeed::openMsg -> new GeneralMsgDialog
- ChannelFeed::createMsg -> new CreateChannelMsg
- NewsFeed::openMsg -> new GeneralMsgDialog
- BlogsDialog::openMsg -> new GeneralMsgDialog
- BlogsDialog::createBlog -> new CreateBlog
- BlogsDialog::openMsg -> new GeneralMsgDialog
- BlogsDialog::createMsg -> new CreateBlogMsg
- NewsFeed::deleteFeedItem -> Feed items are not deleted, just switched to hidden

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2847 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-05-05 00:05:36 +00:00
parent 4e1395a14a
commit 5bb023104d
18 changed files with 73 additions and 32 deletions

View File

@ -40,6 +40,8 @@ AddLinksDialog::AddLinksDialog(QString url, QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* add button */
connect(ui.addLinkButton, SIGNAL(clicked()), this, SLOT(addLinkComment()));
connect(ui.closepushButton, SIGNAL(clicked()), this, SLOT(close()));

View File

@ -134,6 +134,12 @@ ChannelFeed::ChannelFeed(QWidget *parent)
void ChannelFeed::channelListCustomPopupMenu( QPoint point )
{
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci))
{
return;
}
QMenu contextMnu( this );
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
@ -150,13 +156,7 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint point )
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
contextMnu.clear();
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci))
{
return;
}
if (ci.channelFlags & RS_DISTRIB_PUBLISH)
{
contextMnu.addAction( postchannelAct );
@ -183,14 +183,14 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint point )
void ChannelFeed::createChannel()
{
CreateChannel *cf = new CreateChannel(NULL);
CreateChannel cf (this);
cf->setWindowTitle(tr("Create a new Channel"));
cf->ui.labelicon->setPixmap(QPixmap(":/images/add_channel64.png"));
cf.setWindowTitle(tr("Create a new Channel"));
cf.ui.labelicon->setPixmap(QPixmap(":/images/add_channel64.png"));
QString titleStr("<span style=\"font-size:24pt; font-weight:500;"
"color:#32CD32;\">%1</span>");
cf->ui.textlabelcreatforums->setText( titleStr.arg( tr("New Channel") ) ) ;
cf->show();
cf.ui.textlabelcreatforums->setText( titleStr.arg( tr("New Channel") ) ) ;
cf.exec();
}
void ChannelFeed::channelSelection()
@ -231,7 +231,8 @@ void ChannelFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyT
msgDialog->addDestination(type, grpId, inReplyTo);
msgDialog->show();
return;
/* window will destroy itself! */
}
void ChannelFeed::createMsg()
@ -244,7 +245,8 @@ void ChannelFeed::createMsg()
CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId);
msgDialog->show();
return;
/* window will destroy itself! */
}
void ChannelFeed::selectChannel( std::string cId)
@ -752,9 +754,8 @@ void ChannelFeed::showChannelDetails()
if (!rsChannels)
return;
static ChannelDetails *channelui = new ChannelDetails();
channelui->showDetails(mChannelId);
channelui->show();
ChannelDetails channelui (this);
channelui.showDetails(mChannelId);
channelui.exec();
}

View File

@ -42,6 +42,8 @@ GeneralMsgDialog::GeneralMsgDialog(QWidget *parent, uint32_t type)
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
connect(addButton, SIGNAL(clicked()), this, SLOT(newDestination()));
connect(typeComboBox, SIGNAL(currentIndexChanged( int )), this, SLOT(updateGroupId()));

View File

@ -385,6 +385,10 @@ void NewsFeed::deleteFeedItem(QWidget *item, uint32_t type)
std::cerr << "NewsFeed::deleteFeedItem()";
std::cerr << std::endl;
#endif
if (item) {
item->close ();
}
}
void NewsFeed::openChat(std::string peerId)
@ -408,6 +412,7 @@ void NewsFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
msgDialog->show();
/* window will destroy itself! */
}

View File

@ -417,6 +417,8 @@ void SharedFilesDialog::sendLinkToCloud()
nAddLinksDialog->addLinkComment();
nAddLinksDialog->close();
/* window will destroy itself! */
}
void SharedFilesDialog::addLinkToCloud()
@ -426,6 +428,8 @@ void SharedFilesDialog::addLinkToCloud()
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
nAddLinksDialog->show();
/* window will destroy itself! */
}
void SharedFilesDialog::playselectedfiles()

View File

@ -40,6 +40,8 @@ CreateChannelMsg::CreateChannelMsg(std::string cId)
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg()));

View File

@ -69,6 +69,8 @@ AttachFileItem::AttachFileItem(std::string hash, std::string name, uint64_t size
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
mMode = flags & AFI_MASK_STATE;
mType = flags & AFI_MASK_TYPE;

View File

@ -39,6 +39,8 @@ BlogMsgItem::BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

View File

@ -44,6 +44,8 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

View File

@ -39,6 +39,8 @@ ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, std::string chanId
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

View File

@ -41,6 +41,8 @@ ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, std::string foru
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

View File

@ -39,6 +39,8 @@ ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string foru
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

View File

@ -41,6 +41,8 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool is
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

View File

@ -40,6 +40,8 @@ SubDestItem::SubDestItem(uint32_t type, std::string groupId, std::string inReply
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
updateItemStatic();

View File

@ -72,6 +72,8 @@ SubFileItem::SubFileItem(std::string hash, std::string name, uint64_t size,
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
mMode = flags & SFI_MASK_STATE;
mType = flags & SFI_MASK_TYPE;

View File

@ -41,6 +41,8 @@ BlogDetails::BlogDetails(QWidget *parent, Qt::WFlags 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()));

View File

@ -119,6 +119,12 @@ BlogsDialog::BlogsDialog(QWidget *parent)
void BlogsDialog::blogListCustomPopupMenu( QPoint point )
{
BlogInfo bi;
if (!rsBlogs->getBlogInfo(mBlogId, bi))
{
return;
}
QMenu contextMnu( this );
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
@ -135,13 +141,7 @@ void BlogsDialog::blogListCustomPopupMenu( QPoint point )
connect( blogdetailsAct , SIGNAL( triggered() ), this, SLOT( showBlogDetails() ) );
contextMnu.clear();
BlogInfo bi;
if (!rsBlogs->getBlogInfo(mBlogId, bi))
{
return;
}
if (bi.blogFlags & RS_DISTRIB_PUBLISH)
{
contextMnu.addAction( createblogpostAct );
@ -168,10 +168,10 @@ void BlogsDialog::blogListCustomPopupMenu( QPoint point )
void BlogsDialog::createBlog()
{
CreateBlog *cf = new CreateBlog(NULL, false);
CreateBlog cf (this, false);
cf->setWindowTitle(tr("Create a new Blog"));
cf->show();
cf.setWindowTitle(tr("Create a new Blog"));
cf.exec();
}
void BlogsDialog::blogSelection()
@ -211,7 +211,8 @@ void BlogsDialog::openMsg(uint32_t type, std::string grpId, std::string inReplyT
msgDialog->addDestination(type, grpId, inReplyTo);
msgDialog->show();
return;
/* window will destroy itself! */
}
void BlogsDialog::createMsg()
@ -224,7 +225,8 @@ void BlogsDialog::createMsg()
CreateBlogMsg *msgDialog = new CreateBlogMsg(mBlogId);
msgDialog->show();
return;
/* window will destroy itself! */
}
void BlogsDialog::selectBlog( std::string bId)
@ -605,9 +607,10 @@ void BlogsDialog::showBlogDetails()
if (!rsBlogs)
return;
static BlogDetails *blogui = new BlogDetails();
BlogDetails *blogui = new BlogDetails();
blogui->showDetails(mBlogId);
blogui->show();
/* window will destroy itself! */
}

View File

@ -65,7 +65,9 @@ CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
setupFileActions();
setupEditActions();
setupViewActions();