diff --git a/uic.cpp b/uic.cpp
index 84c13b7..399960b 100644
--- a/uic.cpp
+++ b/uic.cpp
@@ -335,34 +335,31 @@ bool Uic::rbwrite(DomUI *ui)
     WriteDeclaration(this).acceptUI(ui);
 
     if (option().execCode) {
-		QString qualifiedClassName = ui->elementClass() + option().postfix;
+                //QString qualifiedClassName = ui->elementClass() + option().postfix;
+                QString qualifiedPostfix = option().postfix.mid(0, 1).toUpper() + option().postfix.mid(1);
+                QString qualifiedClassName = QFileInfo(opt.inputFile).baseName() + qualifiedPostfix;
 		QString className = qualifiedClassName.mid(0, 1).toUpper() + qualifiedClassName.mid(1);
-		DomWidget*  parentWidget = ui->elementWidget();
-		QString parentClass = parentWidget->attributeClass();
+                /*DomWidget*  parentWidget = ui->elementWidget();
+                QString parentClass = parentWidget->attributeClass();*/
 
     	if (option().useKDE) {
 			out << "if $0 == __FILE__" << endl;
 			out << option().indent << "about = KDE::AboutData.new(\"" << className.toLower() << "\", \"" << className << "\", KDE.ki18n(\"\"), \"0.1\")" << endl;
 			out << option().indent << "KDE::CmdLineArgs.init(ARGV, about)" << endl;
-			out << option().indent << "a = KDE::Application.new" << endl;
-			out << option().indent << "u = " << option().prefix << className << ".new" << endl;
-			parentClass.replace(QRegExp("^Q"), "Qt::");
-			parentClass.replace(QRegExp("^K"), "KDE::");
-			out << option().indent << "w = " << parentClass << ".new" << endl;
-			out << option().indent << "u.setupUi(w)" << endl;
-			out << option().indent << "a.topWidget = w" << endl;
-			out << option().indent << "w.show" << endl;
-			out << option().indent << "a.exec" << endl;
+                        out << option().indent << "KDE::Application.new do" << endl;
+                        out << option().indent << option().indent << "w = "  << className << ".new" << endl;
+                        out << option().indent << option().indent << "topWidget = w" << endl;
+                        out << option().indent << option().indent << "w.show" << endl;
+                        out << option().indent << option().indent << "exec" << endl;
+                        out << option().indent << "end" << endl;
 			out << "end" << endl;
 		} else {
 			out << "if $0 == __FILE__" << endl;
-			out << option().indent << "a = Qt::Application.new(ARGV)" << endl;
-			out << option().indent << "u = " << option().prefix << className << ".new" << endl;
-			parentClass.replace(QRegExp("^Q"), "Qt::");
-			out << option().indent << "w = " << parentClass << ".new" << endl;
-			out << option().indent << "u.setupUi(w)" << endl;
-			out << option().indent << "w.show" << endl;
-			out << option().indent << "a.exec" << endl;
+                        out << option().indent << "Qt::Application.new(ARGV) do" << endl;
+                        out << option().indent << option().indent << "w = "  << className << ".new" << endl;
+                        out << option().indent << option().indent << "w.show" << endl;
+                        out << option().indent << option().indent << "exec" << endl;
+                        out << option().indent << "end" << endl;
 			out << "end" << endl;
 		}
     }
