KDevelop API Documentation

commitdlg.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 1999, 2000 by Bernd Gehrmann                            *
00003  *   bernd@kdevelop.org                                                    *
00004  *   Copyright (C) 2003 by Mario Scalas                                    *
00005  *   mario.scalas@libero.it                                                *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  ***************************************************************************/
00013 
00014 #include <qlayout.h>
00015 #include <qlabel.h>
00016 #include <qcheckbox.h>
00017 #include <qlineedit.h>
00018 #include <qtextedit.h>
00019 #include <qpushbutton.h>
00020 
00021 #include <kapplication.h>
00022 #include <kbuttonbox.h>
00023 #include <klocale.h>
00024 #include <kmessagebox.h>
00025 
00026 #include "commitdlg.h"
00027 
00029 // class CommitDialog
00031 
00032 
00033 CommitDialog::CommitDialog( const QString &changeLogfileNamePath,  QWidget *parent )
00034     : CommitDialogBase( parent, "commitdialog", true )
00035 {
00036     connect( buttonOk, SIGNAL(clicked()), SLOT(accept()) );
00037     connect( buttonCancel, SIGNAL(clicked()), SLOT(reject()) );
00038 
00039     setChangeLogFileName( changeLogfileNamePath );
00040 }
00041 
00043 
00044 QStringList CommitDialog::logMessage() const
00045 {
00046     QStringList textLines;
00047     for (int i=0; i<textEdit->paragraphs(); ++i)
00048     {
00049         textLines << textEdit->text( i );
00050     }
00051     return textLines;
00052 }
00053 
00055 
00056 bool CommitDialog::mustAddToChangeLog() const
00057 {
00058     return checkAddToChangelog->isChecked();
00059 }
00060 
00062 
00063 void CommitDialog::accept()
00064 {
00065     if (textEdit->text().isNull() || textEdit->text().isEmpty()) {
00066         int s = KMessageBox::warningContinueCancel( this,
00067             i18n("You are committing your changes without any comment. This is not a good practice. Continue anyway?"),
00068             i18n("CVS Commit Warning"),
00069             KStdGuiItem::cont(),
00070             i18n("askWhenCommittingEmptyLogs") );
00071         if ( s != KMessageBox::Continue ) {
00072             return;
00073         }
00074     }
00075     QDialog::accept();
00076 }
00077 
00079 
00080 void CommitDialog::setChangeLogFileName( const QString &fileName )
00081 {
00082     changeLogNameEdit->setText( fileName );
00083 }
00084 
00086 
00087 QString CommitDialog::changeLogFileName() const
00088 {
00089     return changeLogNameEdit->text();
00090 }
00091 
00092 #include "commitdlg.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:43 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003