void KTimerDialog::slotInternalTimeout() { emit timerTimeout(); switch(buttonOnTimeout) { case Help: slotHelp(); break; case Default: slotDefault(); break; case Ok: slotOk(); break; case Apply: applyPressed(); break; case Try: slotTry(); break; case Cancel: slotCancel(); break; case Close: slotClose(); break; /*case User1: slotUser1(); break; case User2: slotUser2(); break;*/ case User3: slotUser3(); break; case No: slotNo(); break; case Yes: slotCancel(); break; case Details: slotDetails(); break; case Filler: case Stretch: kdDebug() << "Cannot execute button code " << buttonOnTimeout << endl; break; } }
KateMwModOnHdDialog::KateMwModOnHdDialog( DocVector docs, QWidget *parent, const char *name ) : KDialog( parent ), m_proc( 0 ), m_diffFile( 0 ) { setCaption( i18n("Documents Modified on Disk") ); setButtons( User1 | User2 | User3 ); setButtonGuiItem( User1, KGuiItem (i18n("&Ignore"), "window-close") ); setButtonGuiItem( User2, KStandardGuiItem::overwrite() ); setButtonGuiItem( User3, KGuiItem (i18n("&Reload"), "view-refresh") ); setObjectName( name ); setModal( true ); setDefaultButton( KDialog::User3 ); setButtonWhatsThis( User1, i18n( "Removes the modified flag from the selected documents and closes the " "dialog if there are no more unhandled documents.") ); setButtonWhatsThis( User2, i18n( "Overwrite selected documents, discarding the disk changes and closes the " "dialog if there are no more unhandled documents.") ); setButtonWhatsThis( User3, i18n( "Reloads the selected documents from disk and closes the dialog if there " "are no more unhandled documents.") ); KVBox *w = new KVBox( this ); setMainWidget( w ); w->setSpacing( KDialog::spacingHint() ); KHBox *lo1 = new KHBox( w ); // dialog text QLabel *icon = new QLabel( lo1 ); icon->setPixmap( DesktopIcon("dialog-warning") ); QLabel *t = new QLabel( i18n( "<qt>The documents listed below have changed on disk.<p>Select one " "or more at once, and press an action button until the list is empty.</p></qt>"), lo1 ); lo1->setStretchFactor( t, 1000 ); // document list twDocuments = new QTreeWidget( w ); QStringList header; header << i18n("Filename") << i18n("Status on Disk"); twDocuments->setHeaderLabels(header); twDocuments->setSelectionMode( QAbstractItemView::SingleSelection ); twDocuments->setRootIsDecorated( false ); m_stateTexts << "" << i18n("Modified") << i18n("Created") << i18n("Deleted"); for ( int i = 0; i < docs.size(); i++ ) { new KateDocItem( docs[i], m_stateTexts[ (uint)KateDocManager::self()->documentInfo( docs[i] )->modifiedOnDiscReason ], twDocuments ); } twDocuments->header()->setStretchLastSection(false); twDocuments->header()->setResizeMode(0, QHeaderView::Stretch); twDocuments->header()->setResizeMode(1, QHeaderView::ResizeToContents); connect( twDocuments, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(slotSelectionChanged(QTreeWidgetItem*,QTreeWidgetItem*)) ); // diff button KHBox *lo2 = new KHBox ( w ); QWidget *d = new QWidget (lo2); lo2->setStretchFactor (d, 2); btnDiff = new KPushButton( KGuiItem (i18n("&View Difference"), "document-preview"), lo2 ); btnDiff->setWhatsThis(i18n( "Calculates the difference between the editor contents and the disk " "file for the selected document, and shows the difference with the " "default application. Requires diff(1).") ); connect( btnDiff, SIGNAL(clicked()), this, SLOT(slotDiff()) ); connect( this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()) ); connect( this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()) ); connect( this, SIGNAL(user3Clicked()), this, SLOT(slotUser3()) ); slotSelectionChanged(NULL, NULL); }