From 81e56a909befa0679332c6a22ae84c86e1d057ce Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 15 Nov 2012 14:42:19 -0600 Subject: Fix incorrect kruler orientation on session restore --- kruler/main.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'kruler/main.cpp') diff --git a/kruler/main.cpp b/kruler/main.cpp index 764e874c..196909a6 100644 --- a/kruler/main.cpp +++ b/kruler/main.cpp @@ -9,6 +9,17 @@ #include "klineal.h" +#define RESTORE_RULERS(type) { \ + int n = 1; \ + while (KMainWindow::canBeRestored(n)) { \ + type* ruler = new type; \ + ruler->restore(n); \ + a.setMainWidget(ruler); \ + ruler->show(); \ + n++; \ + } \ +} + static const char homePageURL[] = "http://www.snafu.de/~till/"; static const char freeFormText[] = @@ -40,9 +51,14 @@ int main(int argc, char *argv[]) KApplication a; - KLineal *ruler = new KLineal(); - a.setMainWidget(ruler); - ruler->show(); + if (a.isRestored()) { + RESTORE_RULERS(KLineal) + } + else { + KLineal *ruler = new KLineal(); + a.setMainWidget(ruler); + ruler->show(); + } return a.exec(); } -- cgit v1.2.1