Back to index

scribus-ng  1.3.4.dfsg+svn20071115
newtemp.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "newtemp.h"
00008 #include "newtemp.moc"
00009 #include "page.h"
00010 extern QPixmap loadIcon(QString nam);
00011 
00012 #include <qtooltip.h>
00013 #include "pagestructs.h"
00014 #include "scribusdoc.h"
00015 #include "commonstrings.h"
00016 
00017 NewTm::NewTm( QWidget* parent, QString text, QString titel, ScribusDoc *doc, const QString& answerText)
00018               : QDialog( parent, "newt", true, 0 )
00019 {
00020        setCaption( titel );
00021        setIcon(loadIcon("AppIcon.png"));
00022        QueryLayout = new QVBoxLayout( this );
00023        QueryLayout->setSpacing( 5 );
00024        QueryLayout->setMargin( 5 );
00025        Layout2 = new QHBoxLayout;
00026        Layout2->setSpacing( 5 );
00027        Layout2->setMargin( 0 );
00028        Answer = new QLineEdit( this, "Answer" );
00029        Frage = new QLabel( Answer, text, this, "Frage" );
00030        Frage->setFrameShape( QLabel::MShape );
00031        Frage->setFrameShadow( QLabel::MShadow );
00032        Frage->adjustSize();
00033        Layout2->addWidget( Frage );
00034        Layout2->addWidget( Answer );
00035        QueryLayout->addLayout( Layout2 );
00036        if (doc->currentPageLayout != singlePage)
00037        {
00038               Layout3 = new QHBoxLayout;
00039               Layout3->setSpacing( 5 );
00040               Layout3->setMargin( 0 );
00041               Links = new QComboBox( true, this, "links" );
00042               QStringList::Iterator pNames;
00043               for(pNames = doc->pageSets[doc->currentPageLayout].pageNames.begin(); pNames != doc->pageSets[doc->currentPageLayout].pageNames.end(); ++pNames )
00044               {
00045                      //Links->insertItem((*pNames));
00046                      Links->insertItem(CommonStrings::translatePageSetLocString((*pNames)));
00047               }
00048               if (doc->currentPage()->LeftPg == 1)
00049                      Links->setCurrentItem(0);
00050               else if (doc->currentPage()->LeftPg == 0)
00051                      Links->setCurrentItem(Links->count()-1);
00052               else
00053                      Links->setCurrentItem(doc->currentPage()->LeftPg-1);
00054               Links->setEditable(false);
00055               Layout3->addWidget( Links );
00056               QueryLayout->addLayout( Layout3 );
00057        }
00058        Layout1 = new QHBoxLayout;
00059        Layout1->setSpacing( 5 );
00060        Layout1->setMargin( 0 );
00061        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00062        Layout1->addItem( spacer );
00063        PushButton1 = new QPushButton( CommonStrings::tr_OK, this, "PushButton1" );
00064        PushButton1->setDefault( true );
00065        Layout1->addWidget( PushButton1 );
00066        PushButton2 = new QPushButton( CommonStrings::tr_Cancel, this, "PushButton2" );
00067        Layout1->addWidget( PushButton2 );
00068        QueryLayout->addLayout( Layout1 );
00069        if (!answerText.isEmpty())
00070        {
00071               Answer->setText(answerText);
00072               Answer->setMinimumWidth(sizeHint().width());
00073               Answer->selectAll();
00074        }
00075        setMinimumSize(sizeHint());
00076        Answer->setFocus();
00077 
00078        // signals and slots connections
00079        connect( PushButton1, SIGNAL( clicked() ), this, SLOT( accept() ) );
00080        connect( PushButton2, SIGNAL( clicked() ), this, SLOT( reject() ) );
00081 
00082 }
00083